summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTyler Luu <tluu@ti.com>2012-06-14 20:01:31 -0500
committerDaniel Levin <dendy@ti.com>2012-11-26 18:22:46 +0200
commit22a5f9c6b795c8bd284c5598fa60f940e10f123a (patch)
treea61fc60754d62256339d9070884642753ab3b4f4
parenta57cfd9088378087009e4047b86f562065f62d85 (diff)
downloadhardware_ti_omap4-22a5f9c6b795c8bd284c5598fa60f940e10f123a.zip
hardware_ti_omap4-22a5f9c6b795c8bd284c5598fa60f940e10f123a.tar.gz
hardware_ti_omap4-22a5f9c6b795c8bd284c5598fa60f940e10f123a.tar.bz2
camera: omx: Use common MemoryManager
Use a common MemoryManager instance in the various OMXCameraAdapter modules that use it. Change-Id: I5a2e957345dafb3ccbd305b8e589ed1822a289fe Signed-off-by: Tyler Luu <tluu@ti.com> Signed-off-by: Vladimir Petrov <vppetrov@mm-sol.com>
-rw-r--r--camera/OMXCameraAdapter/OMX3A.cpp13
-rw-r--r--camera/OMXCameraAdapter/OMXCameraAdapter.cpp6
-rw-r--r--camera/OMXCameraAdapter/OMXExif.cpp11
-rw-r--r--camera/OMXCameraAdapter/OMXFocus.cpp11
-rw-r--r--camera/inc/OMXCameraAdapter/OMXCameraAdapter.h2
5 files changed, 15 insertions, 28 deletions
diff --git a/camera/OMXCameraAdapter/OMX3A.cpp b/camera/OMXCameraAdapter/OMX3A.cpp
index 9f87e87..8192034 100644
--- a/camera/OMXCameraAdapter/OMX3A.cpp
+++ b/camera/OMXCameraAdapter/OMX3A.cpp
@@ -1609,18 +1609,11 @@ status_t OMXCameraAdapter::setMeteringAreas(Gen3A_settings& Gen3A)
CameraBuffer *bufferlist;
OMX_ALGOAREASTYPE *meteringAreas;
OMX_TI_CONFIG_SHAREDBUFFER sharedBuffer;
- MemoryManager memMgr;
int areasSize = 0;
LOG_FUNCTION_NAME
- ret = memMgr.initialize();
- if ( ret != OK ) {
- CAMHAL_LOGE("MemoryManager initialization failed, error: %d", ret);
- return ret;
- }
-
- android::AutoMutex lock(mMeteringAreasLock);
+ android::AutoMutex lock(mMeteringAreasLock);
if ( OMX_StateInvalid == mComponentState )
{
@@ -1629,7 +1622,7 @@ status_t OMXCameraAdapter::setMeteringAreas(Gen3A_settings& Gen3A)
}
areasSize = ((sizeof(OMX_ALGOAREASTYPE)+4095)/4096)*4096;
- bufferlist = memMgr.allocateBufferList(0, 0, NULL, areasSize, 1);
+ bufferlist = mMemMgr.allocateBufferList(0, 0, NULL, areasSize, 1);
meteringAreas = (OMX_ALGOAREASTYPE *)bufferlist[0].opaque;
OMXCameraPortParameters * mPreviewData = NULL;
@@ -1714,7 +1707,7 @@ status_t OMXCameraAdapter::setMeteringAreas(Gen3A_settings& Gen3A)
EXIT:
if (NULL != bufferlist)
{
- memMgr.freeBufferList(bufferlist);
+ mMemMgr.freeBufferList(bufferlist);
}
return ret;
diff --git a/camera/OMXCameraAdapter/OMXCameraAdapter.cpp b/camera/OMXCameraAdapter/OMXCameraAdapter.cpp
index df8a205..3d17072 100644
--- a/camera/OMXCameraAdapter/OMXCameraAdapter.cpp
+++ b/camera/OMXCameraAdapter/OMXCameraAdapter.cpp
@@ -82,6 +82,12 @@ status_t OMXCameraAdapter::initialize(CameraProperties::Properties* caps)
mPendingCaptureSettings = 0;
mPendingPreviewSettings = 0;
+ ret = mMemMgr.initialize();
+ if ( ret != OK ) {
+ CAMHAL_LOGE("MemoryManager initialization failed, error: %d", ret);
+ return ret;
+ }
+
if ( 0 != mInitSem.Count() )
{
CAMHAL_LOGEB("Error mInitSem semaphore count %d", mInitSem.Count());
diff --git a/camera/OMXCameraAdapter/OMXExif.cpp b/camera/OMXCameraAdapter/OMXExif.cpp
index cbf7c1c..b4fde5a 100644
--- a/camera/OMXCameraAdapter/OMXExif.cpp
+++ b/camera/OMXCameraAdapter/OMXExif.cpp
@@ -237,18 +237,11 @@ status_t OMXCameraAdapter::setupEXIF()
struct timeval sTv;
struct tm *pTime;
OMXCameraPortParameters * capData = NULL;
- MemoryManager memMgr;
CameraBuffer *memmgr_buf_array;
int buf_size = 0;
LOG_FUNCTION_NAME;
- ret = memMgr.initialize();
- if ( ret != OK ) {
- CAMHAL_LOGE("MemoryManager initialization failed, error: %d", ret);
- return ret;
- }
-
sharedBuffer.pSharedBuff = NULL;
capData = &mCameraAdapterParameters.mCameraPortParams[mCameraAdapterParameters.mImagePortIndex];
@@ -276,7 +269,7 @@ status_t OMXCameraAdapter::setupEXIF()
buf_size = ((buf_size+4095)/4096)*4096;
sharedBuffer.nSharedBuffSize = buf_size;
- memmgr_buf_array = memMgr.allocateBufferList(0, 0, NULL, buf_size, 1);
+ memmgr_buf_array = mMemMgr.allocateBufferList(0, 0, NULL, buf_size, 1);
sharedBuffer.pSharedBuff = (OMX_U8*)camera_buffer_get_omx_ptr(&memmgr_buf_array[0]);
startPtr = ( OMX_U8 * ) memmgr_buf_array[0].opaque;
@@ -505,7 +498,7 @@ status_t OMXCameraAdapter::setupEXIF()
if ( NULL != memmgr_buf_array )
{
- memMgr.freeBufferList(memmgr_buf_array);
+ mMemMgr.freeBufferList(memmgr_buf_array);
}
LOG_FUNCTION_NAME_EXIT;
diff --git a/camera/OMXCameraAdapter/OMXFocus.cpp b/camera/OMXCameraAdapter/OMXFocus.cpp
index bfa19ca..386fff3 100644
--- a/camera/OMXCameraAdapter/OMXFocus.cpp
+++ b/camera/OMXCameraAdapter/OMXFocus.cpp
@@ -714,18 +714,11 @@ status_t OMXCameraAdapter::setTouchFocus()
OMX_ALGOAREASTYPE *focusAreas;
OMX_TI_CONFIG_SHAREDBUFFER sharedBuffer;
- MemoryManager memMgr;
CameraBuffer *bufferlist;
int areasSize = 0;
LOG_FUNCTION_NAME;
- ret = memMgr.initialize();
- if ( ret != OK ) {
- CAMHAL_LOGE("MemoryManager initialization failed, error: %d", ret);
- return ret;
- }
-
if ( OMX_StateInvalid == mComponentState )
{
CAMHAL_LOGEA("OMX component is in invalid state");
@@ -736,7 +729,7 @@ status_t OMXCameraAdapter::setTouchFocus()
{
areasSize = ((sizeof(OMX_ALGOAREASTYPE)+4095)/4096)*4096;
- bufferlist = memMgr.allocateBufferList(0, 0, NULL, areasSize, 1);
+ bufferlist = mMemMgr.allocateBufferList(0, 0, NULL, areasSize, 1);
focusAreas = (OMX_ALGOAREASTYPE*) bufferlist[0].opaque;
OMXCameraPortParameters * mPreviewData = NULL;
@@ -822,7 +815,7 @@ status_t OMXCameraAdapter::setTouchFocus()
EXIT:
if (NULL != bufferlist)
{
- memMgr.freeBufferList (bufferlist);
+ mMemMgr.freeBufferList (bufferlist);
}
}
diff --git a/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h b/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h
index d14ff54..8c4ea7f 100644
--- a/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h
+++ b/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h
@@ -1200,6 +1200,8 @@ private:
bool mTunnelDestroyed;
+ // Used for allocations that need to be sent to Ducati
+ MemoryManager mMemMgr;
};
} // namespace Camera