vlc | branch: master | Steve Lhomme <[email protected]> | Fri Oct 27 10:11:51 2017 +0200| [45d2a76d3ce9046ae8ce0c84afe2fa76fbd071a6] | committer: Jean-Baptiste Kempf
direct3d11: use the same colorspace mode in the swapchain as the display 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. Signed-off-by: Jean-Baptiste Kempf <[email protected]> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=45d2a76d3ce9046ae8ce0c84afe2fa76fbd071a6 --- 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 15ce7c63ed..b246a97301 100644 --- a/modules/video_output/win32/direct3d11.c +++ b/modules/video_output/win32/direct3d11.c @@ -1497,32 +1497,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 ))) @@ -1538,6 +1512,7 @@ done: { if (color_spaces[i].dxgi == desc1.ColorSpace) { + best = i; csp = &color_spaces[i]; break; } @@ -1551,6 +1526,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) _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
