From 6c58def18b66b914e29648bf8fabb78fb35dad6b Mon Sep 17 00:00:00 2001 From: freiling Date: Tue, 5 Sep 2017 12:39:18 -0700 Subject: [PATCH] [content handler] pipeline surface submission to mozart (flutter/engine#3915) This change basically moves the singaling of the surface acquire event into the gpu driver, eliminating the VkQueueWaitIdle on surface submission This change depends on https://skia-review.googlesource.com/c/25641/ so do not submit until Flutter has rolled Skia past that point --- engine/src/flutter/vulkan/vulkan_device.cc | 8 +++++--- engine/src/flutter/vulkan/vulkan_handle.h | 4 +++- engine/src/flutter/vulkan/vulkan_proc_table.cc | 2 ++ engine/src/flutter/vulkan/vulkan_proc_table.h | 1 + 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/engine/src/flutter/vulkan/vulkan_device.cc b/engine/src/flutter/vulkan/vulkan_device.cc index 0265e77311..fa81fbaa6b 100644 --- a/engine/src/flutter/vulkan/vulkan_device.cc +++ b/engine/src/flutter/vulkan/vulkan_device.cc @@ -58,10 +58,12 @@ VulkanDevice::VulkanDevice(VulkanProcTable& p_vk, .pQueuePriorities = priorities, }; - const char* extensions[] = { - VK_KHR_SWAPCHAIN_EXTENSION_NAME, + const char *extensions[] = { + VK_KHR_SWAPCHAIN_EXTENSION_NAME, #if OS_FUCHSIA - VK_GOOGLE_EXTERNAL_MEMORY_MAGMA_EXTENSION_NAME, + VK_GOOGLE_EXTERNAL_MEMORY_MAGMA_EXTENSION_NAME, + VK_KHR_EXTERNAL_SEMAPHORE_EXTENSION_NAME, + VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME, #endif }; diff --git a/engine/src/flutter/vulkan/vulkan_handle.h b/engine/src/flutter/vulkan/vulkan_handle.h index 5828c1210d..260d5e9d1b 100644 --- a/engine/src/flutter/vulkan/vulkan_handle.h +++ b/engine/src/flutter/vulkan/vulkan_handle.h @@ -55,7 +55,9 @@ class VulkanHandle { /// the lifetime of the handle extends past the lifetime of this object. void ReleaseOwnership() { disposer_ = nullptr; } - private: + void Reset() { DisposeIfNecessary(); } + +private: Handle handle_; Disposer disposer_; diff --git a/engine/src/flutter/vulkan/vulkan_proc_table.cc b/engine/src/flutter/vulkan/vulkan_proc_table.cc index 39a087ac5f..25e398d6b9 100644 --- a/engine/src/flutter/vulkan/vulkan_proc_table.cc +++ b/engine/src/flutter/vulkan/vulkan_proc_table.cc @@ -94,6 +94,7 @@ bool VulkanProcTable::SetupInstanceProcAddresses( ACQUIRE_PROC(CreateMagmaSurfaceKHR, handle); ACQUIRE_PROC(ExportDeviceMemoryMAGMA, handle); ACQUIRE_PROC(GetPhysicalDeviceMagmaPresentationSupportKHR, handle); + ACQUIRE_PROC(ImportSemaphoreFdKHR, handle); return true; }(); #endif // OS_FUCHSIA @@ -146,6 +147,7 @@ bool VulkanProcTable::SetupDeviceProcAddresses( ACQUIRE_PROC(WaitForFences, handle); #if OS_FUCHSIA ACQUIRE_PROC(ExportDeviceMemoryMAGMA, handle); + ACQUIRE_PROC(ImportSemaphoreFdKHR, handle); #endif // OS_FUCHSIA device_ = {handle, nullptr}; return true; diff --git a/engine/src/flutter/vulkan/vulkan_proc_table.h b/engine/src/flutter/vulkan/vulkan_proc_table.h index b9e68986db..4c5ea8faba 100644 --- a/engine/src/flutter/vulkan/vulkan_proc_table.h +++ b/engine/src/flutter/vulkan/vulkan_proc_table.h @@ -118,6 +118,7 @@ class VulkanProcTable : public ftl::RefCountedThreadSafe { DEFINE_PROC(CreateMagmaSurfaceKHR); DEFINE_PROC(ExportDeviceMemoryMAGMA); DEFINE_PROC(GetPhysicalDeviceMagmaPresentationSupportKHR); + DEFINE_PROC(ImportSemaphoreFdKHR); #endif // OS_FUCHSIA #undef DEFINE_PROC