summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread/CanvasContext.cpp
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2020-09-21 14:37:41 -0700
committerJohn Reck <jreck@google.com>2020-09-21 14:37:41 -0700
commitfbe14bbbd37e8997349bba26d2f6e520a9e6df47 (patch)
treeff1bba0fd76e7d293cbe3ca2b0dccfffae62b91f /libs/hwui/renderthread/CanvasContext.cpp
parent67af626de09ee8e02f1622f8d9dfb5057bab28ab (diff)
Fix override setBufferCount
The logic in setBufferCount was still assuming it needed to inject the extra buffers, however that injection was already happening in the min_undequeued query. So it was increasing buffercount by 2x the extraCount, or concretely 5 buffers when it should have been 4 on >75hz devices Bug: 168928692 Test: Boot coral, verify 4 buffers instead of 5 Change-Id: I0908228a6791d90544fbf4cb21170931bd31a9db
Diffstat (limited to 'libs/hwui/renderthread/CanvasContext.cpp')
-rw-r--r--libs/hwui/renderthread/CanvasContext.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index 13d544c68e95..96fbac980afb 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -139,7 +139,7 @@ void CanvasContext::destroy() {
mAnimationContext->destroy();
}
-static void setBufferCount(ANativeWindow* window, uint32_t extraBuffers) {
+static void setBufferCount(ANativeWindow* window) {
int query_value;
int err = window->query(window, NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS, &query_value);
if (err != 0 || query_value < 0) {
@@ -148,7 +148,9 @@ static void setBufferCount(ANativeWindow* window, uint32_t extraBuffers) {
}
auto min_undequeued_buffers = static_cast<uint32_t>(query_value);
- int bufferCount = min_undequeued_buffers + 2 + extraBuffers;
+ // We only need to set min_undequeued + 2 because the renderahead amount was already factored into the
+ // query for min_undequeued
+ int bufferCount = min_undequeued_buffers + 2;
native_window_set_buffer_count(window, bufferCount);
}
@@ -182,7 +184,8 @@ void CanvasContext::setupPipelineSurface() {
mNativeSurface ? mNativeSurface->getNativeWindow() : nullptr, mSwapBehavior);
if (mNativeSurface && !mNativeSurface->didSetExtraBuffers()) {
- setBufferCount(mNativeSurface->getNativeWindow(), mRenderAheadCapacity);
+ setBufferCount(mNativeSurface->getNativeWindow());
+
}
mFrameNumber = -1;