diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2018-01-23 08:28:52 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2018-01-23 08:28:52 +0000 |
commit | 0cf270214954184e6c709d4737710fbe5376af86 (patch) | |
tree | 865517179fd201bb45cb1876942669052e6aebd0 | |
parent | 2ce7c07bab7290733cd800a1c83d27e821b709c8 (diff) | |
parent | e503bfd7ec95fedb44f5b9432f1fbd5b749325c6 (diff) | |
download | camera-0cf270214954184e6c709d4737710fbe5376af86.tar.gz |
Snap for 4560043 from e503bfd7ec95fedb44f5b9432f1fbd5b749325c6 to pi-release
Change-Id: I6c988f8ba9166c49c68d2138179484115b4d2cf4
-rw-r--r-- | msm8998/QCamera2/HAL3/QCamera3HWI.cpp | 491 | ||||
-rw-r--r-- | msm8998/QCamera2/HAL3/QCamera3HWI.h | 2 | ||||
-rw-r--r-- | msm8998/QCamera2/HAL3/QCamera3VendorTags.cpp | 4 |
3 files changed, 266 insertions, 231 deletions
diff --git a/msm8998/QCamera2/HAL3/QCamera3HWI.cpp b/msm8998/QCamera2/HAL3/QCamera3HWI.cpp index 68e0b88..2989c6e 100644 --- a/msm8998/QCamera2/HAL3/QCamera3HWI.cpp +++ b/msm8998/QCamera2/HAL3/QCamera3HWI.cpp @@ -277,8 +277,7 @@ const QCamera3HardwareInterface::QCameraMap< { ANDROID_CONTROL_AE_MODE_ON_AUTO_FLASH, CAM_FLASH_MODE_AUTO}, { ANDROID_CONTROL_AE_MODE_ON_ALWAYS_FLASH, CAM_FLASH_MODE_ON }, { ANDROID_CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE, CAM_FLASH_MODE_AUTO}, - { (camera_metadata_enum_android_control_ae_mode_t) - NEXUS_EXPERIMENTAL_2016_CONTROL_AE_MODE_EXTERNAL_FLASH, CAM_FLASH_MODE_OFF } + { ANDROID_CONTROL_AE_MODE_ON_EXTERNAL_FLASH, CAM_FLASH_MODE_OFF } }; const QCamera3HardwareInterface::QCameraMap< @@ -470,6 +469,7 @@ QCamera3HardwareInterface::QCamera3HardwareInterface(uint32_t cameraId, mParamHeap(NULL), mParameters(NULL), mPrevParameters(NULL), + m_ISTypeVideo(IS_TYPE_NONE), m_bIsVideo(false), m_bIs4KVideo(false), m_bEisSupportedSize(false), @@ -535,7 +535,7 @@ QCamera3HardwareInterface::QCamera3HardwareInterface(uint32_t cameraId, mCommon.init(gCamCapability[cameraId]); mCameraDevice.common.tag = HARDWARE_DEVICE_TAG; #ifndef USE_HAL_3_3 - mCameraDevice.common.version = CAMERA_DEVICE_API_VERSION_3_4; + mCameraDevice.common.version = CAMERA_DEVICE_API_VERSION_3_5; #else mCameraDevice.common.version = CAMERA_DEVICE_API_VERSION_3_3; #endif @@ -3101,12 +3101,241 @@ int QCamera3HardwareInterface::configureStreamsPerfLocked( mFirstMetadataCallback = true; + if (streamList->session_parameters != nullptr) { + CameraMetadata meta; + meta = streamList->session_parameters; + + // send an unconfigure to the backend so that the isp + // resources are deallocated + if (!mFirstConfiguration) { + cam_stream_size_info_t stream_config_info; + int32_t hal_version = CAM_HAL_V3; + memset(&stream_config_info, 0, sizeof(cam_stream_size_info_t)); + stream_config_info.buffer_info.min_buffers = + MIN_INFLIGHT_REQUESTS; + stream_config_info.buffer_info.max_buffers = + m_bIs4KVideo ? 0 : + m_bEis3PropertyEnabled && m_bIsVideo ? MAX_VIDEO_BUFFERS : MAX_INFLIGHT_REQUESTS; + clear_metadata_buffer(mParameters); + ADD_SET_PARAM_ENTRY_TO_BATCH(mParameters, + CAM_INTF_PARM_HAL_VERSION, hal_version); + ADD_SET_PARAM_ENTRY_TO_BATCH(mParameters, + CAM_INTF_META_STREAM_INFO, stream_config_info); + rc = mCameraHandle->ops->set_parms(mCameraHandle->camera_handle, + mParameters); + if (rc < 0) { + LOGE("set_parms for unconfigure failed"); + pthread_mutex_unlock(&mMutex); + return rc; + } + + } + /* get eis information for stream configuration */ + cam_is_type_t isTypePreview, is_type=IS_TYPE_NONE; + char is_type_value[PROPERTY_VALUE_MAX]; + property_get("persist.camera.is_type", is_type_value, "4"); + m_ISTypeVideo = static_cast<cam_is_type_t>(atoi(is_type_value)); + // Make default value for preview IS_TYPE as IS_TYPE_EIS_2_0 + property_get("persist.camera.is_type_preview", is_type_value, "4"); + isTypePreview = static_cast<cam_is_type_t>(atoi(is_type_value)); + LOGD("isTypeVideo: %d isTypePreview: %d", m_ISTypeVideo, isTypePreview); + + int32_t hal_version = CAM_HAL_V3; + clear_metadata_buffer(mParameters); + ADD_SET_PARAM_ENTRY_TO_BATCH(mParameters, CAM_INTF_PARM_HAL_VERSION, hal_version); + ADD_SET_PARAM_ENTRY_TO_BATCH(mParameters, CAM_INTF_META_CAPTURE_INTENT, mCaptureIntent); + + if (mFirstConfiguration) { + // configure instant AEC + // Instant AEC is a session based parameter and it is needed only + // once per complete session after open camera. + // i.e. This is set only once for the first capture request, after open camera. + setInstantAEC(meta); + } + + bool setEis = isEISEnabled(meta); + int32_t vsMode; + vsMode = (setEis)? DIS_ENABLE: DIS_DISABLE; + if (ADD_SET_PARAM_ENTRY_TO_BATCH(mParameters, CAM_INTF_PARM_DIS_ENABLE, vsMode)) { + rc = BAD_VALUE; + } + LOGD("setEis %d", setEis); + bool eis3Supported = false; + size_t count = IS_TYPE_MAX; + count = MIN(gCamCapability[mCameraId]->supported_is_types_cnt, count); + for (size_t i = 0; i < count; i++) { + if (gCamCapability[mCameraId]->supported_is_types[i] == IS_TYPE_EIS_3_0) { + eis3Supported = true; + break; + } + } + + //IS type will be 0 unless EIS is supported. If EIS is supported + //it could either be 4 or 5 depending on the stream and video size + for (uint32_t i = 0; i < mStreamConfigInfo.num_streams; i++) { + if (setEis) { + if (mStreamConfigInfo.type[i] == CAM_STREAM_TYPE_PREVIEW) { + is_type = isTypePreview; + } else if (mStreamConfigInfo.type[i] == CAM_STREAM_TYPE_VIDEO ) { + if ( (m_ISTypeVideo == IS_TYPE_EIS_3_0) && (eis3Supported == FALSE) ) { + LOGW(" EIS_3.0 is not supported and so setting EIS_2.0"); + is_type = IS_TYPE_EIS_2_0; + } else { + is_type = m_ISTypeVideo; + } + } else { + is_type = IS_TYPE_NONE; + } + mStreamConfigInfo.is_type[i] = is_type; + } else { + mStreamConfigInfo.is_type[i] = IS_TYPE_NONE; + } + } + + ADD_SET_PARAM_ENTRY_TO_BATCH(mParameters, + CAM_INTF_META_STREAM_INFO, mStreamConfigInfo); + + char prop[PROPERTY_VALUE_MAX]; + //Disable tintless only if the property is set to 0 + memset(prop, 0, sizeof(prop)); + property_get("persist.camera.tintless.enable", prop, "1"); + int32_t tintless_value = atoi(prop); + + ADD_SET_PARAM_ENTRY_TO_BATCH(mParameters, + CAM_INTF_PARM_TINTLESS, tintless_value); + + //Disable CDS for HFR mode or if DIS/EIS is on. + //CDS is a session parameter in the backend/ISP, so need to be set/reset + //after every configure_stream + if ((CAMERA3_STREAM_CONFIGURATION_CONSTRAINED_HIGH_SPEED_MODE == mOpMode) || + (m_bIsVideo)) { + int32_t cds = CAM_CDS_MODE_OFF; + if (ADD_SET_PARAM_ENTRY_TO_BATCH(mParameters, + CAM_INTF_PARM_CDS_MODE, cds)) + LOGE("Failed to disable CDS for HFR mode"); + + } + + if (m_debug_avtimer || meta.exists(QCAMERA3_USE_AV_TIMER)) { + uint8_t* use_av_timer = NULL; + + if (m_debug_avtimer){ + LOGI(" Enabling AV timer through setprop"); + use_av_timer = &m_debug_avtimer; + m_bAVTimerEnabled = true; + } + else{ + use_av_timer = + meta.find(QCAMERA3_USE_AV_TIMER).data.u8; + if (use_av_timer) { + m_bAVTimerEnabled = true; + LOGI("Enabling AV timer through Metadata: use_av_timer: %d", *use_av_timer); + } + } + + if (ADD_SET_PARAM_ENTRY_TO_BATCH(mParameters, CAM_INTF_META_USE_AV_TIMER, *use_av_timer)) { + rc = BAD_VALUE; + } + } + + setMobicat(); + + /* Set fps and hfr mode while sending meta stream info so that sensor + * can configure appropriate streaming mode */ + mHFRVideoFps = DEFAULT_VIDEO_FPS; + mMinInFlightRequests = MIN_INFLIGHT_REQUESTS; + mMaxInFlightRequests = MAX_INFLIGHT_REQUESTS; + if (meta.exists(ANDROID_CONTROL_AE_TARGET_FPS_RANGE)) { + rc = setHalFpsRange(meta, mParameters); + if (rc == NO_ERROR) { + int32_t max_fps = + (int32_t) meta.find(ANDROID_CONTROL_AE_TARGET_FPS_RANGE).data.i32[1]; + if (max_fps == 60 || mCaptureIntent == ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_RECORD) { + mMinInFlightRequests = MIN_INFLIGHT_60FPS_REQUESTS; + } + /* For HFR, more buffers are dequeued upfront to improve the performance */ + if (mBatchSize) { + mMinInFlightRequests = MIN_INFLIGHT_HFR_REQUESTS; + mMaxInFlightRequests = MAX_INFLIGHT_HFR_REQUESTS; + } + } + else { + LOGE("setHalFpsRange failed"); + } + } + memset(&mBatchedStreamsArray, 0, sizeof(cam_stream_ID_t)); + + if (meta.exists(QCAMERA3_VIDEO_HDR_MODE)) { + cam_video_hdr_mode_t vhdr = (cam_video_hdr_mode_t) + meta.find(QCAMERA3_VIDEO_HDR_MODE).data.i32[0]; + rc = setVideoHdrMode(mParameters, vhdr); + if (rc != NO_ERROR) { + LOGE("setVideoHDR is failed"); + } + } + + if (meta.exists(TANGO_MODE_DATA_SENSOR_FULLFOV)) { + uint8_t sensorModeFullFov = + meta.find(TANGO_MODE_DATA_SENSOR_FULLFOV).data.u8[0]; + LOGD("SENSOR_MODE_FULLFOV %d" , sensorModeFullFov); + if (ADD_SET_PARAM_ENTRY_TO_BATCH(mParameters, CAM_INTF_META_SENSOR_MODE_FULLFOV, + sensorModeFullFov)) { + rc = BAD_VALUE; + } + } + //TODO: validate the arguments, HSV scenemode should have only the + //advertised fps ranges + + /*set the capture intent, hal version, tintless, stream info, + *and disenable parameters to the backend*/ + LOGD("set_parms META_STREAM_INFO " ); + for (uint32_t i = 0; i < mStreamConfigInfo.num_streams; i++) { + LOGI("STREAM INFO : type %d, wxh: %d x %d, pp_mask: 0x%" PRIx64 + ", Format:%d is_type: %d", + mStreamConfigInfo.type[i], + mStreamConfigInfo.stream_sizes[i].width, + mStreamConfigInfo.stream_sizes[i].height, + mStreamConfigInfo.postprocess_mask[i], + mStreamConfigInfo.format[i], + mStreamConfigInfo.is_type[i]); + } + + rc = mCameraHandle->ops->set_parms(mCameraHandle->camera_handle, + mParameters); + if (rc < 0) { + LOGE("set_parms failed for hal version, stream info"); + } + + } + pthread_mutex_unlock(&mMutex); return rc; } /*=========================================================================== + * FUNCTION : isEISEnabled + * + * DESCRIPTION: Decide whether EIS should get enabled or not. + * + * PARAMETERS : + * @meta : request from framework to process + * + * RETURN : true/false Whether EIS should be enabled + * + *==========================================================================*/ +bool QCamera3HardwareInterface::isEISEnabled(const CameraMetadata& meta) { + uint8_t fwkVideoStabMode = 0; + if (meta.exists(ANDROID_CONTROL_VIDEO_STABILIZATION_MODE)) { + fwkVideoStabMode = meta.find(ANDROID_CONTROL_VIDEO_STABILIZATION_MODE).data.u8[0]; + } + + // If EIS setprop is enabled then only turn it on for video/preview + return m_bEisEnable && (m_bIsVideo || fwkVideoStabMode) && m_bEisSupportedSize && + (m_ISTypeVideo >= IS_TYPE_EIS_2_0) && !meta.exists(QCAMERA3_USE_AV_TIMER); +} + +/*=========================================================================== * FUNCTION : validateCaptureRequest * * DESCRIPTION: validate a capture request from camera service @@ -4918,7 +5147,6 @@ int QCamera3HardwareInterface::processCaptureRequest( CameraMetadata meta; bool isVidBufRequested = false; camera3_stream_buffer_t *pInputBuffer = NULL; - char prop[PROPERTY_VALUE_MAX]; pthread_mutex_lock(&mMutex); @@ -4953,229 +5181,14 @@ int QCamera3HardwareInterface::processCaptureRequest( // stream on all streams if (mState == CONFIGURED) { logEaselEvent("EASEL_STARTUP_LATENCY", "First request"); - // send an unconfigure to the backend so that the isp - // resources are deallocated - if (!mFirstConfiguration) { - cam_stream_size_info_t stream_config_info; - int32_t hal_version = CAM_HAL_V3; - memset(&stream_config_info, 0, sizeof(cam_stream_size_info_t)); - stream_config_info.buffer_info.min_buffers = - MIN_INFLIGHT_REQUESTS; - stream_config_info.buffer_info.max_buffers = - m_bIs4KVideo ? 0 : - m_bEis3PropertyEnabled && m_bIsVideo ? MAX_VIDEO_BUFFERS : MAX_INFLIGHT_REQUESTS; - clear_metadata_buffer(mParameters); - ADD_SET_PARAM_ENTRY_TO_BATCH(mParameters, - CAM_INTF_PARM_HAL_VERSION, hal_version); - ADD_SET_PARAM_ENTRY_TO_BATCH(mParameters, - CAM_INTF_META_STREAM_INFO, stream_config_info); - rc = mCameraHandle->ops->set_parms(mCameraHandle->camera_handle, - mParameters); - if (rc < 0) { - LOGE("set_parms for unconfigure failed"); - pthread_mutex_unlock(&mMutex); - return rc; - } - - } - mPerfLockMgr.acquirePerfLock(PERF_LOCK_START_PREVIEW); - /* get eis information for stream configuration */ - cam_is_type_t isTypeVideo, isTypePreview, is_type=IS_TYPE_NONE; - char is_type_value[PROPERTY_VALUE_MAX]; - property_get("persist.camera.is_type", is_type_value, "4"); - isTypeVideo = static_cast<cam_is_type_t>(atoi(is_type_value)); - // Make default value for preview IS_TYPE as IS_TYPE_EIS_2_0 - property_get("persist.camera.is_type_preview", is_type_value, "4"); - isTypePreview = static_cast<cam_is_type_t>(atoi(is_type_value)); - LOGD("isTypeVideo: %d isTypePreview: %d", isTypeVideo, isTypePreview); - - if (meta.exists(ANDROID_CONTROL_CAPTURE_INTENT)) { - int32_t hal_version = CAM_HAL_V3; - uint8_t captureIntent = - meta.find(ANDROID_CONTROL_CAPTURE_INTENT).data.u8[0]; - mCaptureIntent = captureIntent; - clear_metadata_buffer(mParameters); - ADD_SET_PARAM_ENTRY_TO_BATCH(mParameters, CAM_INTF_PARM_HAL_VERSION, hal_version); - ADD_SET_PARAM_ENTRY_TO_BATCH(mParameters, CAM_INTF_META_CAPTURE_INTENT, captureIntent); - } - if (mFirstConfiguration) { - // configure instant AEC - // Instant AEC is a session based parameter and it is needed only - // once per complete session after open camera. - // i.e. This is set only once for the first capture request, after open camera. - setInstantAEC(meta); - } - uint8_t fwkVideoStabMode=0; - if (meta.exists(ANDROID_CONTROL_VIDEO_STABILIZATION_MODE)) { - fwkVideoStabMode = meta.find(ANDROID_CONTROL_VIDEO_STABILIZATION_MODE).data.u8[0]; - } - - // If EIS setprop is enabled then only turn it on for video/preview - bool setEis = m_bEisEnable && (m_bIsVideo || fwkVideoStabMode) && m_bEisSupportedSize && - (isTypeVideo >= IS_TYPE_EIS_2_0) && !meta.exists(QCAMERA3_USE_AV_TIMER); - int32_t vsMode; - vsMode = (setEis)? DIS_ENABLE: DIS_DISABLE; - if (ADD_SET_PARAM_ENTRY_TO_BATCH(mParameters, CAM_INTF_PARM_DIS_ENABLE, vsMode)) { - rc = BAD_VALUE; - } - LOGD("setEis %d", setEis); - bool eis3Supported = false; - size_t count = IS_TYPE_MAX; - count = MIN(gCamCapability[mCameraId]->supported_is_types_cnt, count); - for (size_t i = 0; i < count; i++) { - if (gCamCapability[mCameraId]->supported_is_types[i] == IS_TYPE_EIS_3_0) { - eis3Supported = true; - break; - } - } - - //IS type will be 0 unless EIS is supported. If EIS is supported - //it could either be 4 or 5 depending on the stream and video size - for (uint32_t i = 0; i < mStreamConfigInfo.num_streams; i++) { - if (setEis) { - if (mStreamConfigInfo.type[i] == CAM_STREAM_TYPE_PREVIEW) { - is_type = isTypePreview; - } else if (mStreamConfigInfo.type[i] == CAM_STREAM_TYPE_VIDEO ) { - if ( (isTypeVideo == IS_TYPE_EIS_3_0) && (eis3Supported == FALSE) ) { - LOGW(" EIS_3.0 is not supported and so setting EIS_2.0"); - is_type = IS_TYPE_EIS_2_0; - } else { - is_type = isTypeVideo; - } - } else { - is_type = IS_TYPE_NONE; - } - mStreamConfigInfo.is_type[i] = is_type; - } else { - mStreamConfigInfo.is_type[i] = IS_TYPE_NONE; - } - } - - ADD_SET_PARAM_ENTRY_TO_BATCH(mParameters, - CAM_INTF_META_STREAM_INFO, mStreamConfigInfo); - - //Disable tintless only if the property is set to 0 - memset(prop, 0, sizeof(prop)); - property_get("persist.camera.tintless.enable", prop, "1"); - int32_t tintless_value = atoi(prop); - - ADD_SET_PARAM_ENTRY_TO_BATCH(mParameters, - CAM_INTF_PARM_TINTLESS, tintless_value); - - //Disable CDS for HFR mode or if DIS/EIS is on. - //CDS is a session parameter in the backend/ISP, so need to be set/reset - //after every configure_stream - if ((CAMERA3_STREAM_CONFIGURATION_CONSTRAINED_HIGH_SPEED_MODE == mOpMode) || - (m_bIsVideo)) { - int32_t cds = CAM_CDS_MODE_OFF; - if (ADD_SET_PARAM_ENTRY_TO_BATCH(mParameters, - CAM_INTF_PARM_CDS_MODE, cds)) - LOGE("Failed to disable CDS for HFR mode"); - - } - - if (m_debug_avtimer || meta.exists(QCAMERA3_USE_AV_TIMER)) { - uint8_t* use_av_timer = NULL; - - if (m_debug_avtimer){ - LOGI(" Enabling AV timer through setprop"); - use_av_timer = &m_debug_avtimer; - m_bAVTimerEnabled = true; - } - else{ - use_av_timer = - meta.find(QCAMERA3_USE_AV_TIMER).data.u8; - if (use_av_timer) { - m_bAVTimerEnabled = true; - LOGI("Enabling AV timer through Metadata: use_av_timer: %d", *use_av_timer); - } - } - - if (ADD_SET_PARAM_ENTRY_TO_BATCH(mParameters, CAM_INTF_META_USE_AV_TIMER, *use_av_timer)) { - rc = BAD_VALUE; - } - } - - setMobicat(); uint8_t nrMode = 0; if (meta.exists(ANDROID_NOISE_REDUCTION_MODE)) { nrMode = meta.find(ANDROID_NOISE_REDUCTION_MODE).data.u8[0]; } - /* Set fps and hfr mode while sending meta stream info so that sensor - * can configure appropriate streaming mode */ - mHFRVideoFps = DEFAULT_VIDEO_FPS; - mMinInFlightRequests = MIN_INFLIGHT_REQUESTS; - mMaxInFlightRequests = MAX_INFLIGHT_REQUESTS; - if (meta.exists(ANDROID_CONTROL_AE_TARGET_FPS_RANGE)) { - rc = setHalFpsRange(meta, mParameters); - if (rc == NO_ERROR) { - int32_t max_fps = - (int32_t) meta.find(ANDROID_CONTROL_AE_TARGET_FPS_RANGE).data.i32[1]; - if (max_fps == 60 || mCaptureIntent == ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_RECORD) { - mMinInFlightRequests = MIN_INFLIGHT_60FPS_REQUESTS; - } - /* For HFR, more buffers are dequeued upfront to improve the performance */ - if (mBatchSize) { - mMinInFlightRequests = MIN_INFLIGHT_HFR_REQUESTS; - mMaxInFlightRequests = MAX_INFLIGHT_HFR_REQUESTS; - } - } - else { - LOGE("setHalFpsRange failed"); - } - } - if (meta.exists(ANDROID_CONTROL_MODE)) { - uint8_t metaMode = meta.find(ANDROID_CONTROL_MODE).data.u8[0]; - rc = extractSceneMode(meta, metaMode, mParameters); - if (rc != NO_ERROR) { - LOGE("extractSceneMode failed"); - } - } - memset(&mBatchedStreamsArray, 0, sizeof(cam_stream_ID_t)); - - if (meta.exists(QCAMERA3_VIDEO_HDR_MODE)) { - cam_video_hdr_mode_t vhdr = (cam_video_hdr_mode_t) - meta.find(QCAMERA3_VIDEO_HDR_MODE).data.i32[0]; - rc = setVideoHdrMode(mParameters, vhdr); - if (rc != NO_ERROR) { - LOGE("setVideoHDR is failed"); - } - } - - if (meta.exists(TANGO_MODE_DATA_SENSOR_FULLFOV)) { - uint8_t sensorModeFullFov = - meta.find(TANGO_MODE_DATA_SENSOR_FULLFOV).data.u8[0]; - LOGD("SENSOR_MODE_FULLFOV %d" , sensorModeFullFov); - if (ADD_SET_PARAM_ENTRY_TO_BATCH(mParameters, CAM_INTF_META_SENSOR_MODE_FULLFOV, - sensorModeFullFov)) { - rc = BAD_VALUE; - } - } - //TODO: validate the arguments, HSV scenemode should have only the - //advertised fps ranges - - /*set the capture intent, hal version, tintless, stream info, - *and disenable parameters to the backend*/ - LOGD("set_parms META_STREAM_INFO " ); - for (uint32_t i = 0; i < mStreamConfigInfo.num_streams; i++) { - LOGI("STREAM INFO : type %d, wxh: %d x %d, pp_mask: 0x%" PRIx64 - ", Format:%d is_type: %d", - mStreamConfigInfo.type[i], - mStreamConfigInfo.stream_sizes[i].width, - mStreamConfigInfo.stream_sizes[i].height, - mStreamConfigInfo.postprocess_mask[i], - mStreamConfigInfo.format[i], - mStreamConfigInfo.is_type[i]); - } - - rc = mCameraHandle->ops->set_parms(mCameraHandle->camera_handle, - mParameters); - if (rc < 0) { - LOGE("set_parms failed for hal version, stream info"); - } - + cam_is_type_t is_type = IS_TYPE_NONE; + bool setEis = isEISEnabled(meta); cam_sensor_mode_info_t sensorModeInfo = {}; rc = getSensorModeInfo(sensorModeInfo); if (rc != NO_ERROR) { @@ -8261,6 +8274,7 @@ QCamera3HardwareInterface::translateFromHalMetadata( // AF scene change IF_META_AVAILABLE(uint8_t, afSceneChange, CAM_INTF_META_AF_SCENE_CHANGE, metadata) { camMetadata.update(NEXUS_EXPERIMENTAL_2016_AF_SCENE_CHANGE, afSceneChange, 1); + camMetadata.update(ANDROID_CONTROL_AF_SCENE_CHANGE, afSceneChange, 1); } // Enable ZSL @@ -8563,7 +8577,7 @@ QCamera3HardwareInterface::translateCbUrgentMetadataToResultMetadata fwk_aeMode = ANDROID_CONTROL_AE_MODE_OFF; camMetadata.update(ANDROID_CONTROL_AE_MODE, &fwk_aeMode, 1); } else if (aeMode == CAM_AE_MODE_ON_EXTERNAL_FLASH) { - fwk_aeMode = NEXUS_EXPERIMENTAL_2016_CONTROL_AE_MODE_EXTERNAL_FLASH; + fwk_aeMode = ANDROID_CONTROL_AE_MODE_ON_EXTERNAL_FLASH; camMetadata.update(ANDROID_CONTROL_AE_MODE, &fwk_aeMode, 1); } else { LOGE("Not enough info to deduce ANDROID_CONTROL_AE_MODE redeye:%d, " @@ -10170,7 +10184,7 @@ int QCamera3HardwareInterface::initStaticMetadata(uint32_t cameraId) for (size_t i = 0; i < count; i++) { uint8_t aeMode = gCamCapability[cameraId]->supported_ae_modes[i]; if (aeMode == CAM_AE_MODE_ON_EXTERNAL_FLASH) { - aeMode = NEXUS_EXPERIMENTAL_2016_CONTROL_AE_MODE_EXTERNAL_FLASH; + aeMode = ANDROID_CONTROL_AE_MODE_ON_EXTERNAL_FLASH; } avail_ae_modes.add(aeMode); } @@ -10401,6 +10415,16 @@ int QCamera3HardwareInterface::initStaticMetadata(uint32_t cameraId) (void *)gCamCapability[cameraId]->calibration_transform2, CAL_TRANSFORM_COLS * CAL_TRANSFORM_ROWS); +#ifndef USE_HAL_3_3 + + int32_t session_keys[] = {ANDROID_CONTROL_VIDEO_STABILIZATION_MODE, + ANDROID_CONTROL_AE_TARGET_FPS_RANGE, QCAMERA3_INSTANT_AEC_MODE, QCAMERA3_USE_AV_TIMER, + QCAMERA3_VIDEO_HDR_MODE, TANGO_MODE_DATA_SENSOR_FULLFOV}; + staticInfo.update(ANDROID_REQUEST_AVAILABLE_SESSION_KEYS, session_keys, + sizeof(session_keys) / sizeof(session_keys[0])); + +#endif + int32_t request_keys_basic[] = {ANDROID_COLOR_CORRECTION_MODE, ANDROID_COLOR_CORRECTION_TRANSFORM, ANDROID_COLOR_CORRECTION_GAINS, ANDROID_COLOR_CORRECTION_ABERRATION_MODE, @@ -10484,6 +10508,7 @@ int QCamera3HardwareInterface::initStaticMetadata(uint32_t cameraId) ANDROID_COLOR_CORRECTION_GAINS, ANDROID_CONTROL_AE_MODE, ANDROID_CONTROL_AE_REGIONS, ANDROID_CONTROL_AE_STATE, ANDROID_CONTROL_AF_MODE, ANDROID_CONTROL_AF_STATE, ANDROID_CONTROL_AWB_MODE, + ANDROID_CONTROL_AF_SCENE_CHANGE, ANDROID_CONTROL_AWB_STATE, ANDROID_CONTROL_MODE, ANDROID_EDGE_MODE, ANDROID_FLASH_FIRING_POWER, ANDROID_FLASH_FIRING_TIME, ANDROID_FLASH_MODE, ANDROID_FLASH_STATE, ANDROID_JPEG_GPS_COORDINATES, ANDROID_JPEG_GPS_PROCESSING_METHOD, @@ -10880,7 +10905,7 @@ int QCamera3HardwareInterface::initStaticMetadata(uint32_t cameraId) } if (gCamCapability[cameraId]->supported_instant_aec_modes_cnt > 0) { - int32_t available_instant_aec_modes[CAM_AEC_CONVERGENCE_MAX]; + uint8_t available_instant_aec_modes[CAM_AEC_CONVERGENCE_MAX]; size = 0; count = CAM_AEC_CONVERGENCE_MAX; count = MIN(gCamCapability[cameraId]->supported_instant_aec_modes_cnt, count); @@ -10888,7 +10913,7 @@ int QCamera3HardwareInterface::initStaticMetadata(uint32_t cameraId) int val = lookupFwkName(INSTANT_AEC_MODES_MAP, METADATA_MAP_SIZE(INSTANT_AEC_MODES_MAP), gCamCapability[cameraId]->supported_instant_aec_modes[i]); if (NAME_NOT_FOUND != val) { - available_instant_aec_modes[size] = (int32_t)val; + available_instant_aec_modes[size] = (uint8_t)val; size++; } } @@ -10993,6 +11018,10 @@ int QCamera3HardwareInterface::initStaticMetadata(uint32_t cameraId) staticInfo.update(NEXUS_EXPERIMENTAL_2017_EEPROM_VERSION_INFO, gCamCapability[cameraId]->eeprom_version_info, eepromLength); available_characteristics_keys.add(NEXUS_EXPERIMENTAL_2017_EEPROM_VERSION_INFO); + + staticInfo.update(ANDROID_INFO_VERSION, + gCamCapability[cameraId]->eeprom_version_info, eepromLength); + available_characteristics_keys.add(ANDROID_INFO_VERSION); } staticInfo.update(ANDROID_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS, @@ -11324,7 +11353,7 @@ int QCamera3HardwareInterface::getCamInfo(uint32_t cameraId, info->orientation = (int)gCamCapability[cameraId]->sensor_mount_angle; #ifndef USE_HAL_3_3 - info->device_version = CAMERA_DEVICE_API_VERSION_3_4; + info->device_version = CAMERA_DEVICE_API_VERSION_3_5; #else info->device_version = CAMERA_DEVICE_API_VERSION_3_3; #endif @@ -11810,7 +11839,7 @@ camera_metadata_t* QCamera3HardwareInterface::translateCapabilityToMetadata(int settings.update(QCAMERA3_AWB_CONVERGENCE_SPEED, &default_awb_speed, 1); // Set instant AEC to normal convergence by default - int32_t instant_aec_mode = (int32_t)QCAMERA3_INSTANT_AEC_NORMAL_CONVERGENCE; + uint8_t instant_aec_mode = (uint8_t)QCAMERA3_INSTANT_AEC_NORMAL_CONVERGENCE; settings.update(QCAMERA3_INSTANT_AEC_MODE, &instant_aec_mode, 1); if (gExposeEnableZslKey) { @@ -11835,6 +11864,9 @@ camera_metadata_t* QCamera3HardwareInterface::translateCapabilityToMetadata(int /* hybrid ae */ settings.update(NEXUS_EXPERIMENTAL_2016_HYBRID_AE_ENABLE, &hybrid_ae, 1); + int32_t fwk_hdr = QCAMERA3_VIDEO_HDR_MODE_OFF; + settings.update(QCAMERA3_VIDEO_HDR_MODE, &fwk_hdr, 1); + mDefaultMetadata[type] = settings.release(); return mDefaultMetadata[type]; @@ -12464,7 +12496,7 @@ int QCamera3HardwareInterface::translateFwkMetadataToHalMetadata( if (fwk_aeMode == ANDROID_CONTROL_AE_MODE_OFF ) { aeMode = CAM_AE_MODE_OFF; - } else if (fwk_aeMode == NEXUS_EXPERIMENTAL_2016_CONTROL_AE_MODE_EXTERNAL_FLASH) { + } else if (fwk_aeMode == ANDROID_CONTROL_AE_MODE_ON_EXTERNAL_FLASH) { aeMode = CAM_AE_MODE_ON_EXTERNAL_FLASH; } else { aeMode = CAM_AE_MODE_ON; @@ -14754,7 +14786,8 @@ int32_t QCamera3HardwareInterface::setInstantAEC(const CameraMetadata &meta) // First try to configure instant AEC from framework metadata if (meta.exists(QCAMERA3_INSTANT_AEC_MODE)) { - val = (uint8_t)meta.find(QCAMERA3_INSTANT_AEC_MODE).data.i32[0]; + val = meta.find(QCAMERA3_INSTANT_AEC_MODE).data.u8[0]; + LOGE("Instant AEC mode set: %d", val); } // If framework did not set this value, try to read from set prop. diff --git a/msm8998/QCamera2/HAL3/QCamera3HWI.h b/msm8998/QCamera2/HAL3/QCamera3HWI.h index f7d8c42..741b58e 100644 --- a/msm8998/QCamera2/HAL3/QCamera3HWI.h +++ b/msm8998/QCamera2/HAL3/QCamera3HWI.h @@ -485,6 +485,7 @@ private: int32_t getReprocessibleOutputStreamId(uint32_t &id); int32_t handleCameraDeviceError(bool stopChannelImmediately = false); + bool isEISEnabled(const CameraMetadata& meta); bool isOnEncoder(const cam_dimension_t max_viewfinder_size, uint32_t width, uint32_t height); void hdrPlusPerfLock(mm_camera_super_buf_t *metadata_buf); @@ -544,6 +545,7 @@ private: metadata_buffer_t* mParameters; metadata_buffer_t* mPrevParameters; CameraMetadata mCurJpegMeta; + cam_is_type_t m_ISTypeVideo; bool m_bIsVideo; bool m_bIs4KVideo; bool m_bEisSupportedSize; diff --git a/msm8998/QCamera2/HAL3/QCamera3VendorTags.cpp b/msm8998/QCamera2/HAL3/QCamera3VendorTags.cpp index 177de19..45902ad 100644 --- a/msm8998/QCamera2/HAL3/QCamera3VendorTags.cpp +++ b/msm8998/QCamera2/HAL3/QCamera3VendorTags.cpp @@ -234,8 +234,8 @@ vendor_tag_info_t qcamera3_awb_speed[QCAMERA3_AWB_CONVERGENCE_SPEED_END - vendor_tag_info_t qcamera3_instant_aec[QCAMERA3_INSTANT_AEC_END - QCAMERA3_INSTANT_AEC_START] = { - { "instant_aec_mode", TYPE_INT32 }, - { "instant_aec_available_modes", TYPE_INT32 } + { "instant_aec_mode", TYPE_BYTE }, + { "instant_aec_available_modes", TYPE_BYTE } }; vendor_tag_info_t nexus_experimental_2016[NEXUS_EXPERIMENTAL_2016_END - |