summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2023-05-04 11:29:45 -0400
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-05-27 21:43:56 +0000
commit1ccf8fc695e37b0ee32a715a7b5b8757282ced0f (patch)
tree7ec4001f74941f3584a1d90a55c6cec2ffcc1c3a
parent3642ff875847de2f89a9982190d0803d87a6f813 (diff)
downloadbase-1ccf8fc695e37b0ee32a715a7b5b8757282ced0f.tar.gz
Invalidate buffers on transform change
Fixes: 271419600 Test: repro steps on bug (cherry picked from commit 61c64472417a272ec2aa2fd38e0d1874dbf16319) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:5545b1cc36fd47bb33d87875b451f9f5c870d8bf) Merged-In: Ib4eef40a0f59512c669b069532e55d36293f9e1c Change-Id: Ib4eef40a0f59512c669b069532e55d36293f9e1c
-rw-r--r--libs/hwui/renderthread/VulkanSurface.cpp12
-rw-r--r--libs/hwui/renderthread/VulkanSurface.h1
2 files changed, 13 insertions, 0 deletions
diff --git a/libs/hwui/renderthread/VulkanSurface.cpp b/libs/hwui/renderthread/VulkanSurface.cpp
index 666f32939206..cbee104aa3b0 100644
--- a/libs/hwui/renderthread/VulkanSurface.cpp
+++ b/libs/hwui/renderthread/VulkanSurface.cpp
@@ -368,6 +368,14 @@ void VulkanSurface::releaseBuffers() {
}
}
+void VulkanSurface::invalidateBuffers() {
+ for (uint32_t i = 0; i < mWindowInfo.bufferCount; i++) {
+ VulkanSurface::NativeBufferInfo& bufferInfo = mNativeBuffers[i];
+ bufferInfo.hasValidContents = false;
+ bufferInfo.lastPresentedCount = 0;
+ }
+}
+
VulkanSurface::NativeBufferInfo* VulkanSurface::dequeueNativeBuffer() {
// Set the mCurrentBufferInfo to invalid in case of error and only reset it to the correct
// value at the end of the function if everything dequeued correctly.
@@ -400,6 +408,10 @@ VulkanSurface::NativeBufferInfo* VulkanSurface::dequeueNativeBuffer() {
// new NativeBufferInfo storage will be populated lazily as we dequeue each new buffer.
mWindowInfo.actualSize = actualSize;
releaseBuffers();
+ } else {
+ // A change in transform means we need to repaint the entire buffer area as the damage
+ // rects have just moved about.
+ invalidateBuffers();
}
if (transformHint != mWindowInfo.transform) {
diff --git a/libs/hwui/renderthread/VulkanSurface.h b/libs/hwui/renderthread/VulkanSurface.h
index b8ccf7810b5d..ff328b25d195 100644
--- a/libs/hwui/renderthread/VulkanSurface.h
+++ b/libs/hwui/renderthread/VulkanSurface.h
@@ -113,6 +113,7 @@ private:
WindowInfo* outWindowInfo);
static bool UpdateWindow(ANativeWindow* window, const WindowInfo& windowInfo);
void releaseBuffers();
+ void invalidateBuffers();
// TODO: This number comes from ui/BufferQueueDefs. We're not pulling the
// header in so that we don't need to depend on libui, but we should share