summaryrefslogtreecommitdiffstats
path: root/libs/gui/Surface.cpp
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 /libs/gui/Surface.cpp
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 'libs/gui/Surface.cpp')
-rw-r--r--libs/gui/Surface.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp
index 88c45b2..8cb9189 100644
--- a/libs/gui/Surface.cpp
+++ b/libs/gui/Surface.cpp
@@ -91,6 +91,13 @@ void Surface::setSidebandStream(const sp<NativeHandle>& stream) {
mGraphicBufferProducer->setSidebandStream(stream);
}
+void Surface::allocateBuffers() {
+ uint32_t reqWidth = mReqWidth ? mReqWidth : mUserWidth;
+ uint32_t reqHeight = mReqHeight ? mReqHeight : mUserHeight;
+ mGraphicBufferProducer->allocateBuffers(mSwapIntervalZero, mReqWidth,
+ mReqHeight, mReqFormat, mReqUsage);
+}
+
int Surface::hook_setSwapInterval(ANativeWindow* window, int interval) {
Surface* c = getSelf(window);
return c->setSwapInterval(interval);