diff options
| author | 2017-04-04 00:33:14 +0000 | |
|---|---|---|
| committer | 2017-04-04 00:33:15 +0000 | |
| commit | 0860434b11f60cfa8fa0f46f58e69f6ae3ed1d0b (patch) | |
| tree | 6efda88db04f93c5c1076c26325512d728e37892 /include/gui/Surface.h | |
| parent | f60ab4119e64c642f519ef7994482e72bd11f0cb (diff) | |
| parent | e572fd7b6262389e89cc23d9eb25129394698eb8 (diff) | |
Merge "Surface: add getRemovedBuffer API" into oc-dev
Diffstat (limited to 'include/gui/Surface.h')
| -rw-r--r-- | include/gui/Surface.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/gui/Surface.h b/include/gui/Surface.h index 62f6cadece..88ef010368 100644 --- a/include/gui/Surface.h +++ b/include/gui/Surface.h @@ -257,10 +257,25 @@ public: virtual int query(int what, int* value) const; virtual int connect(int api, const sp<IProducerListener>& listener); + + // When reportBufferRemoval is true, clients must call getAndFlushRemovedBuffers to fetch + // GraphicBuffers removed from this surface after a dequeueBuffer, detachNextBuffer or + // attachBuffer call. This allows clients with their own buffer caches to free up buffers no + // longer in use by this surface. + virtual int connect( + int api, const sp<IProducerListener>& listener, + bool reportBufferRemoval); virtual int detachNextBuffer(sp<GraphicBuffer>* outBuffer, sp<Fence>* outFence); virtual int attachBuffer(ANativeWindowBuffer*); + // When client connects to Surface with reportBufferRemoval set to true, any buffers removed + // from this Surface will be collected and returned here. Once this method returns, these + // buffers will no longer be referenced by this Surface unless they are attached to this + // Surface later. The list of removed buffers will only be stored until the next dequeueBuffer, + // detachNextBuffer, or attachBuffer call. + status_t getAndFlushRemovedBuffers(std::vector<sp<GraphicBuffer>>* out); + protected: enum { NUM_BUFFER_SLOTS = BufferQueueDefs::NUM_BUFFER_SLOTS }; enum { DEFAULT_FORMAT = PIXEL_FORMAT_RGBA_8888 }; @@ -414,6 +429,9 @@ protected: // A cached copy of the FrameEventHistory maintained by the consumer. bool mEnableFrameTimestamps = false; std::unique_ptr<ProducerFrameEventHistory> mFrameEventHistory; + + bool mReportRemovedBuffers = false; + std::vector<sp<GraphicBuffer>> mRemovedBuffers; }; } // namespace android |