summaryrefslogtreecommitdiffstats
path: root/camera
diff options
context:
space:
mode:
authorVladimir Petrov <vppetrov@mm-sol.com>2012-08-16 19:13:03 +0300
committerDaniel Levin <dendy@ti.com>2012-11-26 20:03:35 +0200
commita063d9e6286f64d26d8e6c34aea5ff2233b9e1d9 (patch)
treed38ad52ce900cf8b746bf6410cb1032ac6d6e52b /camera
parent9253857803b9db620ae8a007dbc48e2251b84b89 (diff)
downloadhardware_ti_omap4-a063d9e6286f64d26d8e6c34aea5ff2233b9e1d9.zip
hardware_ti_omap4-a063d9e6286f64d26d8e6c34aea5ff2233b9e1d9.tar.gz
hardware_ti_omap4-a063d9e6286f64d26d8e6c34aea5ff2233b9e1d9.tar.bz2
CameraHal: Add support to release tap in/outs
- Providing a way to camera client to tell camera hardware that tap in/outs previously set are not longer valid. Depends on frameworks/av change I68f61303: http://review.omapzoom.org/#/c/28914/ Depends on hardware/libhardware change I8f6c377a: http://review.omapzoom.org/#/c/28984/ Change-Id: I9e7faf1a8cb9bd4e9f3bfd98ed4ccc56c1e9b10e Signed-off-by: Vladimir Petrov <vppetrov@mm-sol.com>
Diffstat (limited to 'camera')
-rw-r--r--camera/CameraHal.cpp156
-rw-r--r--camera/CameraHal_Module.cpp20
-rw-r--r--camera/inc/CameraHal.h7
3 files changed, 180 insertions, 3 deletions
diff --git a/camera/CameraHal.cpp b/camera/CameraHal.cpp
index be7b870..c37f57b 100644
--- a/camera/CameraHal.cpp
+++ b/camera/CameraHal.cpp
@@ -2126,7 +2126,6 @@ status_t CameraHal::setTapoutLocked(struct preview_stream_ops *tapout)
}
// Set tapout point
- // destroy current buffer tapout if NULL tapout is passed
// 1. Check name of tap-out
// 2. If not already set, then create a new one
// 3. Allocate buffers. If user is re-setting the surface, free buffers first and re-allocate
@@ -2173,7 +2172,60 @@ status_t CameraHal::setTapoutLocked(struct preview_stream_ops *tapout)
mOutAdapters.add(out);
}
- exit:
+exit:
+
+ LOG_FUNCTION_NAME_EXIT;
+
+ return ret;
+}
+
+/**
+ @brief Releases Tapout Surfaces.
+
+ @param[in] window The ANativeWindow object created by Surface flinger
+ @return NO_ERROR If the ANativeWindow object passes validation criteria
+ @todo Define validation criteria for ANativeWindow object. Define error codes for scenarios
+
+ */
+status_t CameraHal::releaseTapoutLocked(struct preview_stream_ops *tapout)
+{
+ status_t ret = NO_ERROR;
+ char id[OP_STR_SIZE];
+
+ LOG_FUNCTION_NAME;
+
+ if (!tapout) {
+ CAMHAL_LOGD("Missing argument");
+ LOG_FUNCTION_NAME_EXIT;
+ return NO_ERROR;
+ }
+
+ // Get the name of tapout
+ ret = mExtendedPreviewStreamOps->get_id(tapout, id, sizeof(id));
+ if (NO_ERROR != ret) {
+ CAMHAL_LOGEB("get_id OPS returned error %d", ret);
+ return ret;
+ }
+
+ // 1. Check name of tap-out
+ // 2. If exist, then free buffers and then remove it
+ if (mBufferSourceAdapter_Out.get() && mBufferSourceAdapter_Out->match(id)) {
+ CAMHAL_LOGD("REMOVE tap out %p previously set as current", tapout);
+ mBufferSourceAdapter_Out.clear();
+ }
+ for (unsigned int i = 0; i < mOutAdapters.size(); i++) {
+ android::sp<DisplayAdapter> out;
+ out = mOutAdapters.itemAt(i);
+ if (out->match(id)) {
+ CAMHAL_LOGD("REMOVE tap out %p \"%s\" at position %d", tapout, id, i);
+ out->freeBufferList(out->getBuffers());
+ mOutAdapters.removeAt(i);
+ break;
+ }
+ }
+
+ LOG_FUNCTION_NAME_EXIT;
+
return ret;
}
@@ -2247,7 +2299,61 @@ status_t CameraHal::setTapinLocked(struct preview_stream_ops *tapin)
mInAdapters.add(in);
}
- exit:
+exit:
+
+ LOG_FUNCTION_NAME_EXIT;
+
+ return ret;
+}
+
+
+/**
+ @brief Releases Tapin Surfaces.
+
+ @param[in] window The ANativeWindow object created by Surface flinger
+ @return NO_ERROR If the ANativeWindow object passes validation criteria
+ @todo Define validation criteria for ANativeWindow object. Define error codes for scenarios
+
+ */
+status_t CameraHal::releaseTapinLocked(struct preview_stream_ops *tapin)
+{
+ status_t ret = NO_ERROR;
+ char id[OP_STR_SIZE];
+
+ LOG_FUNCTION_NAME;
+
+ if (!tapin) {
+ CAMHAL_LOGD("Missing argument");
+ LOG_FUNCTION_NAME_EXIT;
+ return NO_ERROR;
+ }
+
+ // Get the name of tapin
+ ret = mExtendedPreviewStreamOps->get_id(tapin, id, sizeof(id));
+ if (NO_ERROR != ret) {
+ CAMHAL_LOGEB("get_id OPS returned error %d", ret);
+ return ret;
+ }
+
+ // 1. Check name of tap-in
+ // 2. If exist, then free buffers and then remove it
+ if (mBufferSourceAdapter_In.get() && mBufferSourceAdapter_In->match(id)) {
+ CAMHAL_LOGD("REMOVE tap in %p previously set as current", tapin);
+ mBufferSourceAdapter_In.clear();
+ }
+ for (unsigned int i = 0; i < mInAdapters.size(); i++) {
+ android::sp<DisplayAdapter> in;
+ in = mInAdapters.itemAt(i);
+ if (in->match(id)) {
+ CAMHAL_LOGD("REMOVE tap in %p \"%s\" at position %d", tapin, id, i);
+ in->freeBufferList(in->getBuffers());
+ mInAdapters.removeAt(i);
+ break;
+ }
+ }
+
+ LOG_FUNCTION_NAME_EXIT;
+
return ret;
}
@@ -2294,6 +2400,50 @@ exit:
return ret;
}
+
+
+/**
+ @brief Releases ANativeWindow object.
+
+ Release Buffers previously released with setBufferSource()
+
+ TODO(XXX): this is just going to use preview_stream_ops for now, but we
+ most likely need to extend it when we want more functionality
+
+ @param[in] window The ANativeWindow object created by Surface flinger
+ @return NO_ERROR If the ANativeWindow object passes validation criteria
+ @todo Define validation criteria for ANativeWindow object. Define error codes for scenarios
+
+ */
+status_t CameraHal::releaseBufferSource(struct preview_stream_ops *tapin, struct preview_stream_ops *tapout)
+{
+ status_t ret = NO_ERROR;
+ int index = -1;
+
+ LOG_FUNCTION_NAME;
+
+ android::AutoMutex lock(mLock);
+ CAMHAL_LOGD ("releaseBufferSource(%p, %p)", tapin, tapout);
+ if (tapout) {
+ ret |= releaseTapoutLocked(tapout);
+ if (ret != NO_ERROR) {
+ CAMHAL_LOGE("Error %d to release tap out", ret);
+ }
+ }
+
+ if (tapin) {
+ ret |= releaseTapinLocked(tapin);
+ if (ret != NO_ERROR) {
+ CAMHAL_LOGE("Error %d to release tap in", ret);
+ }
+ }
+
+exit:
+
+ LOG_FUNCTION_NAME_EXIT;
+
+ return ret;
+}
#endif
diff --git a/camera/CameraHal_Module.cpp b/camera/CameraHal_Module.cpp
index 313c7fc..a9277a2 100644
--- a/camera/CameraHal_Module.cpp
+++ b/camera/CameraHal_Module.cpp
@@ -140,6 +140,25 @@ int camera_set_buffer_source(struct camera_device * device,
return rv;
}
+
+int camera_release_buffer_source(struct camera_device * device,
+ struct preview_stream_ops *tapin,
+ struct preview_stream_ops *tapout)
+{
+ CAMHAL_LOG_MODULE_FUNCTION_NAME;
+
+ int rv = -EINVAL;
+ ti_camera_device_t* ti_dev = NULL;
+
+ if(!device)
+ return rv;
+
+ ti_dev = (ti_camera_device_t*) device;
+
+ rv = gCameraHals[ti_dev->cameraid]->releaseBufferSource(tapin, tapout);
+
+ return rv;
+}
#endif
void camera_set_callbacks(struct camera_device * device,
@@ -513,6 +532,7 @@ int camera_send_command(struct camera_device * device,
#ifdef OMAP_ENHANCEMENT_CPCAM
ops->set_extended_preview_ops = camera_set_extended_preview_ops;
ops->set_buffer_source = camera_set_buffer_source;
+ ops->release_buffer_source = camera_release_buffer_source;
ops->take_picture_with_parameters = camera_take_picture_with_parameters;
ops->reprocess = camera_reprocess;
ops->cancel_reprocess = camera_cancel_reprocess;
diff --git a/camera/inc/CameraHal.h b/camera/inc/CameraHal.h
index fb36ee6..19505aa 100644
--- a/camera/inc/CameraHal.h
+++ b/camera/inc/CameraHal.h
@@ -1131,6 +1131,11 @@ public:
#endif
/**
+ * Release a tap-in or tap-out point.
+ */
+ int releaseBufferSource(struct preview_stream_ops *tapin, struct preview_stream_ops *tapout);
+
+ /**
* Stop a previously started preview.
*/
void stopPreview();
@@ -1358,7 +1363,9 @@ private:
//@}
status_t setTapoutLocked(struct preview_stream_ops *out);
+ status_t releaseTapoutLocked(struct preview_stream_ops *out);
status_t setTapinLocked(struct preview_stream_ops *in);
+ status_t releaseTapinLocked(struct preview_stream_ops *in);
/*----------Member variables - Public ---------------------*/
public:
int32_t mMsgEnabled;