From 19b2e3b81b6326836f333846263ce22f5059db58 Mon Sep 17 00:00:00 2001 From: Mario Kleiner Date: Wed, 15 Oct 2025 03:15:50 +0100 Subject: [PATCH] wsi/display: Initially set default HDR metadata from EDID for HDR modes For a selected non-default imageColorSpace during swapchain creation, make sure that proper HDR setup also works even if a client app does not explicitly call vkSetHdrMetadataEXT() in time. Assign the EDID provided metadata here, so the 1st atomic commit will set Colorspace and HDR metadata properties on the connector, to make sure HDR or other wide color gamut modes get enabled. Without this, the chain->color_outcome_serial would stay at zero and the properties would not ever get assigned during drm_atomic_commit(), leaving HDR disabled on the display sink. Fixes: 13137393f67b ("wsi/display: Expose HDR10 colorspace based on EDID") Signed-off-by: Mario Kleiner Reviewed-by: Autumn Ashton Part-of: --- src/vulkan/wsi/wsi_common_display.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/vulkan/wsi/wsi_common_display.c b/src/vulkan/wsi/wsi_common_display.c index c30822fc84b..568b506d37a 100644 --- a/src/vulkan/wsi/wsi_common_display.c +++ b/src/vulkan/wsi/wsi_common_display.c @@ -3077,6 +3077,15 @@ wsi_display_surface_create_swapchain( } } + /* For a non-default colorspace, make sure that proper setup also works if + * a client app does not explicitly call vkSetHdrMetadataEXT(), but only + * selects a HDR colorspace. We assign the EDID provided metadata here, so + * the 1st atomic commit will assign colorspace and HDR metadata props to + * the connector to enable HDR or Wide color gamut modes. + */ + if (create_info->imageColorSpace != VK_COLOR_SPACE_SRGB_NONLINEAR_KHR) + wsi_display_set_hdr_metadata(&chain->base, &chain->hdr_metadata); + *swapchain_out = &chain->base; return VK_SUCCESS;