Loading libs/hwui/renderthread/VulkanManager.cpp +8 −7 Original line number Diff line number Diff line Loading @@ -25,7 +25,6 @@ #include <android/sync.h> #include <gui/TraceUtils.h> #include <include/gpu/ganesh/SkSurfaceGanesh.h> #include <include/gpu/ganesh/vk/GrVkBackendSemaphore.h> #include <include/gpu/ganesh/vk/GrVkBackendSurface.h> #include <include/gpu/ganesh/vk/GrVkDirectContext.h> #include <ui/FatVector.h> Loading Loading @@ -598,14 +597,15 @@ Frame VulkanManager::dequeueNextBuffer(VulkanSurface* surface) { close(fence_clone); sync_wait(bufferInfo->dequeue_fence, -1 /* forever */); } else { GrBackendSemaphore beSemaphore = GrBackendSemaphores::MakeVk(semaphore); GrBackendSemaphore backendSemaphore; backendSemaphore.initVulkan(semaphore); // Skia will take ownership of the VkSemaphore and delete it once the wait // has finished. The VkSemaphore also owns the imported fd, so it will // close the fd when it is deleted. bufferInfo->skSurface->wait(1, &beSemaphore); bufferInfo->skSurface->wait(1, &backendSemaphore); // The following flush blocks the GPU immediately instead of waiting for // other drawing ops. It seems dequeue_fence is not respected otherwise. // TODO: remove the flush after finding why beSemaphore is not working. // TODO: remove the flush after finding why backendSemaphore is not working. skgpu::ganesh::FlushAndSubmit(bufferInfo->skSurface.get()); } } Loading @@ -625,8 +625,8 @@ class SharedSemaphoreInfo : public LightRefBase<SharedSemaphoreInfo> { SharedSemaphoreInfo(PFN_vkDestroySemaphore destroyFunction, VkDevice device, VkSemaphore semaphore) : mDestroyFunction(destroyFunction), mDevice(device), mGrBackendSemaphore(GrBackendSemaphores::MakeVk(semaphore)) { : mDestroyFunction(destroyFunction), mDevice(device), mSemaphore(semaphore) { mGrBackendSemaphore.initVulkan(semaphore); } ~SharedSemaphoreInfo() { mDestroyFunction(mDevice, mSemaphore, nullptr); } Loading Loading @@ -798,7 +798,8 @@ status_t VulkanManager::fenceWait(int fence, GrDirectContext* grContext) { return UNKNOWN_ERROR; } GrBackendSemaphore beSemaphore = GrBackendSemaphores::MakeVk(semaphore); GrBackendSemaphore beSemaphore; beSemaphore.initVulkan(semaphore); // Skia will take ownership of the VkSemaphore and delete it once the wait has finished. The // VkSemaphore also owns the imported fd, so it will close the fd when it is deleted. Loading Loading
libs/hwui/renderthread/VulkanManager.cpp +8 −7 Original line number Diff line number Diff line Loading @@ -25,7 +25,6 @@ #include <android/sync.h> #include <gui/TraceUtils.h> #include <include/gpu/ganesh/SkSurfaceGanesh.h> #include <include/gpu/ganesh/vk/GrVkBackendSemaphore.h> #include <include/gpu/ganesh/vk/GrVkBackendSurface.h> #include <include/gpu/ganesh/vk/GrVkDirectContext.h> #include <ui/FatVector.h> Loading Loading @@ -598,14 +597,15 @@ Frame VulkanManager::dequeueNextBuffer(VulkanSurface* surface) { close(fence_clone); sync_wait(bufferInfo->dequeue_fence, -1 /* forever */); } else { GrBackendSemaphore beSemaphore = GrBackendSemaphores::MakeVk(semaphore); GrBackendSemaphore backendSemaphore; backendSemaphore.initVulkan(semaphore); // Skia will take ownership of the VkSemaphore and delete it once the wait // has finished. The VkSemaphore also owns the imported fd, so it will // close the fd when it is deleted. bufferInfo->skSurface->wait(1, &beSemaphore); bufferInfo->skSurface->wait(1, &backendSemaphore); // The following flush blocks the GPU immediately instead of waiting for // other drawing ops. It seems dequeue_fence is not respected otherwise. // TODO: remove the flush after finding why beSemaphore is not working. // TODO: remove the flush after finding why backendSemaphore is not working. skgpu::ganesh::FlushAndSubmit(bufferInfo->skSurface.get()); } } Loading @@ -625,8 +625,8 @@ class SharedSemaphoreInfo : public LightRefBase<SharedSemaphoreInfo> { SharedSemaphoreInfo(PFN_vkDestroySemaphore destroyFunction, VkDevice device, VkSemaphore semaphore) : mDestroyFunction(destroyFunction), mDevice(device), mGrBackendSemaphore(GrBackendSemaphores::MakeVk(semaphore)) { : mDestroyFunction(destroyFunction), mDevice(device), mSemaphore(semaphore) { mGrBackendSemaphore.initVulkan(semaphore); } ~SharedSemaphoreInfo() { mDestroyFunction(mDevice, mSemaphore, nullptr); } Loading Loading @@ -798,7 +798,8 @@ status_t VulkanManager::fenceWait(int fence, GrDirectContext* grContext) { return UNKNOWN_ERROR; } GrBackendSemaphore beSemaphore = GrBackendSemaphores::MakeVk(semaphore); GrBackendSemaphore beSemaphore; beSemaphore.initVulkan(semaphore); // Skia will take ownership of the VkSemaphore and delete it once the wait has finished. The // VkSemaphore also owns the imported fd, so it will close the fd when it is deleted. Loading