diff options
Diffstat (limited to 'include/gui')
-rw-r--r-- | include/gui/BufferQueue.h | 8 | ||||
-rw-r--r-- | include/gui/SurfaceTexture.h | 15 |
2 files changed, 22 insertions, 1 deletions
diff --git a/include/gui/BufferQueue.h b/include/gui/BufferQueue.h index 04a2f52..6db2c87 100644 --- a/include/gui/BufferQueue.h +++ b/include/gui/BufferQueue.h @@ -23,6 +23,7 @@ #include <gui/IGraphicBufferAlloc.h> #include <gui/ISurfaceTexture.h> +#include <ui/Fence.h> #include <ui/GraphicBuffer.h> #include <utils/String8.h> @@ -218,7 +219,8 @@ public: // // Note that the dependencies on EGL will be removed once we switch to using // the Android HW Sync HAL. - status_t releaseBuffer(int buf, EGLDisplay display, EGLSyncKHR fence); + status_t releaseBuffer(int buf, EGLDisplay display, EGLSyncKHR fence, + const sp<Fence>& releaseFence = Fence::NO_FENCE); // consumerConnect connects a consumer to the BufferQueue. Only one // consumer may be connected, and when that consumer disconnects the @@ -378,6 +380,10 @@ private: // on a compile-time option) set to a new sync object in updateTexImage. EGLSyncKHR mFence; + // mReleaseFence is a fence which must signal before the contents of + // the buffer associated with this buffer slot may be overwritten. + sp<Fence> mReleaseFence; + // Indicates whether this buffer has been seen by a consumer yet bool mAcquireCalled; diff --git a/include/gui/SurfaceTexture.h b/include/gui/SurfaceTexture.h index 2635e2f..622724e 100644 --- a/include/gui/SurfaceTexture.h +++ b/include/gui/SurfaceTexture.h @@ -91,6 +91,14 @@ public: // target texture belongs is bound to the calling thread. status_t updateTexImage(); + // setReleaseFence stores a fence file descriptor that will signal when the + // current buffer is no longer being read. This fence will be returned to + // the producer when the current buffer is released by updateTexImage(). + // Multiple fences can be set for a given buffer; they will be merged into + // a single union fence. The SurfaceTexture will close the file descriptor + // when finished with it. + void setReleaseFence(int fenceFd); + // setBufferCountServer set the buffer count. If the client has requested // a buffer count using setBufferCount, the server-buffer count will // take effect once the client sets the count back to zero. @@ -349,6 +357,13 @@ private: // to EGL_NO_SYNC_KHR when the buffer is created and (optionally, based // on a compile-time option) set to a new sync object in updateTexImage. EGLSyncKHR mFence; + + // mReleaseFence is a fence which will signal when the buffer + // associated with this buffer slot is no longer being used by the + // consumer and can be overwritten. The buffer can be dequeued before + // the fence signals; the producer is responsible for delaying writes + // until it signals. + sp<Fence> mReleaseFence; }; // mEglDisplay is the EGLDisplay with which this SurfaceTexture is currently |