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

Commit 0cbebac3 authored by Trevor Black's avatar Trevor Black Committed by Automerger Merge Worker
Browse files

Merge "Add conditional BT709 support to the vulkan swapchain" am: cba1c577 am: 3365990b

Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/2021396

Change-Id: Id627d266fcc7606b0e44d4b1ba37cf17ff50a1a7
parents 23d5d806 3365990b
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -714,7 +714,7 @@ VkResult GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice pdev,

    bool wide_color_support = false;
    uint64_t consumer_usage = 0;
    bool swapchain_ext =
    bool colorspace_ext =
        instance_data.hook_extensions.test(ProcHook::EXT_swapchain_colorspace);
    if (surface_handle == VK_NULL_HANDLE) {
        ProcHook::Extension surfaceless = ProcHook::GOOGLE_surfaceless_query;
@@ -743,7 +743,7 @@ VkResult GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice pdev,

        consumer_usage = surface.consumer_usage;
    }
    wide_color_support = wide_color_support && swapchain_ext;
    wide_color_support = wide_color_support && colorspace_ext;

    AHardwareBuffer_Desc desc = {};
    desc.width = 1;
@@ -757,6 +757,11 @@ VkResult GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice pdev,
        {VK_FORMAT_R8G8B8A8_UNORM, VK_COLOR_SPACE_SRGB_NONLINEAR_KHR},
        {VK_FORMAT_R8G8B8A8_SRGB, VK_COLOR_SPACE_SRGB_NONLINEAR_KHR}};

    if (colorspace_ext) {
        all_formats.emplace_back(VkSurfaceFormatKHR{
            VK_FORMAT_R8G8B8A8_UNORM, VK_COLOR_SPACE_BT709_LINEAR_EXT});
    }

    if (wide_color_support) {
        all_formats.emplace_back(VkSurfaceFormatKHR{
            VK_FORMAT_R8G8B8A8_UNORM, VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT});