merge in nyc-mr1-release history after reset to nyc-mr1-dev
diff --git a/ISV/base/isv_worker.cpp b/ISV/base/isv_worker.cpp
index 3f699a5..9cddd1c 100644
--- a/ISV/base/isv_worker.cpp
+++ b/ISV/base/isv_worker.cpp
@@ -244,6 +244,19 @@
vaExtBuf.offsets[2] = vaExtBuf.offsets[1] + (stride / 2) * (*height / 2);
vaExtBuf.offsets[3] = 0;
break;
+ case HAL_PIXEL_FORMAT_INTEL_YV12:
+ vaExtBuf.pixel_format = VA_FOURCC_YV12;
+ vaExtBuf.num_planes = 3;
+ vaExtBuf.pitches[0] = stride;
+ vaExtBuf.pitches[1] = stride / 2;
+ vaExtBuf.pitches[2] = stride / 2;
+ vaExtBuf.pitches[3] = 0;
+ vaExtBuf.offsets[0] = 0;
+ // The height of HAL_PIXEL_FORMAT_INTEL_YV12 gralloc buffer has been aligned with 32 pixels.
+ vaExtBuf.offsets[1] = stride * ((*height + 31) & ~31);
+ vaExtBuf.offsets[2] = vaExtBuf.offsets[1] + (stride / 2) * (((*height + 31) & ~31) / 2);
+ vaExtBuf.offsets[3] = 0;
+ break;
#ifdef TARGET_VPP_USE_GEN
case HAL_PIXEL_FORMAT_NV12_Y_TILED_INTEL:
case HAL_PIXEL_FORMAT_NV12_X_TILED_INTEL:
diff --git a/ISV/include/isv_omxcomponent.h b/ISV/include/isv_omxcomponent.h
index 1e8d13e..bba2a32 100644
--- a/ISV/include/isv_omxcomponent.h
+++ b/ISV/include/isv_omxcomponent.h
@@ -274,6 +274,11 @@
int32_t mNumISVBuffers;
int32_t mNumDecoderBuffers;
int32_t mNumDecoderBuffersBak;
+ /* To speed up the start up output decoder buffer directly
+ * for certain frames. ISV worker pipeline set up is hide by (in parallel with)
+ * display these output frames.
+ */
+ int32_t mOutputDecoderBufferNum;
uint32_t mWidth;
uint32_t mHeight;
uint32_t mUseAndroidNativeBufferIndex;
@@ -297,6 +302,7 @@
// protect create mProcThread instance
bool mOwnProcessor;
static pthread_mutex_t ProcThreadInstanceLock;
+ Mutex mDecoderBufLock;
};
#endif // #define ISV_OMXCOMPONENT_H_
diff --git a/ISV/omx/isv_omxcomponent.cpp b/ISV/omx/isv_omxcomponent.cpp
index 7b2c755..1f87deb 100644
--- a/ISV/omx/isv_omxcomponent.cpp
+++ b/ISV/omx/isv_omxcomponent.cpp
@@ -30,6 +30,9 @@
#undef LOG_TAG
#define LOG_TAG "isv-omxil"
+#define OUTPUT_STARTUP_DEC_BUF_NUM (38)
+#define FLUSH_WIDTH 352
+#define FLUSH_HEIGHT 288
using namespace android;
@@ -66,6 +69,7 @@
mNumISVBuffers(MIN_ISV_BUFFER_NUM),
mNumDecoderBuffers(0),
mNumDecoderBuffersBak(0),
+ mOutputDecoderBufferNum(0),
mWidth(0),
mHeight(0),
mUseAndroidNativeBufferIndex(0),
@@ -265,7 +269,8 @@
//FIXME: THIS IS A HACK!! Request NV12 buffer for YV12 format
//because VSP only support NV12 output
OMX_VIDEO_PORTDEFINITIONTYPE *video_def = &def->format.video;
- if (video_def->eColorFormat == VA_FOURCC_YV12) {
+ if ((video_def->eColorFormat == VA_FOURCC_YV12) ||
+ (video_def->eColorFormat == HAL_PIXEL_FORMAT_INTEL_YV12)) {
//FIXME workaround Disable ISV for YV12 input
mVPPEnabled = false;
ALOGI("%s: Disable ISV for YV12 input. mVPPEnabled %d", __func__, mVPPEnabled);
@@ -342,6 +347,7 @@
if (def->nPortIndex == kPortIndexOutput) {
//set the buffer count we should fill to decoder before feed buffer to VPP
mNumDecoderBuffersBak = mNumDecoderBuffers = def->nBufferCountActual - MIN_OUTPUT_NUM - UNDEQUEUED_NUM;
+ mOutputDecoderBufferNum = 0;
OMX_VIDEO_PORTDEFINITIONTYPE *video_def = &def->format.video;
//FIXME: init itself here
@@ -662,6 +668,7 @@
}
if (mNumDecoderBuffers > 0) {
+ Mutex::Autolock autoLock(mDecoderBufLock);
mNumDecoderBuffers--;
ALOGD_IF(ISV_COMPONENT_DEBUG, "%s: fill pBuffer %p to the decoder, decoder still need extra %d buffers", __func__,
pBuffer, mNumDecoderBuffers);
@@ -715,6 +722,17 @@
mOutputCropChanged = false;
}
+ if ((mWidth > FLUSH_WIDTH) && (mHeight > FLUSH_HEIGHT) &&
+ (pBuffer->nFilledLen != 0) && (mOutputDecoderBufferNum < OUTPUT_STARTUP_DEC_BUF_NUM)) {
+ Mutex::Autolock autoLock(mDecoderBufLock);
+ // take one buffer from decoder loop here. Fill one buffer to the loop by mNumDecoderBuffers++
+ mNumDecoderBuffers++;
+ mOutputDecoderBufferNum++;
+ ALOGD_IF(ISV_COMPONENT_DEBUG, "%s: return %d decoder output Buffer, mNumDecoderBuffers get %d input buffer",
+ __func__, mOutputDecoderBufferNum, mNumDecoderBuffers);
+ return mpCallBacks->FillBufferDone(&mBaseComponent, pAppData, pBuffer);
+ }
+
mProcThread->addInput(pBuffer);
return OMX_ErrorNone;
@@ -765,6 +783,7 @@
mProcThread->waitFlushFinished();
mVPPFlushing = false;
mNumDecoderBuffers = mNumDecoderBuffersBak;
+ mOutputDecoderBufferNum = 0;
}
break;
}
@@ -783,6 +802,9 @@
ALOGD_IF(ISV_COMPONENT_DEBUG, "%s: output crop changed", __func__);
mOutputCropChanged = true;
return OMX_ErrorNone;
+ } else if (nData1 == kPortIndexOutput && nData2 == OMX_IndexParamPortDefinition) {
+ ALOGI("%s: output format changed. ISV flush buffers", __func__);
+ mProcThread->notifyFlush();
}
break;
}