From 1be2fcd4f02495f48b5fdfde80eb5b1a2674f964 Mon Sep 17 00:00:00 2001 From: Saurabh Shah Date: Thu, 16 Aug 2012 10:19:07 -0700 Subject: [PATCH] hwc: qbuf: Add API to unlock all Add API to unlock all current and previous buffers. This is essential in suspend cases. CRs-fixed: 382332 (cherry picked from commit d24eb9e70480f89561108078f68cbbd9b20e4bb5) Change-Id: I54fcded7cabc79d991d4b28a248867d860ec6b08 --- libhwcomposer/hwc.cpp | 2 +- libhwcomposer/hwc_qbuf.h | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp index 4779a96..e6750be 100644 --- a/libhwcomposer/hwc.cpp +++ b/libhwcomposer/hwc.cpp @@ -180,7 +180,7 @@ static int hwc_set(hwc_composer_device_t *dev, ctx->mExtDisplay->commit(); } else { ctx->mOverlay->setState(ovutils::OV_CLOSED); - ctx->qbuf->unlockAllPrevious(); + ctx->qbuf->unlockAll(); } if(!ctx->overlayInUse) diff --git a/libhwcomposer/hwc_qbuf.h b/libhwcomposer/hwc_qbuf.h index 6d75964..0e639cf 100644 --- a/libhwcomposer/hwc_qbuf.h +++ b/libhwcomposer/hwc_qbuf.h @@ -33,7 +33,10 @@ class QueuedBufferStore { } ~QueuedBufferStore() {} void lockAndAdd(private_handle_t*); + //Unlocks only previous and makes the current as previous void unlockAllPrevious(); + //Unlocks previous as well as current, useful in suspend case + void unlockAll(); private: QueuedBufferStore& operator=(const QueuedBufferStore&); @@ -70,6 +73,13 @@ inline void QueuedBufferStore::unlockAllPrevious() { clearCurrent(); } +inline void QueuedBufferStore::unlockAll() { + //Unlocks prev and moves current to prev + unlockAllPrevious(); + //Unlocks the newly populated prev if any. + unlockAllPrevious(); +} + //Clear currentbuf store inline void QueuedBufferStore::clearCurrent() { for(int i = 0; i < MAX_QUEUED_BUFS; i++)