summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMansoor Aftab <maftab@codeaurora.org>2013-09-04 15:56:22 -0700
committerAli B <abittin@gmail.com>2018-06-17 19:19:51 +0300
commitd94ae51c27467ccaaca61b70365f7be24438aa5f (patch)
tree8dfb24d90a7e0250a005124bcc2158b6dc8b2cfd
parent4b20c606bba620bb780ca483c1b0841d8ed5eb0c (diff)
Camera3: Fix rapid ZSL snapshots
-In case of rapid back to back snapshots framework reuses ZSL YUV frame -Remove code in HAL which assumes that once a buffer is passed as input it will not be used again Change-Id: I72a0f527de99b96508c7020455a47bfe754d9df4 Signed-off-by: Daniel Jarai <jaraidaniel@gmail.com>
-rwxr-xr-xcamera/QCamera2/HAL3/QCamera3Channel.cpp30
-rwxr-xr-xcamera/QCamera2/HAL3/QCamera3Channel.h7
-rwxr-xr-xcamera/QCamera2/HAL3/QCamera3HWI.cpp8
3 files changed, 27 insertions, 18 deletions
diff --git a/camera/QCamera2/HAL3/QCamera3Channel.cpp b/camera/QCamera2/HAL3/QCamera3Channel.cpp
index c15ae12..5912eb7 100755
--- a/camera/QCamera2/HAL3/QCamera3Channel.cpp
+++ b/camera/QCamera2/HAL3/QCamera3Channel.cpp
@@ -846,6 +846,15 @@ void QCamera3PicChannel::jpegEvtHandle(jpeg_job_status_t status,
int maxJpegSize;
QCamera3PicChannel *obj = (QCamera3PicChannel *)userdata;
if (obj) {
+
+ //Release any cached metabuffer information
+ if (obj->mMetaFrame != NULL && obj->m_pMetaChannel != NULL) {
+ ((QCamera3MetadataChannel*)(obj->m_pMetaChannel))->bufDone(obj->mMetaFrame);
+ obj->mMetaFrame = NULL;
+ obj->m_pMetaChannel = NULL;
+ } else {
+ ALOGE("%s: Meta frame was NULL", __func__);
+ }
//Construct payload for process_capture_result. Call mChannelCb
qcamera_jpeg_data_t *job = obj->m_postprocessor.findJpegJobByJobId(jobId);
@@ -917,7 +926,8 @@ QCamera3PicChannel::QCamera3PicChannel(uint32_t cam_handle,
mJpegSettings(NULL),
mCurrentBufIndex(-1),
mMemory(NULL),
- mYuvMemory(NULL)
+ mYuvMemory(NULL),
+ mMetaFrame(NULL)
{
int32_t rc = m_postprocessor.init(jpegEvtHandle, this);
if (rc != 0) {
@@ -1276,8 +1286,13 @@ int QCamera3PicChannel::getJpegRotation() {
return rotation;
}
-void QCamera3PicChannel::queueMetadata(mm_camera_super_buf_t *metadata_buf)
+void QCamera3PicChannel::queueMetadata(mm_camera_super_buf_t *metadata_buf,
+ QCamera3Channel *pMetaChannel,
+ bool relinquish)
{
+ if(relinquish)
+ mMetaFrame = metadata_buf;
+ m_pMetaChannel = pMetaChannel;
m_postprocessor.processPPMetadata(metadata_buf);
}
/*===========================================================================
@@ -1859,7 +1874,6 @@ QCamera3ReprocessChannel::QCamera3ReprocessChannel(uint32_t cam_handle,
picChHandle(ch_hdl),
m_pSrcChannel(NULL),
m_pMetaChannel(NULL),
- m_metaFrame(NULL),
mMemory(NULL)
{
memset(mSrcStreamHandles, 0, sizeof(mSrcStreamHandles));
@@ -1941,12 +1955,6 @@ void QCamera3ReprocessChannel::streamCbRoutine(mm_camera_super_buf_t *super_fram
return;
}
*frame = *super_frame;
- //queue back the metadata buffer
- if (m_metaFrame != NULL) {
- metadataBufDone(m_metaFrame);
- } else {
- ALOGE("%s: Meta frame was NULL", __func__);
- }
obj->m_postprocessor.processPPData(frame);
return;
}
@@ -1962,8 +1970,7 @@ void QCamera3ReprocessChannel::streamCbRoutine(mm_camera_super_buf_t *super_fram
*==========================================================================*/
QCamera3ReprocessChannel::QCamera3ReprocessChannel() :
m_pSrcChannel(NULL),
- m_pMetaChannel(NULL),
- m_metaFrame(NULL)
+ m_pMetaChannel(NULL)
{
}
@@ -2107,7 +2114,6 @@ int32_t QCamera3ReprocessChannel::doReprocess(mm_camera_super_buf_t *frame,
ALOGE("%s: No source channel for reprocess", __func__);
return -1;
}
- m_metaFrame = meta_frame;
for (int i = 0; i < frame->num_bufs; i++) {
QCamera3Stream *pStream = getStreamBySourceHandle(frame->bufs[i]->stream_id);
if (pStream != NULL) {
diff --git a/camera/QCamera2/HAL3/QCamera3Channel.h b/camera/QCamera2/HAL3/QCamera3Channel.h
index c128f7f..e06534b 100755
--- a/camera/QCamera2/HAL3/QCamera3Channel.h
+++ b/camera/QCamera2/HAL3/QCamera3Channel.h
@@ -230,7 +230,9 @@ public:
void *userdata);
static void dataNotifyCB(mm_camera_super_buf_t *recvd_frame,
void *userdata);
- void queueMetadata(mm_camera_super_buf_t *metadata_buf);
+ void queueMetadata(mm_camera_super_buf_t *metadata_buf,
+ QCamera3Channel *pMetaChannel,
+ bool relinquish);
public:
static int kMaxBuffers;
@@ -246,6 +248,8 @@ private:
QCamera3GrallocMemory *mMemory;
QCamera3HeapMemory *mYuvMemory;
+ QCamera3Channel *m_pMetaChannel;
+ mm_camera_super_buf_t *mMetaFrame;
};
// reprocess channel class
@@ -284,7 +288,6 @@ private:
uint32_t mSrcStreamHandles[MAX_STREAM_NUM_IN_BUNDLE];
QCamera3Channel *m_pSrcChannel; // ptr to source channel for reprocess
QCamera3Channel *m_pMetaChannel;
- mm_camera_super_buf_t *m_metaFrame;
QCamera3HeapMemory *mMemory;
};
diff --git a/camera/QCamera2/HAL3/QCamera3HWI.cpp b/camera/QCamera2/HAL3/QCamera3HWI.cpp
index 30e8407..f2ebdec 100755
--- a/camera/QCamera2/HAL3/QCamera3HWI.cpp
+++ b/camera/QCamera2/HAL3/QCamera3HWI.cpp
@@ -965,12 +965,12 @@ int QCamera3HardwareInterface::processCaptureRequest(
ALOGD("Stream id: %d", pInputBuffer->stream_id);
ALOGD("streamtype:%d", pInputBuffer->stream_type);
ALOGD("frame len:%d", pInputBuffer->frame_len);
+ ALOGD("Handle:%p", request->input_buffer->buffer);
//TODO: need to get corresponding metadata and send it to pproc
for (List<MetadataBufferInfo>::iterator m = mStoredMetadataList.begin();
m != mStoredMetadataList.end(); m++) {
if (m->zsl_buf_hdl == request->input_buffer->buffer) {
reproc_meta.meta_buf = m->meta_buf;
- m = mStoredMetadataList.erase(m);
queueMetadata = 1;
break;
}
@@ -980,7 +980,7 @@ int QCamera3HardwareInterface::processCaptureRequest(
rc = channel->request(output.buffer, frameNumber, mJpegSettings,
pInputBuffer,(QCamera3Channel*)inputChannel);
if (queueMetadata) {
- mPictureChannel->queueMetadata(reproc_meta.meta_buf);
+ mPictureChannel->queueMetadata(reproc_meta.meta_buf,mMetadataChannel,false);
}
} else {
ALOGV("%s: %d, request with buffer %p, frame_number %d", __func__,
@@ -1190,7 +1190,7 @@ void QCamera3HardwareInterface::captureResultCb(mm_camera_super_buf_t *metadata_
j != i->buffers.end(); j++){
if (j->stream->stream_type == CAMERA3_STREAM_OUTPUT &&
j->stream->format == HAL_PIXEL_FORMAT_BLOB) {
- mPictureChannel->queueMetadata(metadata_buf);
+ mPictureChannel->queueMetadata(metadata_buf,mMetadataChannel,true);
break;
}
}
@@ -1202,7 +1202,7 @@ void QCamera3HardwareInterface::captureResultCb(mm_camera_super_buf_t *metadata_
}
} else if (!mIsZslMode && i->blob_request) {
//If it is a blob request then send the metadata to the picture channel
- mPictureChannel->queueMetadata(metadata_buf);
+ mPictureChannel->queueMetadata(metadata_buf,mMetadataChannel,true);
} else {
// Return metadata buffer
mMetadataChannel->bufDone(metadata_buf);