summaryrefslogtreecommitdiffstats
path: root/libcamera/SecCamera.cpp
diff options
context:
space:
mode:
authorMike J. Chen <mjchen@sta.samsung.com>2010-10-26 15:16:00 -0700
committerMaarten Hooft <mthooft@google.com>2010-10-28 19:14:14 -0700
commit802890e7ab775d71f9ff11a1b259778cd6b90917 (patch)
tree21a103dca5932c65f470a8625837ed29f17dbe1f /libcamera/SecCamera.cpp
parent256aeac7371b52c1914fac874e4d2f303068ed93 (diff)
downloaddevice_samsung_crespo-802890e7ab775d71f9ff11a1b259778cd6b90917.zip
device_samsung_crespo-802890e7ab775d71f9ff11a1b259778cd6b90917.tar.gz
device_samsung_crespo-802890e7ab775d71f9ff11a1b259778cd6b90917.tar.bz2
S5PC11X: libcamera: threading and error cleanup
Cleanup the way the camera HAL manages its threads so that the exit path should no longer fail in a race condition. The destructor waits for all threads to exit and heaps are destroyed before closing the fd to driver. Remove deadlock case (a HAL interface should not call a callback, because the callback would try to grab a lock that is already being held). Removed mutex usage that wasn't needed (CameraServices already has a mutex). Add checks that could mess up the state of the sensor driver (setting parameters or starting preview when a capture was still in progress). We return errors in these cases instead. Change-Id: I30d832de582a002dad1c087bd7cc7de43237eb19 Signed-off-by: Mike J. Chen <mjchen@sta.samsung.com>
Diffstat (limited to 'libcamera/SecCamera.cpp')
-rw-r--r--libcamera/SecCamera.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/libcamera/SecCamera.cpp b/libcamera/SecCamera.cpp
index 4a6959b..2aa9eec 100644
--- a/libcamera/SecCamera.cpp
+++ b/libcamera/SecCamera.cpp
@@ -186,14 +186,17 @@ static int fimc_poll(struct pollfd *events)
{
int ret;
- ret = poll(events, 1, 5000);
+ /* 10 second delay is because sensor can take a long time
+ * to do auto focus and capture in dark settings
+ */
+ ret = poll(events, 1, 10000);
if (ret < 0) {
LOGE("ERR(%s):poll error\n", __func__);
return ret;
}
if (ret == 0) {
- LOGE("ERR(%s):No data in 5 secs..\n", __func__);
+ LOGE("ERR(%s):No data in 10 secs..\n", __func__);
return ret;
}
@@ -382,7 +385,7 @@ static int fimc_v4l2_enum_fmt(int fp, unsigned int fmt)
while (ioctl(fp, VIDIOC_ENUM_FMT, &fmtdesc) == 0) {
if (fmtdesc.pixelformat == fmt) {
- LOGD("passed fmt = %d found pixel format[%d]: %s\n", fmt, fmtdesc.index, fmtdesc.description);
+ LOGV("passed fmt = %#x found pixel format[%d]: %s\n", fmt, fmtdesc.index, fmtdesc.description);
found = 1;
break;
}
@@ -881,7 +884,6 @@ void SecCamera::DeinitCamera()
}
m_flag_init = 0;
- usleep(500000); //500 ms delay to allow proper closure of fimc device.
}
}
@@ -971,12 +973,12 @@ int SecCamera::startPreview(void)
CHECK(ret);
} else { // In case VGA camera
/* Brightness setting */
- LOGE("m_params->brightness = %d", m_params->brightness);
+ LOGV("m_params->brightness = %d", m_params->brightness);
ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_BRIGHTNESS,
m_params->brightness);
CHECK(ret);
/* Blur setting */
- LOGE("m_blur_level = %d", m_blur_level);
+ LOGV("m_blur_level = %d", m_blur_level);
ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_VGA_BLUR,
m_blur_level);
CHECK(ret);
@@ -988,7 +990,7 @@ int SecCamera::startPreview(void)
CHECK(ret);
#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
- LOGE("%s: get the first frame of the preview\n", __func__);
+ LOGV("%s: get the first frame of the preview\n", __func__);
#endif /* SWP1_CAMERA_ADD_ADVANCED_FUNCTION */
#ifndef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
@@ -1010,7 +1012,7 @@ int SecCamera::stopPreview(void)
close_buffers(m_buffers_c);
if (m_flag_camera_start == 0) {
- LOGE("%s: m_flag_camera_start is zero", __func__);
+ LOGV("%s: doing nothing because m_flag_camera_start is zero", __func__);
return 0;
}