From 5be19d85932b7efd58885bf4ca1934f52beb32c0 Mon Sep 17 00:00:00 2001 From: Andriy Chepurnyy Date: Fri, 26 Oct 2012 14:02:25 +0300 Subject: CameraHAL: Make graphic buffer locking conditional This mechanism is added to support components where locking mechanism is handled on DOMX layer. As example is using ducati decoder with buffers allocated via ANativeWindowDisplayAdapter. Change-Id: I33ae0f0766473a6d8e85699c31dcad9345b4df70 Signed-off-by: Andriy Chepurnyy --- camera/inc/ANativeWindowDisplayAdapter.h | 7 +++++++ camera/inc/CameraHal.h | 10 ++++++++++ 2 files changed, 17 insertions(+) (limited to 'camera/inc') diff --git a/camera/inc/ANativeWindowDisplayAdapter.h b/camera/inc/ANativeWindowDisplayAdapter.h index 560e98d..eba91bb 100644 --- a/camera/inc/ANativeWindowDisplayAdapter.h +++ b/camera/inc/ANativeWindowDisplayAdapter.h @@ -86,6 +86,9 @@ public: virtual status_t maxQueueableBuffers(unsigned int& queueable); virtual status_t minUndequeueableBuffers(int& unqueueable); + // If set to true ANativeWindowDisplayAdapter will not lock/unlock graphic buffers + void setExternalLocking(bool extBuffLocking); + ///Class specific functions static void frameCallbackRelay(CameraFrame* caFrame); void frameCallback(CameraFrame* caFrame); @@ -173,6 +176,10 @@ private: const char *mPixelFormat; + //In case if we ,as example, using out buffers in Ducati Decoder + //DOMX will handle lock/unlock of graphic buffers + bool mUseExternalBufferLocking; + #if PPM_INSTRUMENTATION || PPM_INSTRUMENTATION_ABS //Used for calculating standby to first shot struct timeval mStandbyToShot; diff --git a/camera/inc/CameraHal.h b/camera/inc/CameraHal.h index a97ae96..e5e6fdf 100644 --- a/camera/inc/CameraHal.h +++ b/camera/inc/CameraHal.h @@ -725,6 +725,7 @@ public: void setVideoRes(int width, int height); void flushEventQueue(); + void setExternalLocking(bool extBuffLocking); //Internal class definitions class NotificationThread : public android::Thread { @@ -760,6 +761,8 @@ private: void copyAndSendPreviewFrame(CameraFrame* frame, int32_t msgType); size_t calculateBufferSize(size_t width, size_t height, const char *pixelFormat); const char* getContstantForPixelFormat(const char *pixelFormat); + void lockBufferAndUpdatePtrs(CameraFrame* frame); + void unlockBufferAndUpdatePtrs(CameraFrame* frame); private: mutable android::Mutex mLock; @@ -815,6 +818,8 @@ private: int mVideoWidth; int mVideoHeight; + bool mExternalLocking; + }; @@ -1242,6 +1247,9 @@ public: status_t storeMetaDataInBuffers(bool enable); + // Use external locking for graphic buffers + void setExternalLocking(bool extBuffLocking); + //@} /*--------------------Internal Member functions - Public---------------------------------*/ @@ -1504,6 +1512,8 @@ private: int mVideoHeight; android::String8 mCapModeBackup; + + bool mExternalLocking; }; } // namespace Camera -- cgit v1.1