[vlc-commits] direct3d11: log the current display format

Steve Lhomme git at videolan.org
Mon Oct 9 18:51:35 CEST 2017


vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Thu Sep 14 15:04:18 2017 +0200| [c2a659729ec56891317265ebb2d895addd6215ff] | committer: Jean-Baptiste Kempf

direct3d11: log the current display format

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 configure.ac                            |  2 +-
 modules/video_output/win32/direct3d11.c | 35 ++++++++++++++++++++++++++++++++-
 2 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 9ff35c7d87..442f74f159 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2486,7 +2486,7 @@ AM_CONDITIONAL([HAVE_AVCODEC_D3D11VA], [test "${have_avcodec_d3d11va}" = "yes"])
 dnl
 dnl DXGI debug
 dnl
-AC_CHECK_HEADERS(dxgidebug.h)
+AC_CHECK_HEADERS(dxgidebug.h dxgi1_6.h)
 
 dnl
 dnl  avformat demuxer/muxer plugin
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 7df452b70a..445c177135 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -40,7 +40,11 @@
 #define COBJMACROS
 #include <initguid.h>
 #include <d3d11.h>
-#include <dxgi1_5.h>
+#ifdef HAVE_DXGI1_6_H
+# include <dxgi1_6.h>
+#else
+# include <dxgi1_5.h>
+#endif
 #include <d3dcompiler.h>
 
 /* avoided until we can pass ISwapchainPanel without c++/cx mode
@@ -1504,6 +1508,7 @@ static void D3D11SetColorSpace(vout_display_t *vd)
     int best = -1;
     int score, best_score = 0;
     UINT support;
+    IDXGIOutput *dxgiOutput = NULL;
     IDXGISwapChain3 *dxgiswapChain3 = NULL;
     sys->display.colorspace = &color_spaces[0];
 
@@ -1580,6 +1585,34 @@ done:
 
     if (dxgiswapChain3)
         IDXGISwapChain3_Release(dxgiswapChain3);
+
+#ifdef HAVE_DXGI1_6_H
+    if (SUCCEEDED(IDXGISwapChain_GetContainingOutput( sys->dxgiswapChain, &dxgiOutput )))
+    {
+        IDXGIOutput6 *dxgiOutput6 = NULL;
+        if (SUCCEEDED(IDXGIOutput_QueryInterface( dxgiOutput, &IID_IDXGIOutput6, (void **)&dxgiOutput6 )))
+        {
+            DXGI_OUTPUT_DESC1 desc1;
+            if (SUCCEEDED(IDXGIOutput6_GetDesc1( dxgiOutput6, &desc1 )))
+            {
+                const dxgi_color_space *csp = NULL;
+                for (int i=0; color_spaces[i].name; ++i)
+                {
+                    if (color_spaces[i].dxgi == desc1.ColorSpace)
+                    {
+                        csp = &color_spaces[i];
+                        break;
+                    }
+                }
+
+                msg_Dbg(vd, "Output max luminance: %.1f, colorspace %s, bits per pixel %d", desc1.MaxFullFrameLuminance, csp?csp->name:"unknown", desc1.BitsPerColor);
+                sys->display.luminance_peak = desc1.MaxFullFrameLuminance;
+            }
+            IDXGIOutput6_Release( dxgiOutput6 );
+        }
+        IDXGIOutput_Release( dxgiOutput );
+    }
+#endif
 }
 
 static const d3d_format_t *GetDirectRenderingFormat(vout_display_t *vd, vlc_fourcc_t i_src_chroma)



More information about the vlc-commits mailing list