summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJamie Gennis <jgennis@google.com>2012-08-24 17:25:13 -0700
committerJamie Gennis <jgennis@google.com>2012-08-29 15:35:34 -0700
commit31a353da225af5329735451c761b430d82dfda1b (patch)
tree8fa7940f99fd7e80f13bcc58840456f48fcd9178 /include
parentc1396dd14506d29e92fc047141d62b3d9246a72d (diff)
downloadframeworks_native-31a353da225af5329735451c761b430d82dfda1b.zip
frameworks_native-31a353da225af5329735451c761b430d82dfda1b.tar.gz
frameworks_native-31a353da225af5329735451c761b430d82dfda1b.tar.bz2
BufferQueue: clean up buffer counting
This change is a clean up of some of the handling of the maximum number of buffers that are allowed at once. It mostly renames a few member variables and methods, but it includes a couple small refactorings. Change-Id: I9959310f563d09583548d4291e1050a7bbc7d87d
Diffstat (limited to 'include')
-rw-r--r--include/gui/BufferQueue.h49
-rw-r--r--include/gui/SurfaceTexture.h8
2 files changed, 30 insertions, 27 deletions
diff --git a/include/gui/BufferQueue.h b/include/gui/BufferQueue.h
index 85d8fb6..20cb69e 100644
--- a/include/gui/BufferQueue.h
+++ b/include/gui/BufferQueue.h
@@ -252,10 +252,10 @@ public:
// requestBuffers when a with and height of zero is requested.
status_t setDefaultBufferSize(uint32_t w, uint32_t h);
- // setBufferCountServer set the buffer count. If the client has requested
+ // setDefaultBufferCount 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.
- status_t setBufferCountServer(int bufferCount);
+ status_t setDefaultMaxBufferCount(int bufferCount);
// isSynchronousMode returns whether the SurfaceTexture is currently in
// synchronous mode.
@@ -298,7 +298,14 @@ private:
// are freed except the current buffer.
status_t drainQueueAndFreeBuffersLocked();
- status_t setBufferCountServerLocked(int bufferCount);
+ // setDefaultMaxBufferCountLocked sets the maximum number of buffer slots
+ // that will be used if the producer does not override the buffer slot
+ // count.
+ status_t setDefaultMaxBufferCountLocked(int count);
+
+ // getMinBufferCountLocked returns the minimum number of buffers allowed
+ // given the current BufferQueue state.
+ int getMinMaxBufferCountLocked() const;
struct BufferSlot {
@@ -426,26 +433,22 @@ private:
// not dequeued at any time
int mMinUndequeuedBuffers;
- // mMinAsyncBufferSlots is a constraint on the minimum mBufferCount
- // when this BufferQueue is in asynchronous mode
- int mMinAsyncBufferSlots;
-
- // mMinSyncBufferSlots is a constraint on the minimum mBufferCount
- // when this BufferQueue is in synchronous mode
- int mMinSyncBufferSlots;
-
- // mBufferCount is the number of buffer slots that the client and server
- // must maintain. It defaults to MIN_ASYNC_BUFFER_SLOTS and can be changed
- // by calling setBufferCount or setBufferCountServer
- int mBufferCount;
-
- // mClientBufferCount is the number of buffer slots requested by the client.
- // The default is zero, which means the client doesn't care how many buffers
- // there is.
- int mClientBufferCount;
-
- // mServerBufferCount buffer count requested by the server-side
- int mServerBufferCount;
+ // mMaxBufferCount is the maximum number of buffers that will be allocated
+ // at once.
+ int mMaxBufferCount;
+
+ // mDefaultMaxBufferCount is the default limit on the number of buffers
+ // that will be allocated at one time. This default limit is set by the
+ // consumer. The limit (as opposed to the default limit) may be
+ // overridden by the producer.
+ int mDefaultMaxBufferCount;
+
+ // mOverrideMaxBufferCount is the limit on the number of buffers that will
+ // be allocated at one time. This value is set by the image producer by
+ // calling setBufferCount. The default is zero, which means the producer
+ // doesn't care about the number of buffers in the pool. In that case
+ // mDefaultMaxBufferCount is used as the limit.
+ int mOverrideMaxBufferCount;
// mGraphicBufferAlloc is the connection to SurfaceFlinger that is used to
// allocate new GraphicBuffer objects.
diff --git a/include/gui/SurfaceTexture.h b/include/gui/SurfaceTexture.h
index 98741c5..2570cd9 100644
--- a/include/gui/SurfaceTexture.h
+++ b/include/gui/SurfaceTexture.h
@@ -87,10 +87,10 @@ public:
// 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.
- status_t setBufferCountServer(int bufferCount);
+ // setDefaultMaxBufferCount sets the default limit on the maximum number
+ // of buffers that will be allocated at one time. The image producer may
+ // override the limit.
+ status_t setDefaultMaxBufferCount(int bufferCount);
// getTransformMatrix retrieves the 4x4 texture coordinate transform matrix
// associated with the texture image set by the most recent call to