aboutsummaryrefslogtreecommitdiff
path: root/camera/QCamera2/HAL/QCameraMem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'camera/QCamera2/HAL/QCameraMem.cpp')
-rwxr-xr-xcamera/QCamera2/HAL/QCameraMem.cpp29
1 files changed, 15 insertions, 14 deletions
diff --git a/camera/QCamera2/HAL/QCameraMem.cpp b/camera/QCamera2/HAL/QCameraMem.cpp
index f4c239a..2502cf3 100755
--- a/camera/QCamera2/HAL/QCameraMem.cpp
+++ b/camera/QCamera2/HAL/QCameraMem.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -1050,11 +1050,13 @@ int QCameraMetadataStreamMemory::getRegFlags(uint8_t *regFlags) const
* RETURN : none
*==========================================================================*/
QCameraStreamMemory::QCameraStreamMemory(camera_request_memory memory,
+ void* cbCookie,
bool cached,
QCameraMemoryPool *pool,
cam_stream_type_t streamType, __unused cam_stream_buf_type bufType)
:QCameraMemory(cached, pool, streamType),
- mGetMemory(memory)
+ mGetMemory(memory),
+ mCallbackCookie(cbCookie)
{
for (int i = 0; i < MM_CAMERA_MAX_NUM_FRAMES; i ++)
mCameraMemory[i] = NULL;
@@ -1100,7 +1102,7 @@ int QCameraStreamMemory::allocate(uint8_t count, size_t size, uint32_t isSecure)
if (isSecure == SECURE) {
mCameraMemory[i] = 0;
} else {
- mCameraMemory[i] = mGetMemory(mMemInfo[i].fd, mMemInfo[i].size, 1, this);
+ mCameraMemory[i] = mGetMemory(mMemInfo[i].fd, mMemInfo[i].size, 1, mCallbackCookie);
}
}
mBufferCount = count;
@@ -1132,7 +1134,7 @@ int QCameraStreamMemory::allocateMore(uint8_t count, size_t size)
}
for (int i = mBufferCount; i < mBufferCount + count; i++) {
- mCameraMemory[i] = mGetMemory(mMemInfo[i].fd, mMemInfo[i].size, 1, this);
+ mCameraMemory[i] = mGetMemory(mMemInfo[i].fd, mMemInfo[i].size, 1, mCallbackCookie);
}
mBufferCount = (uint8_t)(mBufferCount + count);
ATRACE_END();
@@ -1280,9 +1282,9 @@ void *QCameraStreamMemory::getPtr(uint32_t index) const
*
* RETURN : none
*==========================================================================*/
-QCameraVideoMemory::QCameraVideoMemory(camera_request_memory memory,
+QCameraVideoMemory::QCameraVideoMemory(camera_request_memory memory, void* cbCookie,
bool cached, QCameraMemType bufType)
- : QCameraStreamMemory(memory, cached)
+ : QCameraStreamMemory(memory, cbCookie, cached)
{
memset(mMetadata, 0, sizeof(mMetadata));
memset(mNativeHandle, 0, sizeof(mNativeHandle));
@@ -1385,7 +1387,7 @@ int QCameraVideoMemory::allocateMore(uint8_t count, size_t size)
if (!(mBufType & QCAMERA_MEM_TYPE_BATCH)) {
for (int i = mBufferCount; i < count + mBufferCount; i ++) {
mMetadata[i] = mGetMemory(-1,
- sizeof(media_metadata_buffer), 1, this);
+ sizeof(media_metadata_buffer), 1, mCallbackCookie);
if (!mMetadata[i]) {
LOGE("allocation of video metadata failed.");
for (int j = mBufferCount; j <= i-1; j ++) {
@@ -1447,7 +1449,7 @@ int QCameraVideoMemory::allocateMeta(uint8_t buf_cnt, int numFDs, int numInts)
for (int i = 0; i < buf_cnt; i++) {
mMetadata[i] = mGetMemory(-1,
- sizeof(media_metadata_buffer), 1, this);
+ sizeof(media_metadata_buffer), 1, mCallbackCookie);
if (!mMetadata[i]) {
LOGE("allocation of video metadata failed.");
for (int j = (i - 1); j >= 0; j--) {
@@ -1709,11 +1711,9 @@ int QCameraVideoMemory::convCamtoOMXFormat(cam_format_t format)
case CAM_FORMAT_YUV_420_NV12_VENUS:
omxFormat = OMX_COLOR_FormatYUV420SemiPlanar;
break;
-#ifndef VANILLA_HAL
case CAM_FORMAT_YUV_420_NV12_UBWC:
omxFormat = QOMX_COLOR_FORMATYUV420PackedSemiPlanar32mCompressed;
break;
-#endif
default:
omxFormat = OMX_COLOR_FormatYUV420SemiPlanar;
}
@@ -1731,7 +1731,7 @@ int QCameraVideoMemory::convCamtoOMXFormat(cam_format_t format)
*
* RETURN : none
*==========================================================================*/
-QCameraGrallocMemory::QCameraGrallocMemory(camera_request_memory memory)
+QCameraGrallocMemory::QCameraGrallocMemory(camera_request_memory memory, void* cbCookie)
: QCameraMemory(true), mColorSpace(ITU_R_601_FR)
{
mMinUndequeuedBuffers = 0;
@@ -1739,6 +1739,7 @@ QCameraGrallocMemory::QCameraGrallocMemory(camera_request_memory memory)
mWindow = NULL;
mWidth = mHeight = mStride = mScanline = mUsage = 0;
mFormat = HAL_PIXEL_FORMAT_YCrCb_420_SP;
+ mCallbackCookie = cbCookie;
mGetMemory = memory;
for (int i = 0; i < MM_CAMERA_MAX_NUM_FRAMES; i ++) {
mBufferHandle[i] = NULL;
@@ -1889,7 +1890,7 @@ int QCameraGrallocMemory::displayBuffer(uint32_t index)
mGetMemory(mPrivateHandle[dequeuedIdx]->fd,
(size_t)mPrivateHandle[dequeuedIdx]->size,
1,
- (void *)this);
+ mCallbackCookie);
LOGH("idx = %d, fd = %d, size = %d, offset = %d",
dequeuedIdx, mPrivateHandle[dequeuedIdx]->fd,
mPrivateHandle[dequeuedIdx]->size,
@@ -2010,7 +2011,7 @@ int32_t QCameraGrallocMemory::dequeueBuffer()
mGetMemory(mPrivateHandle[dequeuedIdx]->fd,
(size_t)mPrivateHandle[dequeuedIdx]->size,
1,
- (void *)this);
+ mCallbackCookie);
LOGH("idx = %d, fd = %d, size = %d, offset = %d",
dequeuedIdx, mPrivateHandle[dequeuedIdx]->fd,
mPrivateHandle[dequeuedIdx]->size,
@@ -2201,7 +2202,7 @@ int QCameraGrallocMemory::allocate(uint8_t count, size_t /*size*/,
mGetMemory(mPrivateHandle[cnt]->fd,
(size_t)mPrivateHandle[cnt]->size,
1,
- (void *)this);
+ mCallbackCookie);
LOGH("idx = %d, fd = %d, size = %d, offset = %d",
cnt, mPrivateHandle[cnt]->fd,
mPrivateHandle[cnt]->size,