Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7f94272e authored by Greg Daniel's avatar Greg Daniel Committed by Android (Google) Code Review
Browse files

Merge "Add support for Vulkan VK_EXT_frame_boundary in HWUI." into main

parents ac720fbb 66d40dc0
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -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(),
    };
+2 −6
Original line number Diff line number Diff line
@@ -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"