diff options
author | Mathias Agopian <mathias@google.com> | 2010-10-01 16:22:41 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2010-10-04 20:10:11 -0700 |
commit | 50817931e4cb4ae0019fd13c831a2839349834c5 (patch) | |
tree | 1492e3966d068becf59073b25ab7c23366dbbdeb | |
parent | a007e8229fb2be4866c483f9cd6c4af238a2da5e (diff) | |
download | frameworks_av-50817931e4cb4ae0019fd13c831a2839349834c5.zip frameworks_av-50817931e4cb4ae0019fd13c831a2839349834c5.tar.gz frameworks_av-50817931e4cb4ae0019fd13c831a2839349834c5.tar.bz2 |
fix [2835280] Add support for cancelling buffers to ANativeWindow
There is a new ANativeWindow::cancelBuffer() API that can be used to
cancel any dequeued buffer, BEFORE it's been enqueued. The buffer is
returned to the list of availlable buffers. dequeue and cancel are not
mutually thread safe, they must be called from the same thread or
external synchronization must be used.
Change-Id: I86cc7985bace8b6a93ad2c75d2bef5c3c2cb4d61
-rw-r--r-- | include/private/surfaceflinger/SharedBufferStack.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/include/private/surfaceflinger/SharedBufferStack.h b/include/private/surfaceflinger/SharedBufferStack.h index d689667..d6ae5e9 100644 --- a/include/private/surfaceflinger/SharedBufferStack.h +++ b/include/private/surfaceflinger/SharedBufferStack.h @@ -114,8 +114,9 @@ public: int32_t identity; // surface's identity (const) int32_t token; // surface's token (for debugging) - int32_t reserved32[1]; Statistics stats; + int8_t headBuf; // last retired buffer + uint8_t reservedBytes[3]; int32_t reserved; BufferData buffers[NUM_BUFFER_MAX]; // 1024 bytes }; @@ -201,6 +202,7 @@ public: status_t undoDequeue(int buf); status_t lock(int buf); + status_t cancel(int buf); status_t queue(int buf); bool needNewBuffer(int buffer) const; status_t setDirtyRegion(int buffer, const Region& reg); @@ -230,8 +232,9 @@ private: inline ssize_t operator()(); }; - struct UndoDequeueUpdate : public UpdateBase { - inline UndoDequeueUpdate(SharedBufferBase* sbb); + struct CancelUpdate : public UpdateBase { + int tail, buf; + inline CancelUpdate(SharedBufferBase* sbb, int tail, int buf); inline ssize_t operator()(); }; @@ -256,7 +259,6 @@ private: int mNumBuffers; int32_t tail; - int32_t undoDequeueTail; int32_t queued_head; // statistics... nsecs_t mDequeueTime[SharedBufferStack::NUM_BUFFER_MAX]; |