diff options
author | Jamie Gennis <jgennis@google.com> | 2011-06-26 18:27:47 -0700 |
---|---|---|
committer | Jamie Gennis <jgennis@google.com> | 2011-06-27 15:45:39 -0700 |
commit | 3d8063b02e06020c8062addcc9ec49048d3bdb9a (patch) | |
tree | 88acd74f76083e3d9b49bcac724cf60bd43ebfaa /include/gui | |
parent | 0c4b1e994c3507598e157e67b243d5be00d6cf4f (diff) | |
download | frameworks_native-3d8063b02e06020c8062addcc9ec49048d3bdb9a.zip frameworks_native-3d8063b02e06020c8062addcc9ec49048d3bdb9a.tar.gz frameworks_native-3d8063b02e06020c8062addcc9ec49048d3bdb9a.tar.bz2 |
SurfaceTexture: change onFrameAvailable behavior
This change alters the conditions under which the onFrameAvailable
callback gets called by the C++ SurfaceTexture class. The new behavior
is to call the callback whenever a frame gets queued that will be
visible to the buffer consumer. This means that buffers queued in
synchronous mode always trigger the callback, as those buffers will
remain pending until they are consumed. Buffers queued in asynchronous
mode will only trigger the callback if there was not previously an
unconsumed buffer pending.
The new behavior means that a consumer should perform a draw operation
exactly once for every onFrameAvailable call that it recieves. This
change also modifies SurfaceFlinger and the SurfaceTexture JNI to
support of the new behavior.
Change-Id: I8b2c6e00961d3d58b11c6af50b555b6e4c5f5b40
Diffstat (limited to 'include/gui')
-rw-r--r-- | include/gui/SurfaceTexture.h | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/include/gui/SurfaceTexture.h b/include/gui/SurfaceTexture.h index e558dfd..c82fb9b 100644 --- a/include/gui/SurfaceTexture.h +++ b/include/gui/SurfaceTexture.h @@ -46,11 +46,14 @@ public: enum { NUM_BUFFER_SLOTS = 32 }; struct FrameAvailableListener : public virtual RefBase { - // onFrameAvailable() is called from queueBuffer() is the FIFO is - // empty. You can use SurfaceTexture::getQueuedCount() to - // figure out if there are more frames waiting. - // This is called without any lock held can be called concurrently by - // multiple threads. + // onFrameAvailable() is called from queueBuffer() each time an + // additional frame becomes available for consumption. This means that + // frames that are queued while in asynchronous mode only trigger the + // callback if no previous frames are pending. Frames queued while in + // synchronous mode always trigger the callback. + // + // This is called without any lock held and can be called concurrently + // by multiple threads. virtual void onFrameAvailable() = 0; }; @@ -101,11 +104,6 @@ public: // target texture belongs is bound to the calling thread. status_t updateTexImage(); - // getqueuedCount returns the number of queued frames waiting in the - // FIFO. In asynchronous mode, this always returns 0 or 1 since - // frames are not accumulating in the FIFO. - size_t getQueuedCount() const; - // 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. |