From e8c923ebdeb1760f6a0593400aa19eeb0efd8d87 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Thu, 9 Dec 2021 19:55:04 +0900 Subject: [PATCH] d3d11window: Remove hack related to color space selection Use input GstVideoColorPrimaries without any special case handling otherwise rendered image color would be very wrong. The hack was added to work around an issue that some Intel driver couldn't handle wide color gamut image without HDR10 metadata, specifically PQ image. But device capability can be checked via a method added in https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1723 so there's no issue now. Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1175 Part-of: --- .../gst-plugins-bad/sys/d3d11/gstd3d11pluginutils.cpp | 10 +--------- subprojects/gst-plugins-bad/sys/d3d11/gstd3d11pluginutils.h | 3 +-- subprojects/gst-plugins-bad/sys/d3d11/gstd3d11window.cpp | 13 +------------ 3 files changed, 3 insertions(+), 23 deletions(-) diff --git a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11pluginutils.cpp b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11pluginutils.cpp index 624063e..fea93b5 100644 --- a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11pluginutils.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11pluginutils.cpp @@ -514,7 +514,7 @@ gst_d3d11_video_info_to_dxgi_color_space (GstVideoInfo * info) const GstDxgiColorSpace * gst_d3d11_find_swap_chain_color_space (GstVideoInfo * info, - IDXGISwapChain3 * swapchain, gboolean use_hdr10) + IDXGISwapChain3 * swapchain) { const GstDxgiColorSpace *colorspace = NULL; gint best_score = G_MAXINT; @@ -535,14 +535,6 @@ gst_d3d11_find_swap_chain_color_space (GstVideoInfo * info, DXGI_COLOR_SPACE_TYPE cur_type = (DXGI_COLOR_SPACE_TYPE) rgb_colorspace_map[i].dxgi_color_space_type; - /* FIXME: Non-HDR colorspace with BT2020 primaries will break rendering. - * https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/1175 - * To workaround it, BT709 colorspace will be chosen for non-HDR case. - */ - if (!use_hdr10 && - rgb_colorspace_map[i].primaries == GST_VIDEO_COLOR_PRIMARIES_BT2020) - continue; - hr = swapchain->CheckColorSpaceSupport (cur_type, &can_support); if (FAILED (hr)) diff --git a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11pluginutils.h b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11pluginutils.h index de78df4..b92eaca 100644 --- a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11pluginutils.h +++ b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11pluginutils.h @@ -73,8 +73,7 @@ gboolean gst_d3d11_hdr_meta_data_to_dxgi (GstVideoMasteringDisplayInf const GstDxgiColorSpace * gst_d3d11_video_info_to_dxgi_color_space (GstVideoInfo * info); const GstDxgiColorSpace * gst_d3d11_find_swap_chain_color_space (GstVideoInfo * info, - IDXGISwapChain3 * swapchain, - gboolean use_hdr10); + IDXGISwapChain3 * swapchain); #endif GstBuffer * gst_d3d11_allocate_staging_buffer_for (GstBuffer * buffer, diff --git a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11window.cpp b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11window.cpp index d5c9acf..37928df 100644 --- a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11window.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11window.cpp @@ -583,17 +583,6 @@ gst_d3d11_window_prepare_default (GstD3D11Window * window, guint display_width, window->input_rect.bottom = GST_VIDEO_INFO_HEIGHT (&window->info); /* Step 4: Decide render color space and set it on converter/processor */ - - /* check HDR10 metadata. If HDR APIs are available, BT2020 primaries colorspcae - * will be used. - * - * FIXME: need to query h/w level support. If that's not the case, tone-mapping - * should be placed somewhere. - * - * FIXME: Non-HDR colorspace with BT2020 primaries will break rendering. - * https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/1175 - * To workaround it, BT709 colorspace will be chosen for non-HDR case. - */ #if (GST_D3D11_DXGI_HEADER_VERSION >= 5) { GstVideoMasteringDisplayInfo minfo; @@ -646,7 +635,7 @@ gst_d3d11_window_prepare_default (GstD3D11Window * window, guint display_width, if (gst_d3d11_result (hr, window->device)) { chosen_colorspace = gst_d3d11_find_swap_chain_color_space (&window->render_info, - swapchain3.Get (), have_hdr10); + swapchain3.Get ()); if (chosen_colorspace) { native_colorspace_type = (DXGI_COLOR_SPACE_TYPE) chosen_colorspace->dxgi_color_space_type; -- 2.7.4