diff options
author | Steve Kondik <steve@cyngn.com> | 2016-03-10 18:20:59 -0800 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2016-03-10 18:20:59 -0800 |
commit | 4055f69af3dd0de060e34ae2a063862173e68b1d (patch) | |
tree | c406e69ea5570078fc3e57356a2066798443d224 | |
parent | 0b27895201570937d889c6b1158692c5f917efcd (diff) | |
parent | 8b3ca9d1263fb5870b1d74c9229cd52459551bb7 (diff) | |
download | android_hardware_qcom_camera-stable/cm-13.0-ZNH2KB.tar.gz android_hardware_qcom_camera-stable/cm-13.0-ZNH2KB.tar.bz2 android_hardware_qcom_camera-stable/cm-13.0-ZNH2KB.zip |
Merge tag 'android-6.0.1_r22' of https://android.googlesource.com/platform/hardware/qcom/camera into cm-13.0staging/cm-13.0+r22stable/cm-13.0-ZNH2KBstable/cm-13.0-ZNH2K
Android 6.0.1 release 22
-rw-r--r-- | QCamera2/HAL3/QCamera3HWI.cpp | 17 | ||||
-rw-r--r-- | QCamera2/stack/common/cam_intf.h | 1 | ||||
-rw-r--r-- | QCamera2/stack/common/cam_types.h | 2 | ||||
-rw-r--r-- | QCamera2/stack/mm-camera-interface/src/mm_camera.c | 8 |
4 files changed, 27 insertions, 1 deletions
diff --git a/QCamera2/HAL3/QCamera3HWI.cpp b/QCamera2/HAL3/QCamera3HWI.cpp index b01e9466..58b9d32e 100644 --- a/QCamera2/HAL3/QCamera3HWI.cpp +++ b/QCamera2/HAL3/QCamera3HWI.cpp @@ -403,6 +403,7 @@ QCamera3HardwareInterface::QCamera3HardwareInterface(uint32_t cameraId, QCamera3HardwareInterface::~QCamera3HardwareInterface() { CDBG("%s: E", __func__); + bool hasPendingBuffers = (mPendingBuffersMap.num_buffers > 0); /* Turn off current power hint before acquiring perfLock in case they * conflict with each other */ @@ -473,6 +474,15 @@ QCamera3HardwareInterface::~QCamera3HardwareInterface() /* Clean up all channels */ if (mCameraInitialized) { if(!mFirstConfiguration){ + clear_metadata_buffer(mParameters); + + // Check if there is still pending buffer not yet returned. + if (hasPendingBuffers) { + uint8_t restart = TRUE; + ADD_SET_PARAM_ENTRY_TO_BATCH(mParameters, CAM_INTF_META_DAEMON_RESTART, + restart); + } + //send the last unconfigure cam_stream_size_info_t stream_config_info; memset(&stream_config_info, 0, sizeof(cam_stream_size_info_t)); @@ -481,6 +491,7 @@ QCamera3HardwareInterface::~QCamera3HardwareInterface() m_bIs4KVideo ? 0 : MAX_INFLIGHT_REQUESTS; ADD_SET_PARAM_ENTRY_TO_BATCH(mParameters, CAM_INTF_META_STREAM_INFO, stream_config_info); + int rc = mCameraHandle->ops->set_parms(mCameraHandle->camera_handle, mParameters); if (rc < 0) { ALOGE("%s: set_parms failed for unconfigure", __func__); @@ -515,6 +526,12 @@ QCamera3HardwareInterface::~QCamera3HardwareInterface() pthread_cond_destroy(&mRequestCond); pthread_mutex_destroy(&mMutex); + + if (hasPendingBuffers) { + ALOGE("%s: Not all buffers were returned. Notified the camera daemon process to restart." + " Exiting here...", __func__); + exit(EXIT_FAILURE); + } CDBG("%s: X", __func__); } diff --git a/QCamera2/stack/common/cam_intf.h b/QCamera2/stack/common/cam_intf.h index 678ae263..52682c38 100644 --- a/QCamera2/stack/common/cam_intf.h +++ b/QCamera2/stack/common/cam_intf.h @@ -783,6 +783,7 @@ typedef struct { INCLUDE(CAM_INTF_META_LDAF_EXIF, uint32_t, 2); INCLUDE(CAM_INTF_META_BLACK_LEVEL_SOURCE_PATTERN, cam_black_level_metadata_t, 1); INCLUDE(CAM_INTF_META_BLACK_LEVEL_APPLIED_PATTERN, cam_black_level_metadata_t, 1); + INCLUDE(CAM_INTF_META_DAEMON_RESTART, uint8_t, 1); } metadata_data_t; /* Update clear_metadata_buffer() function when a new is_xxx_valid is added to diff --git a/QCamera2/stack/common/cam_types.h b/QCamera2/stack/common/cam_types.h index f93ab758..2bffc917 100644 --- a/QCamera2/stack/common/cam_types.h +++ b/QCamera2/stack/common/cam_types.h @@ -1774,6 +1774,8 @@ typedef enum { /* Whether EIS is enabled */ CAM_INTF_META_VIDEO_STAB_MODE, + /* Whether HAL has run into DRAIN error */ + CAM_INTF_META_DAEMON_RESTART, CAM_INTF_PARM_MAX } cam_intf_parm_type_t; diff --git a/QCamera2/stack/mm-camera-interface/src/mm_camera.c b/QCamera2/stack/mm-camera-interface/src/mm_camera.c index 0368e7cd..1cf357f6 100644 --- a/QCamera2/stack/mm-camera-interface/src/mm_camera.c +++ b/QCamera2/stack/mm-camera-interface/src/mm_camera.c @@ -290,8 +290,14 @@ int32_t mm_camera_open(mm_camera_obj_t *my_obj) errno = 0; my_obj->ctrl_fd = open(dev_name, O_RDWR | O_NONBLOCK); CDBG("%s: ctrl_fd = %d, errno == %d", __func__, my_obj->ctrl_fd, errno); - if((my_obj->ctrl_fd >= 0) || (errno != EIO && errno != ETIMEDOUT) || (n_try <= 0 )) { + if((my_obj->ctrl_fd >= 0) || + (errno != EIO && errno != ETIMEDOUT && errno != ENODEV) || + (n_try <= 0 )) { CDBG_HIGH("%s: opened, break out while loop", __func__); + if (my_obj->ctrl_fd < 0) { + ALOGE("%s: Failed to open %s: %s(%d).", __func__, dev_name, + strerror(-errno), errno); + } break; } ALOGE("%s:Failed with %s error, retrying after %d milli-seconds", |