Handle ANativeWindow resize with Vulkan swapchain
Recreate VulkanSurface, if ANativeWindow has been resized. This
new code is hit when wallpaper is resized from 64x64 to real size.
Bug: 119111018
Test: Wallpaper is shawn correctly with Vulkan rendering
Change-Id: I5e43310e5ee8597a7f326d51b1773e2cf68b603a
diff --git a/libs/hwui/renderthread/VulkanManager.h b/libs/hwui/renderthread/VulkanManager.h
index 6702649..8594a1b 100644
--- a/libs/hwui/renderthread/VulkanManager.h
+++ b/libs/hwui/renderthread/VulkanManager.h
@@ -38,7 +38,8 @@
class VulkanSurface {
public:
- VulkanSurface(ColorMode colorMode) : mColorMode(colorMode) {}
+ VulkanSurface(ColorMode colorMode, ANativeWindow* window)
+ : mColorMode(colorMode), mNativeWindow(window) {}
sk_sp<SkSurface> getBackBufferSurface() { return mBackbuffer; }
@@ -75,6 +76,9 @@
ImageInfo* mImageInfos;
uint16_t mCurrentTime = 0;
ColorMode mColorMode;
+ ANativeWindow* mNativeWindow;
+ int mWindowWidth = 0;
+ int mWindowHeight = 0;
};
// This class contains the shared global Vulkan objects, such as VkInstance, VkDevice and VkQueue,
@@ -109,7 +113,7 @@
// Returns an SkSurface which wraps the next image returned from vkAcquireNextImageKHR. It also
// will transition the VkImage from a present layout to color attachment so that it can be used
// by the client for drawing.
- SkSurface* getBackbufferSurface(VulkanSurface* surface);
+ SkSurface* getBackbufferSurface(VulkanSurface** surface);
// Presents the current VkImage.
void swapBuffers(VulkanSurface* surface);