summaryrefslogtreecommitdiffstats
path: root/include/gui
diff options
context:
space:
mode:
authorDan Stoza <stoza@google.com>2014-06-20 13:13:57 -0700
committerDan Stoza <stoza@google.com>2014-06-20 13:13:57 -0700
commit29a3e90879fd96404c971e7187cd0e05927bbce0 (patch)
tree024503f644be306ea3eb99e14b8847d454bdbf51 /include/gui
parenta317f27b7bf49e2e7b2b443223c07fb8c7c3ac3f (diff)
downloadframeworks_native-29a3e90879fd96404c971e7187cd0e05927bbce0.zip
frameworks_native-29a3e90879fd96404c971e7187cd0e05927bbce0.tar.gz
frameworks_native-29a3e90879fd96404c971e7187cd0e05927bbce0.tar.bz2
BufferQueue: Add allocateBuffers method
This adds an allocateBuffers method to BufferQueue, which instructs it to allocate up to the maximum number of buffers allowed by the current configuration. The goal is that this method can be called ahead of render time, which will prevent dequeueBuffers from blocking in allocation and inducing jank. This interface is also plumbed up to the native Surface (and, in another change, up to the Java Surface and ThreadedRenderer). Bug: 11792166 Change-Id: I4aa96b4351ea1c95ed5db228ca3ef98303229c74
Diffstat (limited to 'include/gui')
-rw-r--r--include/gui/BufferQueueProducer.h4
-rw-r--r--include/gui/IGraphicBufferProducer.h13
-rw-r--r--include/gui/Surface.h10
3 files changed, 27 insertions, 0 deletions
diff --git a/include/gui/BufferQueueProducer.h b/include/gui/BufferQueueProducer.h
index 9df3633..fe8a308 100644
--- a/include/gui/BufferQueueProducer.h
+++ b/include/gui/BufferQueueProducer.h
@@ -169,6 +169,10 @@ public:
// handle if any.
virtual status_t setSidebandStream(const sp<NativeHandle>& stream);
+ // See IGraphicBufferProducer::allocateBuffers
+ virtual void allocateBuffers(bool async, uint32_t width, uint32_t height,
+ uint32_t format, uint32_t usage);
+
private:
// This is required by the IBinder::DeathRecipient interface
virtual void binderDied(const wp<IBinder>& who);
diff --git a/include/gui/IGraphicBufferProducer.h b/include/gui/IGraphicBufferProducer.h
index d9e116b..9b96b2b 100644
--- a/include/gui/IGraphicBufferProducer.h
+++ b/include/gui/IGraphicBufferProducer.h
@@ -429,6 +429,19 @@ public:
// Passing NULL or a different stream handle will detach the previous
// handle if any.
virtual status_t setSidebandStream(const sp<NativeHandle>& stream) = 0;
+
+ // Allocates buffers based on the given dimensions/format.
+ //
+ // This function will allocate up to the maximum number of buffers
+ // permitted by the current BufferQueue configuration. It will use the
+ // given format, dimensions, and usage bits, which are interpreted in the
+ // same way as for dequeueBuffer, and the async flag must be set the same
+ // way as for dequeueBuffer to ensure that the correct number of buffers are
+ // 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,
+ uint32_t format, uint32_t usage) = 0;
};
// ----------------------------------------------------------------------------
diff --git a/include/gui/Surface.h b/include/gui/Surface.h
index d8e9756..dcfe74f 100644
--- a/include/gui/Surface.h
+++ b/include/gui/Surface.h
@@ -91,6 +91,16 @@ public:
*/
void setSidebandStream(const sp<NativeHandle>& stream);
+ /* Allocates buffers based on the current dimensions/format.
+ *
+ * This function will allocate up to the maximum number of buffers
+ * permitted by the current BufferQueue configuration. It will use the
+ * default format and dimensions. 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.
+ */
+ void allocateBuffers();
+
protected:
virtual ~Surface();