[vlc-commits] direct3d11: only send the HDR metadata when they change
Steve Lhomme
git at videolan.org
Wed Mar 25 11:45:41 CET 2020
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Mar 25 11:32:39 2020 +0100| [269540817f0fc882076238ddb0ce904d00ac90f2] | committer: Steve Lhomme
direct3d11: only send the HDR metadata when they change
Newer Windows issue this warning if we send metadata with each picture:
DXGI WARNING: IDXGISwapChain4::SetHDRMetaData: Redundant invocation on unchanged
metadata could result in presentation performance inefficiency. [ MISCELLANEOUS WARNING #295: ]
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=269540817f0fc882076238ddb0ce904d00ac90f2
---
modules/video_output/win32/d3d11_swapchain.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/modules/video_output/win32/d3d11_swapchain.c b/modules/video_output/win32/d3d11_swapchain.c
index 13d7911565..aee680445d 100644
--- a/modules/video_output/win32/d3d11_swapchain.c
+++ b/modules/video_output/win32/d3d11_swapchain.c
@@ -80,6 +80,7 @@ struct d3d11_local_swapchain
#endif /* !VLC_WINSTORE_APP */
IDXGISwapChain1 *dxgiswapChain; /* DXGI 1.2 swap chain */
IDXGISwapChain4 *dxgiswapChain4; /* DXGI 1.5 for HDR metadata */
+ DXGI_HDR_METADATA_HDR10 hdr10;
ID3D11RenderTargetView *swapchainTargetView[D3D11_MAX_RENDER_TARGET];
@@ -531,7 +532,12 @@ void LocalSwapchainSetMetadata( void *opaque, libvlc_video_metadata_type_t type,
hdr10.MaxMasteringLuminance = p_hdr10->MaxMasteringLuminance;
hdr10.MaxContentLightLevel = p_hdr10->MaxContentLightLevel;
hdr10.MaxFrameAverageLightLevel = p_hdr10->MaxFrameAverageLightLevel;
- IDXGISwapChain4_SetHDRMetaData( display->dxgiswapChain4, DXGI_HDR_METADATA_TYPE_HDR10, sizeof( hdr10 ), &hdr10 );
+ if (memcmp(&display->hdr10, &hdr10, sizeof(hdr10)))
+ {
+ memcpy(&display->hdr10, &hdr10, sizeof(hdr10));
+ IDXGISwapChain4_SetHDRMetaData( display->dxgiswapChain4, DXGI_HDR_METADATA_TYPE_HDR10,
+ sizeof( &display->hdr10 ), &display->hdr10 );
+ }
}
}
More information about the vlc-commits
mailing list