Have Skia Vulkan backend support wait-for-gpu flag on tests
So trying to mimic what the EglManager does in the fence call.
Technically there are two logical queues I could wait on for the device,
the graphics queue and the present queue. Waiting on the device waits
for both these queues to finish. It wasn't obvious to me if the EGL was
waiting for just graphics work or both queues, so I went for both (by
waiting on device). However, so far every device we've seen in Vulkan
has the present and graphics queue combined on the physical device so
waiting for one or both should really be different.
Test: Manual ran macrobench in skiavk and more realistic values compared
to not waiting for gpu.
Change-Id: I17cde70c677a9ad1b6bf9bc9ca4fd5f8f3b807e3
diff --git a/libs/hwui/renderthread/VulkanManager.cpp b/libs/hwui/renderthread/VulkanManager.cpp
index 454ce4d..c2c2f22 100644
--- a/libs/hwui/renderthread/VulkanManager.cpp
+++ b/libs/hwui/renderthread/VulkanManager.cpp
@@ -603,6 +603,11 @@
}
void VulkanManager::swapBuffers(VulkanSurface* surface) {
+ if (CC_UNLIKELY(Properties::waitForGpuCompletion)) {
+ ATRACE_NAME("Finishing GPU work");
+ mDeviceWaitIdle(mBackendContext->fDevice);
+ }
+
VulkanSurface::BackbufferInfo* backbuffer = surface->mBackbuffers +
surface->mCurrentBackbufferIndex;
GrVkImageInfo* imageInfo;