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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user