summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2013-07-18 15:55:03 -0700
committerMathias Agopian <mathias@google.com>2013-07-18 22:28:18 -0700
commita3fbda3cef04d51a35a3eb64b2f744a989800856 (patch)
tree6291dcc9a67f5c140c14dea94190e51d1ab9b125 /include
parent595264f1af12e25dce57d7c5b1d52ed86ac0d0c9 (diff)
downloadframeworks_native-a3fbda3cef04d51a35a3eb64b2f744a989800856.zip
frameworks_native-a3fbda3cef04d51a35a3eb64b2f744a989800856.tar.gz
frameworks_native-a3fbda3cef04d51a35a3eb64b2f744a989800856.tar.bz2
BuffferQueue disconnect is now always asynchrnous
we tag queued buffers with the "bufferqueue cannot block" flag and use that bit to discard a buffer in the queue by new ones comming in. this allows us to remove the buffer queue drain in disconnect while maintaining the right behaviour if it gets connected again (since each buffer remembers how it was enqueued). Change-Id: I1e703d363a687b70b19ba49cef32213116e8bd3f
Diffstat (limited to 'include')
-rw-r--r--include/gui/BufferQueue.h36
1 files changed, 15 insertions, 21 deletions
diff --git a/include/gui/BufferQueue.h b/include/gui/BufferQueue.h
index f02e25f..b968287 100644
--- a/include/gui/BufferQueue.h
+++ b/include/gui/BufferQueue.h
@@ -223,13 +223,13 @@ public:
// public facing structure for BufferSlot
struct BufferItem {
- BufferItem()
- :
+ BufferItem() :
mTransform(0),
mScalingMode(NATIVE_WINDOW_SCALING_MODE_FREEZE),
mTimestamp(0),
mFrameNumber(0),
mBuf(INVALID_BUFFER_SLOT),
+ mDequeueBufferCannotBlock(false),
mAcquireCalled(false) {
mCrop.makeInvalid();
}
@@ -260,6 +260,13 @@ public:
// mFence is a fence that will signal when the buffer is idle.
sp<Fence> mFence;
+ // mDequeueBufferCannotBlock whether this buffer was queued with the
+ // property that it can be replaced by a new buffer for the purpose of
+ // making sure dequeueBuffer() won't block.
+ // i.e.: was the BufferQueue in "mDequeueBufferCannotBlock" when this buffer
+ // was queued.
+ bool mDequeueBufferCannotBlock;
+
// Indicates whether this buffer has been seen by a consumer yet
bool mAcquireCalled;
};
@@ -366,17 +373,6 @@ private:
// all slots.
void freeAllBuffersLocked();
- // drainQueueLocked waits for the buffer queue to empty if we're in
- // synchronous mode, or returns immediately otherwise. It returns NO_INIT
- // if the BufferQueue is abandoned (consumer disconnected) or disconnected
- // (producer disconnected) during the call.
- status_t drainQueueLocked();
-
- // drainQueueAndFreeBuffersLocked drains the buffer queue if we're in
- // synchronous mode and free all buffers. In asynchronous mode, all buffers
- // are freed except the currently queued buffer (if it exists).
- status_t drainQueueAndFreeBuffersLocked();
-
// setDefaultMaxBufferCountLocked sets the maximum number of buffer slots
// that will be used if the producer does not override the buffer slot
// count. The count must be between 2 and NUM_BUFFER_SLOTS, inclusive.
@@ -387,15 +383,11 @@ private:
// given the current BufferQueue state.
int getMinMaxBufferCountLocked() const;
- // getMinUndequeuedBufferCountLocked returns the minimum number of buffers
- // that must remain in a state other than DEQUEUED.
- int getMinUndequeuedBufferCountLocked() const;
-
// getMaxBufferCountLocked returns the maximum number of buffers that can
// be allocated at once. This value depends upon the following member
// variables:
//
- // mSynchronousMode
+ // mDequeueBufferCannotBlock
// mMaxAcquiredBufferCount
// mDefaultMaxBufferCount
// mOverrideMaxBufferCount
@@ -524,6 +516,11 @@ private:
// in dequeueBuffer() if a width and height of zero is specified.
uint32_t mDefaultHeight;
+ // mMinUndequeuedBufferCount holds the minimum number of buffers
+ // that must remain in a state other than DEQUEUED.
+ // This value cannot change while connected.
+ int mMinUndequeuedBufferCount;
+
// mMaxAcquiredBufferCount is the number of buffers that the consumer may
// acquire at one time. It defaults to 1 and can be changed by the
// consumer via the setMaxAcquiredBufferCount method, but this may only be
@@ -564,9 +561,6 @@ private:
// by the application.
bool mDequeueBufferCannotBlock;
- // mSynchronousMode whether we're in synchronous mode or not
- bool mSynchronousMode;
-
// mConnectedApi indicates the producer API that is currently connected
// to this BufferQueue. It defaults to NO_CONNECTED_API (= 0), and gets
// updated by the connect and disconnect methods.