Merge "Invalidate buffers on transform change" into tm-qpr-dev

This commit is contained in:
Massimo Carli
2023-05-10 09:51:10 +00:00
committed by Android (Google) Code Review
2 changed files with 13 additions and 0 deletions

View File

@@ -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) {

View File

@@ -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