Loading libs/hwui/pipeline/skia/SkiaVulkanPipeline.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ Frame SkiaVulkanPipeline::getFrame() { LOG_ALWAYS_FATAL_IF(mVkSurface == nullptr, "drawRenderNode called on a context with no surface!"); SkSurface* backBuffer = mVkManager.getBackbufferSurface(mVkSurface); SkSurface* backBuffer = mVkManager.getBackbufferSurface(&mVkSurface); if (backBuffer == nullptr) { SkDebugf("failed to get backbuffer"); return Frame(-1, -1, 0); Loading libs/hwui/renderthread/VulkanManager.cpp +19 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ #include "VulkanManager.h" #include <gui/Surface.h> #include "Properties.h" #include "RenderThread.h" #include "renderstate/RenderState.h" Loading Loading @@ -452,7 +454,20 @@ VulkanSurface::BackbufferInfo* VulkanManager::getAvailableBackbuffer(VulkanSurfa return backbuffer; } SkSurface* VulkanManager::getBackbufferSurface(VulkanSurface* surface) { SkSurface* VulkanManager::getBackbufferSurface(VulkanSurface** surfaceOut) { // Recreate VulkanSurface, if ANativeWindow has been resized. VulkanSurface* surface = *surfaceOut; int windowWidth = 0, windowHeight = 0; ANativeWindow* window = surface->mNativeWindow; window->query(window, NATIVE_WINDOW_WIDTH, &windowWidth); window->query(window, NATIVE_WINDOW_HEIGHT, &windowHeight); if (windowWidth != surface->mWindowWidth || windowHeight != surface->mWindowHeight) { ColorMode colorMode = surface->mColorMode; destroySurface(surface); *surfaceOut = createSurface(window, colorMode); surface = *surfaceOut; } VulkanSurface::BackbufferInfo* backbuffer = getAvailableBackbuffer(surface); SkASSERT(backbuffer); Loading Loading @@ -717,6 +732,8 @@ bool VulkanManager::createSwapchain(VulkanSurface* surface) { extent.height = caps.minImageExtent.height; } SkASSERT(extent.height <= caps.maxImageExtent.height); surface->mWindowWidth = extent.width; surface->mWindowHeight = extent.height; uint32_t imageCount = caps.minImageCount + 2; if (caps.maxImageCount > 0 && imageCount > caps.maxImageCount) { Loading Loading @@ -814,7 +831,7 @@ VulkanSurface* VulkanManager::createSurface(ANativeWindow* window, ColorMode col return nullptr; } VulkanSurface* surface = new VulkanSurface(colorMode); VulkanSurface* surface = new VulkanSurface(colorMode, window); VkAndroidSurfaceCreateInfoKHR surfaceCreateInfo; memset(&surfaceCreateInfo, 0, sizeof(VkAndroidSurfaceCreateInfoKHR)); Loading libs/hwui/renderthread/VulkanManager.h +6 −2 Original line number Diff line number Diff line Loading @@ -38,7 +38,8 @@ class RenderThread; class VulkanSurface { public: VulkanSurface(ColorMode colorMode) : mColorMode(colorMode) {} VulkanSurface(ColorMode colorMode, ANativeWindow* window) : mColorMode(colorMode), mNativeWindow(window) {} sk_sp<SkSurface> getBackBufferSurface() { return mBackbuffer; } Loading Loading @@ -75,6 +76,9 @@ private: 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, Loading Loading @@ -109,7 +113,7 @@ public: // 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); Loading Loading
libs/hwui/pipeline/skia/SkiaVulkanPipeline.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ Frame SkiaVulkanPipeline::getFrame() { LOG_ALWAYS_FATAL_IF(mVkSurface == nullptr, "drawRenderNode called on a context with no surface!"); SkSurface* backBuffer = mVkManager.getBackbufferSurface(mVkSurface); SkSurface* backBuffer = mVkManager.getBackbufferSurface(&mVkSurface); if (backBuffer == nullptr) { SkDebugf("failed to get backbuffer"); return Frame(-1, -1, 0); Loading
libs/hwui/renderthread/VulkanManager.cpp +19 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ #include "VulkanManager.h" #include <gui/Surface.h> #include "Properties.h" #include "RenderThread.h" #include "renderstate/RenderState.h" Loading Loading @@ -452,7 +454,20 @@ VulkanSurface::BackbufferInfo* VulkanManager::getAvailableBackbuffer(VulkanSurfa return backbuffer; } SkSurface* VulkanManager::getBackbufferSurface(VulkanSurface* surface) { SkSurface* VulkanManager::getBackbufferSurface(VulkanSurface** surfaceOut) { // Recreate VulkanSurface, if ANativeWindow has been resized. VulkanSurface* surface = *surfaceOut; int windowWidth = 0, windowHeight = 0; ANativeWindow* window = surface->mNativeWindow; window->query(window, NATIVE_WINDOW_WIDTH, &windowWidth); window->query(window, NATIVE_WINDOW_HEIGHT, &windowHeight); if (windowWidth != surface->mWindowWidth || windowHeight != surface->mWindowHeight) { ColorMode colorMode = surface->mColorMode; destroySurface(surface); *surfaceOut = createSurface(window, colorMode); surface = *surfaceOut; } VulkanSurface::BackbufferInfo* backbuffer = getAvailableBackbuffer(surface); SkASSERT(backbuffer); Loading Loading @@ -717,6 +732,8 @@ bool VulkanManager::createSwapchain(VulkanSurface* surface) { extent.height = caps.minImageExtent.height; } SkASSERT(extent.height <= caps.maxImageExtent.height); surface->mWindowWidth = extent.width; surface->mWindowHeight = extent.height; uint32_t imageCount = caps.minImageCount + 2; if (caps.maxImageCount > 0 && imageCount > caps.maxImageCount) { Loading Loading @@ -814,7 +831,7 @@ VulkanSurface* VulkanManager::createSurface(ANativeWindow* window, ColorMode col return nullptr; } VulkanSurface* surface = new VulkanSurface(colorMode); VulkanSurface* surface = new VulkanSurface(colorMode, window); VkAndroidSurfaceCreateInfoKHR surfaceCreateInfo; memset(&surfaceCreateInfo, 0, sizeof(VkAndroidSurfaceCreateInfoKHR)); Loading
libs/hwui/renderthread/VulkanManager.h +6 −2 Original line number Diff line number Diff line Loading @@ -38,7 +38,8 @@ class RenderThread; class VulkanSurface { public: VulkanSurface(ColorMode colorMode) : mColorMode(colorMode) {} VulkanSurface(ColorMode colorMode, ANativeWindow* window) : mColorMode(colorMode), mNativeWindow(window) {} sk_sp<SkSurface> getBackBufferSurface() { return mBackbuffer; } Loading Loading @@ -75,6 +76,9 @@ private: 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, Loading Loading @@ -109,7 +113,7 @@ public: // 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); Loading