[vlc-devel] [PATCH 5/5] direct3d11: set the HDR metadata on the SwapChain when available
Steve Lhomme
robux4 at videolabs.io
Wed Mar 29 15:39:31 CEST 2017
---
modules/video_output/win32/direct3d11.c | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 510e9b0352..b25253e483 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -40,7 +40,7 @@
#define COBJMACROS
#include <initguid.h>
#include <d3d11.h>
-#include <dxgi1_4.h>
+#include <dxgi1_5.h>
#include <d3dcompiler.h>
/* avoided until we can pass ISwapchainPanel without c++/cx mode
@@ -1583,6 +1583,30 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt)
D3D11SetColorSpace(vd);
+ if (fmt->mastering.max_luminance)
+ {
+ IDXGISwapChain4 *dxgiswapChain4;
+ hr = ID3D11Device_QueryInterface( sys->dxgiswapChain, &IID_IDXGISwapChain4, (void **)&dxgiswapChain4);
+ if (SUCCEEDED(hr)) {
+ DXGI_HDR_METADATA_HDR10 hdr10 = {0};
+ hdr10.GreenPrimary[0] = fmt->mastering.primaries[0];
+ hdr10.GreenPrimary[1] = fmt->mastering.primaries[1];
+ hdr10.BluePrimary[0] = fmt->mastering.primaries[2];
+ hdr10.BluePrimary[1] = fmt->mastering.primaries[3];
+ hdr10.RedPrimary[0] = fmt->mastering.primaries[4];
+ hdr10.RedPrimary[1] = fmt->mastering.primaries[5];
+ hdr10.WhitePoint[0] = fmt->mastering.white_point[0];
+ hdr10.WhitePoint[1] = fmt->mastering.white_point[1];
+ hdr10.MinMasteringLuminance = fmt->mastering.min_luminance;
+ hdr10.MaxMasteringLuminance = fmt->mastering.max_luminance;
+ //hdr10.MaxFrameAverageLightLevel = 1000;
+ //hdr10.MaxContentLightLevel = 5000;
+ hr = IDXGISwapChain4_SetHDRMetaData(dxgiswapChain4, DXGI_HDR_METADATA_TYPE_HDR10, sizeof(hdr10), &hdr10);
+ msg_Dbg(vd, "set HDR metadata %lx", hr);
+ IDXGISwapChain4_Release(dxgiswapChain4);
+ }
+ }
+
// look for the requested pixel format first
sys->picQuadConfig = GetOutputFormat(vd, fmt->i_chroma, 0, true, false);
--
2.11.1
More information about the vlc-devel
mailing list