diff options
author | 2021-02-03 16:30:51 -0500 | |
---|---|---|
committer | 2021-02-03 15:30:05 -0800 | |
commit | f516e3a36e069e99477c027eda448c3d6121a028 (patch) | |
tree | 646fddc04fdd9a14d5d9c158e31c8b3383a75419 | |
parent | 621abeb8a9eb40516dc52494889da38714ca73fe (diff) |
Fix render_ahead properties
0 and -1 both meant default when 0 should mean
0 and -1 should mean default
Test: manual
Fixes: 179290765
Change-Id: Ia9aa5e3d83757282bfff776e083d6b3d7d29e9c0
-rw-r--r-- | libs/hwui/Properties.cpp | 5 | ||||
-rw-r--r-- | libs/hwui/renderthread/CanvasContext.cpp | 23 |
2 files changed, 18 insertions, 10 deletions
diff --git a/libs/hwui/Properties.cpp b/libs/hwui/Properties.cpp index 65f4e8c8ecec..e798f2a2bc69 100644 --- a/libs/hwui/Properties.cpp +++ b/libs/hwui/Properties.cpp @@ -129,8 +129,9 @@ bool Properties::load() { runningInEmulator = base::GetBoolProperty(PROPERTY_QEMU_KERNEL, false); - defaultRenderAhead = std::max(-1, std::min(2, base::GetIntProperty(PROPERTY_RENDERAHEAD, - render_ahead().value_or(0)))); + defaultRenderAhead = std::max( + -1, + std::min(2, base::GetIntProperty(PROPERTY_RENDERAHEAD, render_ahead().value_or(-1)))); return (prevDebugLayersUpdates != debugLayersUpdates) || (prevDebugOverdraw != debugOverdraw); } diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp index eacabfd1dbf9..42e93b69a89d 100644 --- a/libs/hwui/renderthread/CanvasContext.cpp +++ b/libs/hwui/renderthread/CanvasContext.cpp @@ -157,12 +157,14 @@ static void setBufferCount(ANativeWindow* window) { void CanvasContext::setSurface(ANativeWindow* window, bool enableTimeout) { ATRACE_CALL(); - if (mRenderAheadDepth == 0 && DeviceInfo::get()->getMaxRefreshRate() > 66.6f) { - mFixedRenderAhead = false; - mRenderAheadCapacity = 1; - } else { - mFixedRenderAhead = true; + if (mFixedRenderAhead) { mRenderAheadCapacity = mRenderAheadDepth; + } else { + if (DeviceInfo::get()->getMaxRefreshRate() > 66.6f) { + mRenderAheadCapacity = 1; + } else { + mRenderAheadCapacity = 0; + } } if (window) { @@ -762,11 +764,16 @@ bool CanvasContext::surfaceRequiresRedraw() { } void CanvasContext::setRenderAheadDepth(int renderAhead) { - if (renderAhead > 2 || renderAhead < 0 || mNativeSurface) { + if (renderAhead > 2 || renderAhead < -1 || mNativeSurface) { return; } - mFixedRenderAhead = true; - mRenderAheadDepth = static_cast<uint32_t>(renderAhead); + if (renderAhead == -1) { + mFixedRenderAhead = false; + mRenderAheadDepth = 0; + } else { + mFixedRenderAhead = true; + mRenderAheadDepth = static_cast<uint32_t>(renderAhead); + } } SkRect CanvasContext::computeDirtyRect(const Frame& frame, SkRect* dirty) { |