summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Stan Iliev <stani@google.com> 2018-12-10 13:13:41 -0500
committer Stan Iliev <stani@google.com> 2018-12-10 21:54:58 +0000
commitbc46258527f3df49d408131f896b562102f02f1d (patch)
tree6e62212047068e33d2bf05d7f24402cc4f5cb04e
parent97e2b2a6a1c21f334c00ad6c147f4617c8ab323f (diff)
Fix temporary stretching when Surface is resized with Vulkan
Set NATIVE_WINDOW_SCALING_MODE_FREEZE scaling mode on the surface after Vulkan swapchain is created. This is the scaling mode used by GL as well. Window resize flow depends on preserving this behavior, because SurfaceComposerClient::Transaction::setSize calls are not postponed until a new buffer is enqueued. Test: StatusBar is resized correctly without any glitch. Bug: 118501234 Change-Id: Icfb6805bc362a742e14b993a0b825e5447d6eeb4
-rw-r--r--libs/hwui/renderthread/VulkanManager.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/libs/hwui/renderthread/VulkanManager.cpp b/libs/hwui/renderthread/VulkanManager.cpp
index 2abb3d5179a0..4be8bd9a863e 100644
--- a/libs/hwui/renderthread/VulkanManager.cpp
+++ b/libs/hwui/renderthread/VulkanManager.cpp
@@ -831,6 +831,11 @@ bool VulkanManager::createSwapchain(VulkanSurface* surface) {
createBuffers(surface, surfaceFormat, extent);
+ // The window content is not updated (frozen) until a buffer of the window size is received.
+ // This prevents temporary stretching of the window after it is resized, but before the first
+ // buffer with new size is enqueued.
+ native_window_set_scaling_mode(surface->mNativeWindow, NATIVE_WINDOW_SCALING_MODE_FREEZE);
+
return true;
}