BQ: get rid of async in producer interface
- Get rid of the async flag in dequeueBuffer, allocateBuffers,
waitForFreeSlotThenRelock, and QueueBufferInput.
- Instead use the persistent flags mDequeueBufferCannotBlock and
mAsyncMode to determine whether to use the async behavior.
Bug 13174928
Change-Id: Ie6f7b9e46ee3844ee77b102003c84dddf1bcafdd
diff --git a/include/gui/BufferQueueCore.h b/include/gui/BufferQueueCore.h
index e824124..36cd238 100644
--- a/include/gui/BufferQueueCore.h
+++ b/include/gui/BufferQueueCore.h
@@ -85,25 +85,25 @@
// getMinUndequeuedBufferCountLocked returns the minimum number of buffers
// that must remain in a state other than DEQUEUED. The async parameter
// tells whether we're in asynchronous mode.
- int getMinUndequeuedBufferCountLocked(bool async) const;
+ int getMinUndequeuedBufferCountLocked() const;
// getMinMaxBufferCountLocked returns the minimum number of buffers allowed
// given the current BufferQueue state. The async parameter tells whether
// we're in asynchonous mode.
- int getMinMaxBufferCountLocked(bool async) const;
+ int getMinMaxBufferCountLocked() const;
// getMaxBufferCountLocked returns the maximum number of buffers that can be
// allocated at once. This value depends on the following member variables:
//
- // mDequeueBufferCannotBlock
+ // mMaxDequeuedBufferCount
// mMaxAcquiredBufferCount
- // mDefaultMaxBufferCount
- // mOverrideMaxBufferCount
- // async parameter
+ // mMaxBufferCount
+ // mAsyncMode
+ // mDequeueBufferCannotBlock
//
// Any time one of these member variables is changed while a producer is
// connected, mDequeueCondition must be broadcast.
- int getMaxBufferCountLocked(bool async) const;
+ int getMaxBufferCountLocked() const;
// freeBufferLocked frees the GraphicBuffer and sync resources for the
// given slot.
diff --git a/include/gui/BufferQueueProducer.h b/include/gui/BufferQueueProducer.h
index 267c50f..6e16a60 100644
--- a/include/gui/BufferQueueProducer.h
+++ b/include/gui/BufferQueueProducer.h
@@ -81,7 +81,7 @@
// In both cases, the producer will need to call requestBuffer to get a
// GraphicBuffer handle for the returned slot.
virtual status_t dequeueBuffer(int *outSlot, sp<Fence>* outFence,
- bool async, uint32_t width, uint32_t height, PixelFormat format,
+ uint32_t width, uint32_t height, PixelFormat format,
uint32_t usage);
// See IGraphicBufferProducer::detachBuffer
@@ -158,7 +158,7 @@
virtual status_t setSidebandStream(const sp<NativeHandle>& stream);
// See IGraphicBufferProducer::allocateBuffers
- virtual void allocateBuffers(bool async, uint32_t width, uint32_t height,
+ virtual void allocateBuffers(uint32_t width, uint32_t height,
PixelFormat format, uint32_t usage);
// See IGraphicBufferProducer::allowAllocation
@@ -179,8 +179,8 @@
// mode (producer and consumer controlled by the application). If it blocks,
// it will release mCore->mMutex while blocked so that other operations on
// the BufferQueue may succeed.
- status_t waitForFreeSlotThenRelock(const char* caller, bool async,
- int* found, status_t* returnFlags) const;
+ status_t waitForFreeSlotThenRelock(const char* caller, int* found,
+ status_t* returnFlags) const;
sp<BufferQueueCore> mCore;
diff --git a/include/gui/IGraphicBufferProducer.h b/include/gui/IGraphicBufferProducer.h
index 6885eb0..be1874a 100644
--- a/include/gui/IGraphicBufferProducer.h
+++ b/include/gui/IGraphicBufferProducer.h
@@ -147,9 +147,6 @@
// fence signals. If the fence is Fence::NO_FENCE, the buffer may be written
// immediately.
//
- // The async parameter sets whether we're in asynchronous mode for this
- // dequeueBuffer() call.
- //
// The width and height parameters must be no greater than the minimum of
// GL_MAX_VIEWPORT_DIMS and GL_MAX_TEXTURE_SIZE (see: glGetIntegerv).
// An error due to invalid dimensions might not be reported until
@@ -187,8 +184,8 @@
//
// All other negative values are an unknown error returned downstream
// from the graphics allocator (typically errno).
- virtual status_t dequeueBuffer(int* slot, sp<Fence>* fence, bool async,
- uint32_t w, uint32_t h, PixelFormat format, uint32_t usage) = 0;
+ virtual status_t dequeueBuffer(int* slot, sp<Fence>* fence, uint32_t w,
+ uint32_t h, PixelFormat format, uint32_t usage) = 0;
// detachBuffer attempts to remove all ownership of the buffer in the given
// slot from the buffer queue. If this call succeeds, the slot will be
@@ -297,23 +294,21 @@
// crop - a crop rectangle that's used as a hint to the consumer
// scalingMode - a set of flags from NATIVE_WINDOW_SCALING_* in <window.h>
// transform - a set of flags from NATIVE_WINDOW_TRANSFORM_* in <window.h>
- // async - if the buffer is queued in asynchronous mode
// fence - a fence that the consumer must wait on before reading the buffer,
// set this to Fence::NO_FENCE if the buffer is ready immediately
// sticky - the sticky transform set in Surface (only used by the LEGACY
// camera mode).
inline QueueBufferInput(int64_t timestamp, bool isAutoTimestamp,
android_dataspace dataSpace, const Rect& crop, int scalingMode,
- uint32_t transform, bool async, const sp<Fence>& fence,
- uint32_t sticky = 0)
+ uint32_t transform, const sp<Fence>& fence, uint32_t sticky = 0)
: timestamp(timestamp), isAutoTimestamp(isAutoTimestamp),
dataSpace(dataSpace), crop(crop), scalingMode(scalingMode),
- transform(transform), stickyTransform(sticky),
- async(async), fence(fence), surfaceDamage() { }
+ transform(transform), stickyTransform(sticky), fence(fence),
+ surfaceDamage() { }
inline void deflate(int64_t* outTimestamp, bool* outIsAutoTimestamp,
android_dataspace* outDataSpace,
Rect* outCrop, int* outScalingMode,
- uint32_t* outTransform, bool* outAsync, sp<Fence>* outFence,
+ uint32_t* outTransform, sp<Fence>* outFence,
uint32_t* outStickyTransform = NULL) const {
*outTimestamp = timestamp;
*outIsAutoTimestamp = bool(isAutoTimestamp);
@@ -321,7 +316,6 @@
*outCrop = crop;
*outScalingMode = scalingMode;
*outTransform = transform;
- *outAsync = bool(async);
*outFence = fence;
if (outStickyTransform != NULL) {
*outStickyTransform = stickyTransform;
@@ -345,7 +339,6 @@
int scalingMode;
uint32_t transform;
uint32_t stickyTransform;
- int async;
sp<Fence> fence;
Region surfaceDamage;
};
@@ -381,8 +374,8 @@
uint32_t numPendingBuffers;
};
- virtual status_t queueBuffer(int slot,
- const QueueBufferInput& input, QueueBufferOutput* output) = 0;
+ virtual status_t queueBuffer(int slot, const QueueBufferInput& input,
+ QueueBufferOutput* output) = 0;
// cancelBuffer indicates that the client does not wish to fill in the
// buffer associated with slot and transfers ownership of the slot back to
@@ -493,7 +486,7 @@
// allocated. This is most useful to avoid an allocation delay during
// dequeueBuffer. If there are already the maximum number of buffers
// allocated, this function has no effect.
- virtual void allocateBuffers(bool async, uint32_t width, uint32_t height,
+ virtual void allocateBuffers(uint32_t width, uint32_t height,
PixelFormat format, uint32_t usage) = 0;
// Sets whether dequeueBuffer is allowed to allocate new buffers.