diff options
author | 2019-10-31 15:04:58 -0700 | |
---|---|---|
committer | 2019-10-31 15:04:58 -0700 | |
commit | 4145919ef9853145532430c1e2e39ea53baee189 (patch) | |
tree | f946a43cc61eaa0011fc803d9e1d0c83d3fd22ac | |
parent | c1661db64484adc96a59bfbbac3510072f763aab (diff) |
Fix wrong surfaceRequiresRedraw check
We only need to redraw if the size /changed/ not
if it was the same. Also fix damageId to not use
frameNumber as repeated redraws of the same frame
would toggle.
Bug: 143711430
Test: systrace
Change-Id: I8ac4629c9ff4fd51de33d1be7aa46ccc995ba342
-rw-r--r-- | libs/hwui/TreeInfo.cpp | 1 | ||||
-rw-r--r-- | libs/hwui/renderthread/CanvasContext.cpp | 3 | ||||
-rw-r--r-- | libs/hwui/renderthread/CanvasContext.h | 1 |
3 files changed, 3 insertions, 2 deletions
diff --git a/libs/hwui/TreeInfo.cpp b/libs/hwui/TreeInfo.cpp index dc53dd6c27c3..750f869e2551 100644 --- a/libs/hwui/TreeInfo.cpp +++ b/libs/hwui/TreeInfo.cpp @@ -24,7 +24,6 @@ TreeInfo::TreeInfo(TraversalMode mode, renderthread::CanvasContext& canvasContex : mode(mode) , prepareTextures(mode == MODE_FULL) , canvasContext(canvasContext) - , damageGenerationId(canvasContext.getFrameNumber()) , disableForceDark(canvasContext.useForceDark() ? 0 : 1) , screenSize(canvasContext.getNextFrameSize()) {} diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp index e5c502cca09a..4ca26c273c95 100644 --- a/libs/hwui/renderthread/CanvasContext.cpp +++ b/libs/hwui/renderthread/CanvasContext.cpp @@ -303,6 +303,7 @@ void CanvasContext::prepareTree(TreeInfo& info, int64_t* uiFrameInfo, int64_t sy info.damageAccumulator = &mDamageAccumulator; info.layerUpdateQueue = &mLayerUpdateQueue; + info.damageGenerationId = mDamageId++; info.out.canDrawThisFrame = true; mAnimationContext->startFrame(info.mode); @@ -702,7 +703,7 @@ bool CanvasContext::surfaceRequiresRedraw() { surface->query(NATIVE_WINDOW_WIDTH, &width); surface->query(NATIVE_WINDOW_HEIGHT, &height); - return width == mLastFrameWidth && height == mLastFrameHeight; + return width != mLastFrameWidth || height != mLastFrameHeight; } void CanvasContext::setRenderAheadDepth(int renderAhead) { diff --git a/libs/hwui/renderthread/CanvasContext.h b/libs/hwui/renderthread/CanvasContext.h index 6e3e43af8c6f..b192d461da9b 100644 --- a/libs/hwui/renderthread/CanvasContext.h +++ b/libs/hwui/renderthread/CanvasContext.h @@ -245,6 +245,7 @@ private: // Need at least 4 because we do quad buffer. Add a 5th for good measure. RingBuffer<SwapHistory, 5> mSwapHistory; int64_t mFrameNumber = -1; + int64_t mDamageId = 0; // last vsync for a dropped frame due to stuffed queue nsecs_t mLastDropVsync = 0; |