diff options
author | Sundar Raman <sunds@ti.com> | 2011-09-15 20:12:08 -0700 |
---|---|---|
committer | Iliyan Malchev <malchev@google.com> | 2011-09-19 22:29:22 -0700 |
commit | c493114006e0e136c8c88c2fc9865994054959bf (patch) | |
tree | 11eb19e31666ed8807cf9ea7207ae43bdf3efde4 | |
parent | 524cc0cda6ed8cb07e0469fc931657ac60335aa1 (diff) | |
download | hardware_ti_omap4xxx-c493114006e0e136c8c88c2fc9865994054959bf.zip hardware_ti_omap4xxx-c493114006e0e136c8c88c2fc9865994054959bf.tar.gz hardware_ti_omap4xxx-c493114006e0e136c8c88c2fc9865994054959bf.tar.bz2 |
CameraHAL: Adds some useful debug logs on frame counts
Change-Id: Ifb1434f9fd1c85f040d67f3df6fb7c4a86e135db
Signed-off-by: Sundar Raman <sunds@ti.com>
-rw-r--r-- | camera/ANativeWindowDisplayAdapter.cpp | 2 | ||||
-rw-r--r-- | camera/BaseCameraAdapter.cpp | 21 | ||||
-rw-r--r-- | camera/OMXCameraAdapter/OMXCameraAdapter.cpp | 40 | ||||
-rw-r--r-- | camera/inc/BaseCameraAdapter.h | 9 |
4 files changed, 70 insertions, 2 deletions
diff --git a/camera/ANativeWindowDisplayAdapter.cpp b/camera/ANativeWindowDisplayAdapter.cpp index 220d637..57c3a86 100644 --- a/camera/ANativeWindowDisplayAdapter.cpp +++ b/camera/ANativeWindowDisplayAdapter.cpp @@ -198,7 +198,7 @@ ANativeWindowDisplayAdapter::~ANativeWindowDisplayAdapter() // Unregister with the frame provider mFrameProvider->disableFrameNotification(CameraFrame::ALL_FRAMES); delete mFrameProvider; - mFrameProvider = NULL; + mFrameProvider = NULL; } ///The ANativeWindow object will get destroyed here diff --git a/camera/BaseCameraAdapter.cpp b/camera/BaseCameraAdapter.cpp index 32084ad..3320b5f 100644 --- a/camera/BaseCameraAdapter.cpp +++ b/camera/BaseCameraAdapter.cpp @@ -239,12 +239,22 @@ void BaseCameraAdapter::returnFrame(void* frameBuf, CameraFrame::FrameType frame refCount = getFrameRefCount(frameBuf, frameType); + if(frameType == CameraFrame::PREVIEW_FRAME_SYNC) + { + mFramesWithDisplay--; + } + else if(frameType == CameraFrame::VIDEO_FRAME_SYNC) + { + mFramesWithEncoder--; + } + if ( 0 < refCount ) { refCount--; setFrameRefCount(frameBuf, frameType, refCount); + if ( ( mRecording ) && ( CameraFrame::VIDEO_FRAME_SYNC == frameType ) ) { refCount += getFrameRefCount(frameBuf, CameraFrame::PREVIEW_FRAME_SYNC); @@ -257,15 +267,26 @@ void BaseCameraAdapter::returnFrame(void* frameBuf, CameraFrame::FrameType frame } else { + CAMHAL_LOGEA("Frame returned when ref count is already zero!!"); return; } } + CAMHAL_LOGVB("REFCOUNT 0x%x %d", frameBuf, refCount); + if ( NO_ERROR == res ) { //check if someone is holding this buffer if ( 0 == refCount ) { +#ifdef DEBUG_LOG + if(mBuffersWithDucati.indexOfKey((int)frameBuf)>=0) + { + LOGE("Buffer already with Ducati!! 0x%x", frameBuf); + for(int i=0;i<mBuffersWithDucati.size();i++) LOGE("0x%x", mBuffersWithDucati.keyAt(i)); + } + mBuffersWithDucati.add((int)frameBuf,1); +#endif res = fillThisBuffer(frameBuf, frameType); } } diff --git a/camera/OMXCameraAdapter/OMXCameraAdapter.cpp b/camera/OMXCameraAdapter/OMXCameraAdapter.cpp index b378a92..3282072 100644 --- a/camera/OMXCameraAdapter/OMXCameraAdapter.cpp +++ b/camera/OMXCameraAdapter/OMXCameraAdapter.cpp @@ -31,6 +31,8 @@ #include <cutils/properties.h> #define UNLIKELY( exp ) (__builtin_expect( (exp) != 0, false )) static int mDebugFps = 0; +static int mDebugFcs = 0; + #define HERE(Msg) {CAMHAL_LOGEB("--===line %d, %s===--\n", __LINE__, Msg);} @@ -54,6 +56,8 @@ status_t OMXCameraAdapter::initialize(CameraProperties::Properties* caps, int se char value[PROPERTY_VALUE_MAX]; property_get("debug.camera.showfps", value, "0"); mDebugFps = atoi(value); + property_get("debug.camera.framecounts", value, "0"); + mDebugFcs = atoi(value); TIMM_OSAL_ERRORTYPE osalError = OMX_ErrorNone; OMX_ERRORTYPE eError = OMX_ErrorNone; @@ -441,6 +445,7 @@ status_t OMXCameraAdapter::fillThisBuffer(void* frameBuf, CameraFrame::FrameType CAMHAL_LOGDB("OMX_FillThisBuffer 0x%x", eError); ret = ErrorUtils::omxToAndroidError(eError); } + mFramesWithDucati++; break; } } @@ -1827,6 +1832,10 @@ status_t OMXCameraAdapter::startPreview() { CAMHAL_LOGEB("OMX_FillThisBuffer-0x%x", eError); } + mFramesWithDucati++; +#ifdef DEGUG_LOG + mBuffersWithDucati.add((uint32_t)mPreviewData->mBufferHeader[index]->pBuffer,1); +#endif GOTO_EXIT_IF((eError!=OMX_ErrorNone), eError); } @@ -2012,6 +2021,9 @@ status_t OMXCameraAdapter::stopPreview() mFirstTimeInit = true; + mFramesWithDucati = 0; + mFramesWithDisplay = 0; + mFramesWithEncoder = 0; LOG_FUNCTION_NAME_EXIT; @@ -2864,7 +2876,7 @@ OMX_ERRORTYPE OMXCameraAdapter::OMXCameraAdapterFillBufferDone(OMX_IN OMX_HANDLE } } - LOGV("FBD pBuffer = 0x%x", pBuffHeader->pBuffer); + //LOGV("FBD pBuffer = 0x%x", pBuffHeader->pBuffer); if( mWaitingForSnapshot ) { @@ -2877,7 +2889,27 @@ OMX_ERRORTYPE OMXCameraAdapter::OMXCameraAdapterFillBufferDone(OMX_IN OMX_HANDLE } } + if ( mRecording ) + { + mFramesWithEncoder++; + } + stat = sendCallBacks(cameraFrame, pBuffHeader, mask, pPortParam); + mFramesWithDisplay++; + + mFramesWithDucati--; + +#ifdef DEBUG_LOG + if(mBuffersWithDucati.indexOfKey((int)pBuffHeader->pBuffer)<0) + { + LOGE("Buffer was never with Ducati!! 0x%x", pBuffHeader->pBuffer); + for(int i=0;i<mBuffersWithDucati.size();i++) LOGE("0x%x", mBuffersWithDucati.keyAt(i)); + } + mBuffersWithDucati.removeItem((int)pBuffHeader->pBuffer); +#endif + + if(mDebugFcs) + CAMHAL_LOGEB("C[%d] D[%d] E[%d]", mFramesWithDucati, mFramesWithDisplay, mFramesWithEncoder); } else if( pBuffHeader->nOutputPortIndex == OMX_CAMERA_PORT_VIDEO_OUT_MEASUREMENT ) @@ -3079,6 +3111,8 @@ status_t OMXCameraAdapter::sendCallBacks(CameraFrame frame, OMX_IN OMX_BUFFERHEA ret = sendFrameToSubscribers(&frame); } + CAMHAL_LOGVB("B 0x%x T %llu", frame.mBuffer, pBuffHeader->nTimeStamp); + LOG_FUNCTION_NAME_EXIT; return ret; @@ -3242,6 +3276,10 @@ OMXCameraAdapter::OMXCameraAdapter():mComponentState (OMX_StateLoaded) mUserSetExpLock = OMX_FALSE; mUserSetWbLock = OMX_FALSE; + mFramesWithDucati = 0; + mFramesWithDisplay = 0; + mFramesWithEncoder = 0; + LOG_FUNCTION_NAME_EXIT; } diff --git a/camera/inc/BaseCameraAdapter.h b/camera/inc/BaseCameraAdapter.h index 5a014b5..ebfa44d 100644 --- a/camera/inc/BaseCameraAdapter.h +++ b/camera/inc/BaseCameraAdapter.h @@ -245,6 +245,15 @@ protected: void *mReleaseData; void *mEndCaptureData; bool mRecording; + + uint32_t mFramesWithDucati; + uint32_t mFramesWithDisplay; + uint32_t mFramesWithEncoder; + +#ifdef DEBUG_LOG + KeyedVector<int, bool> mBuffersWithDucati; +#endif + }; }; |