[vlc-commits] direct3d11: do not allow screen modes where we can't tone map

Steve Lhomme git at videolan.org
Fri Apr 6 11:18:47 CEST 2018


vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Apr  6 08:35:16 2018 +0200| [ae93ca7f97fab474993b0a84c323626caaecc6a1] | committer: Jean-Baptiste Kempf

direct3d11: do not allow screen modes where we can't tone map

Fixes #20234

(cherry picked from commit 3d14c31f374288a63fc3a9f0f4f375bebe374013)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=ae93ca7f97fab474993b0a84c323626caaecc6a1
---

 modules/video_output/win32/direct3d11.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index c4f8cc16a2..d2b6d63398 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -1372,6 +1372,19 @@ static const dxgi_color_space color_spaces[] = {
 #undef DXGIMAP
 };
 
+#ifdef HAVE_DXGI1_6_H
+static bool canHandleConversion(const dxgi_color_space *src, const dxgi_color_space *dst)
+{
+    if (src == dst)
+        return true;
+    if (src->primaries == COLOR_PRIMARIES_BT2020)
+        return true; /* we can convert BT2020 to 2020 or 709 */
+    if (dst->transfer == TRANSFER_FUNC_BT709)
+        return true; /* we can handle anything to 709 */
+    return false; /* let Windows do the rest */
+}
+#endif
+
 static void D3D11SetColorSpace(vout_display_t *vd)
 {
     vout_display_sys_t *sys = vd->sys;
@@ -1439,8 +1452,13 @@ static void D3D11SetColorSpace(vout_display_t *vd)
                 {
                     if (color_spaces[i].dxgi == desc1.ColorSpace)
                     {
-                        best = i;
-                        csp = &color_spaces[i];
+                        if (!canHandleConversion(&color_spaces[best], &color_spaces[i]))
+                            msg_Warn(vd, "Can't handle conversion to screen format %s", color_spaces[i].name);
+                        else
+                        {
+                            best = i;
+                            csp = &color_spaces[i];
+                        }
                         break;
                     }
                 }



More information about the vlc-commits mailing list