[vlc-devel] [PATCH 1/2] direct3d11: use the same colorspace mode in the swapchain as the display
Steve Lhomme
robux4 at videolabs.io
Fri Oct 27 10:11:51 CEST 2017
We get better control of how we want to tone the colors between SDR/HDR and less
extra conversions done by Windows. We may also offload the color conversion in
a separate plugin so that displaying does as little (GPU) processing as possible.
---
modules/video_output/win32/direct3d11.c | 54 +++++++++++++++++----------------
1 file changed, 28 insertions(+), 26 deletions(-)
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 273946fc5a..b5152b8a8f 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -1392,32 +1392,6 @@ static void D3D11SetColorSpace(vout_display_t *vd)
best = 0;
msg_Warn(vd, "no matching colorspace found force %s", color_spaces[best].name);
}
- hr = IDXGISwapChain3_SetColorSpace1(dxgiswapChain3, color_spaces[best].dxgi);
- if (SUCCEEDED(hr))
- {
- sys->display.colorspace = &color_spaces[best];
- msg_Dbg(vd, "using colorspace %s", sys->display.colorspace->name);
- }
- else
- msg_Err(vd, "Failed to set colorspace %s. (hr=0x%lX)", sys->display.colorspace->name, hr);
-done:
- /* guestimate the display peak luminance */
- switch (sys->display.colorspace->transfer)
- {
- case TRANSFER_FUNC_LINEAR:
- case TRANSFER_FUNC_SRGB:
- sys->display.luminance_peak = DEFAULT_BRIGHTNESS;
- break;
- case TRANSFER_FUNC_SMPTE_ST2084:
- sys->display.luminance_peak = 10000;
- break;
- /* there is no other output transfer on Windows */
- default:
- vlc_assert_unreachable();
- }
-
- if (dxgiswapChain3)
- IDXGISwapChain3_Release(dxgiswapChain3);
#ifdef HAVE_DXGI1_6_H
if (SUCCEEDED(IDXGISwapChain_GetContainingOutput( sys->dxgiswapChain, &dxgiOutput )))
@@ -1433,6 +1407,7 @@ done:
{
if (color_spaces[i].dxgi == desc1.ColorSpace)
{
+ best = i;
csp = &color_spaces[i];
break;
}
@@ -1446,6 +1421,33 @@ done:
IDXGIOutput_Release( dxgiOutput );
}
#endif
+
+ hr = IDXGISwapChain3_SetColorSpace1(dxgiswapChain3, color_spaces[best].dxgi);
+ if (SUCCEEDED(hr))
+ {
+ sys->display.colorspace = &color_spaces[best];
+ msg_Dbg(vd, "using colorspace %s", sys->display.colorspace->name);
+ }
+ else
+ msg_Err(vd, "Failed to set colorspace %s. (hr=0x%lX)", sys->display.colorspace->name, hr);
+done:
+ /* guestimate the display peak luminance */
+ switch (sys->display.colorspace->transfer)
+ {
+ case TRANSFER_FUNC_LINEAR:
+ case TRANSFER_FUNC_SRGB:
+ sys->display.luminance_peak = DEFAULT_BRIGHTNESS;
+ break;
+ case TRANSFER_FUNC_SMPTE_ST2084:
+ sys->display.luminance_peak = 10000;
+ break;
+ /* there is no other output transfer on Windows */
+ default:
+ vlc_assert_unreachable();
+ }
+
+ if (dxgiswapChain3)
+ IDXGISwapChain3_Release(dxgiswapChain3);
}
static const d3d_format_t *GetDirectRenderingFormat(vout_display_t *vd, vlc_fourcc_t i_src_chroma)
--
2.14.2
More information about the vlc-devel
mailing list