Skip to content

Commit 1ccf8fc

Browse files
jreckAndroid Build Coastguard Worker
authored andcommitted
Invalidate buffers on transform change
Fixes: 271419600 Test: repro steps on bug (cherry picked from commit 61c6447) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:5545b1cc36fd47bb33d87875b451f9f5c870d8bf) Merged-In: Ib4eef40a0f59512c669b069532e55d36293f9e1c Change-Id: Ib4eef40a0f59512c669b069532e55d36293f9e1c
1 parent 3642ff8 commit 1ccf8fc

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

libs/hwui/renderthread/VulkanSurface.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,14 @@ void VulkanSurface::releaseBuffers() {
368368
}
369369
}
370370

371+
void VulkanSurface::invalidateBuffers() {
372+
for (uint32_t i = 0; i < mWindowInfo.bufferCount; i++) {
373+
VulkanSurface::NativeBufferInfo& bufferInfo = mNativeBuffers[i];
374+
bufferInfo.hasValidContents = false;
375+
bufferInfo.lastPresentedCount = 0;
376+
}
377+
}
378+
371379
VulkanSurface::NativeBufferInfo* VulkanSurface::dequeueNativeBuffer() {
372380
// Set the mCurrentBufferInfo to invalid in case of error and only reset it to the correct
373381
// value at the end of the function if everything dequeued correctly.
@@ -400,6 +408,10 @@ VulkanSurface::NativeBufferInfo* VulkanSurface::dequeueNativeBuffer() {
400408
// new NativeBufferInfo storage will be populated lazily as we dequeue each new buffer.
401409
mWindowInfo.actualSize = actualSize;
402410
releaseBuffers();
411+
} else {
412+
// A change in transform means we need to repaint the entire buffer area as the damage
413+
// rects have just moved about.
414+
invalidateBuffers();
403415
}
404416

405417
if (transformHint != mWindowInfo.transform) {

libs/hwui/renderthread/VulkanSurface.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ class VulkanSurface {
113113
WindowInfo* outWindowInfo);
114114
static bool UpdateWindow(ANativeWindow* window, const WindowInfo& windowInfo);
115115
void releaseBuffers();
116+
void invalidateBuffers();
116117

117118
// TODO: This number comes from ui/BufferQueueDefs. We're not pulling the
118119
// header in so that we don't need to depend on libui, but we should share

0 commit comments

Comments
 (0)