Merge "QCamera3: Fail unsupported stream configurations" into mnc-dr-dev
diff --git a/QCamera2/HAL3/QCamera3HWI.cpp b/QCamera2/HAL3/QCamera3HWI.cpp
index f3e554a..b01e946 100644
--- a/QCamera2/HAL3/QCamera3HWI.cpp
+++ b/QCamera2/HAL3/QCamera3HWI.cpp
@@ -1099,7 +1099,9 @@
for (List<stream_info_t*>::iterator it = mStreamInfo.begin();
it != mStreamInfo.end(); it++) {
QCamera3ProcessingChannel *channel = (QCamera3ProcessingChannel*)(*it)->stream->priv;
- channel->stop();
+ if (channel) {
+ channel->stop();
+ }
(*it)->status = INVALID;
}
@@ -1145,6 +1147,7 @@
cam_dimension_t largeYuv888Size = {0, 0};
cam_dimension_t maxViewfinderSize = {0, 0};
bool bJpegExceeds4K = false;
+ bool bJpegOnEncoder = false;
bool bUseCommonFeatureMask = false;
uint32_t commonFeatureMask = 0;
maxViewfinderSize = gCamCapability[mCameraId]->max_viewfinder_size;
@@ -1242,6 +1245,7 @@
newStream->height)) {
commonFeatureMask |= CAM_QCOM_FEATURE_NONE;
numStreamsOnEncoder++;
+ bJpegOnEncoder = true;
}
break;
case HAL_PIXEL_FORMAT_RAW10:
@@ -1341,6 +1345,21 @@
return -EINVAL;
}
+ // When JPEG and preview streams share VFE output, CPP will not apply CAC2
+ // on JPEG stream. So disable such configurations to ensure CAC2 is applied.
+ // Don't fail for reprocess configurations. Also don't fail if bJpegExceeds4K
+ // is not true. Otherwise testMandatoryOutputCombinations will fail with following
+ // configurations:
+ // {[PRIV, PREVIEW] [PRIV, RECORD] [JPEG, RECORD]}
+ // {[PRIV, PREVIEW] [YUV, RECORD] [JPEG, RECORD]}
+ // (These two configurations will not have CAC2 enabled even in HQ modes.)
+ if (!isZsl && bJpegOnEncoder && bJpegExceeds4K && bUseCommonFeatureMask) {
+ ALOGE("%s: Blob size greater than 4k and multiple streams are on encoder output",
+ __func__);
+ pthread_mutex_unlock(&mMutex);
+ return -EINVAL;
+ }
+
// If jpeg stream is available, and a YUV 888 stream is on Encoder path, and
// the YUV stream's size is greater or equal to the JPEG size, set common
// postprocess mask to NONE, so that we can take advantage of postproc bypass.