diff options
author | 2025-03-18 11:32:40 -0700 | |
---|---|---|
committer | 2025-03-18 11:32:40 -0700 | |
commit | 7f94272e17f22e26c9c4e7c7ee2316bdf1bc9800 (patch) | |
tree | 61b2b23dff56be2996c8958db85b2c3ff352aced | |
parent | ac720fbb8d5c52e4a9607c8e8aae4b91f19d76f4 (diff) | |
parent | 66d40dc0d4cb599f5f8973bc250a4dd7552dd392 (diff) |
Merge "Add support for Vulkan VK_EXT_frame_boundary in HWUI." into main
-rw-r--r-- | libs/hwui/renderthread/VulkanManager.cpp | 13 | ||||
-rw-r--r-- | libs/hwui/renderthread/VulkanManager.h | 8 |
2 files changed, 13 insertions, 8 deletions
diff --git a/libs/hwui/renderthread/VulkanManager.cpp b/libs/hwui/renderthread/VulkanManager.cpp index 0cd9c53c830f..e5a6260cfd98 100644 --- a/libs/hwui/renderthread/VulkanManager.cpp +++ b/libs/hwui/renderthread/VulkanManager.cpp @@ -44,7 +44,7 @@ namespace uirenderer { namespace renderthread { // Not all of these are strictly required, but are all enabled if present. -static std::array<std::string_view, 23> sEnableExtensions{ +static std::array<std::string_view, 25> sEnableExtensions{ VK_KHR_BIND_MEMORY_2_EXTENSION_NAME, VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME, VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME, @@ -68,6 +68,8 @@ static std::array<std::string_view, 23> sEnableExtensions{ VK_EXT_GLOBAL_PRIORITY_QUERY_EXTENSION_NAME, VK_KHR_GLOBAL_PRIORITY_EXTENSION_NAME, VK_EXT_DEVICE_FAULT_EXTENSION_NAME, + VK_EXT_FRAME_BOUNDARY_EXTENSION_NAME, + VK_ANDROID_FRAME_BOUNDARY_EXTENSION_NAME, }; static bool shouldEnableExtension(const std::string_view& extension) { @@ -746,7 +748,14 @@ VulkanManager::VkDrawResult VulkanManager::finishFrame(SkSurface* surface) { ALOGE_IF(!context, "Surface is not backed by gpu"); GrSemaphoresSubmitted submitted = context->flush( surface, SkSurfaces::BackendSurfaceAccess::kPresent, flushInfo); - context->submit(); + + static uint64_t currentFrameID = 0; + GrSubmitInfo submitInfo; + if (!mFrameBoundaryANDROID) { + submitInfo.fMarkBoundary = GrMarkFrameBoundary::kYes; + submitInfo.fFrameID = currentFrameID++; + } + context->submit(submitInfo); VkDrawResult drawResult{ .submissionTime = systemTime(), }; diff --git a/libs/hwui/renderthread/VulkanManager.h b/libs/hwui/renderthread/VulkanManager.h index a593ec6f8351..744211e39f79 100644 --- a/libs/hwui/renderthread/VulkanManager.h +++ b/libs/hwui/renderthread/VulkanManager.h @@ -30,14 +30,10 @@ // VK_ANDROID_frame_boundary is a bespoke extension defined by AGI // (https://github.com/google/agi) to enable profiling of apps rendering via // HWUI. This extension is not defined in Khronos, hence the need to declare it -// manually here. There's a superseding extension (VK_EXT_frame_boundary) being -// discussed in Khronos, but in the meantime we use the bespoke -// VK_ANDROID_frame_boundary. This is a device extension that is implemented by +// manually here. There's an extension (VK_EXT_frame_boundary) which we will use +// instead if available. This is a device extension that is implemented by // AGI's Vulkan capture layer, such that it is only supported by devices when // AGI is doing a capture of the app. -// -// TODO(b/182165045): use the Khronos blessed VK_EXT_frame_boudary once it has -// landed in the spec. typedef void(VKAPI_PTR* PFN_vkFrameBoundaryANDROID)(VkDevice device, VkSemaphore semaphore, VkImage image); #define VK_ANDROID_FRAME_BOUNDARY_EXTENSION_NAME "VK_ANDROID_frame_boundary" |