[vlc-devel] [PATCH 1/4] d3d11: move the processor input/output support logging in libd3d11_common

Steve Lhomme robux4 at videolabs.io
Wed Nov 22 11:03:34 CET 2017


---
 modules/video_chroma/d3d11_fmt.c               | 18 ++++++++++++++++++
 modules/video_chroma/d3d11_fmt.h               |  5 +++++
 modules/video_chroma/d3d11_surface.c           |  8 +-------
 modules/video_output/win32/d3d11_adjust.c      |  8 +-------
 modules/video_output/win32/d3d11_deinterlace.c |  8 +-------
 5 files changed, 26 insertions(+), 21 deletions(-)

diff --git a/modules/video_chroma/d3d11_fmt.c b/modules/video_chroma/d3d11_fmt.c
index 8caeade34a..ff9f5a5a7e 100644
--- a/modules/video_chroma/d3d11_fmt.c
+++ b/modules/video_chroma/d3d11_fmt.c
@@ -466,3 +466,21 @@ void D3D11_Destroy(d3d11_handle_t *hd3d)
 #endif
 #endif
 }
+
+#ifndef NDEBUG
+#undef D3D11_LogProcessorSupport
+void D3D11_LogProcessorSupport(vlc_object_t *o,
+                               ID3D11VideoProcessorEnumerator *processorEnumerator)
+{
+    UINT flags;
+    HRESULT hr;
+    for (int format = 0; format < 188; format++) {
+        hr = ID3D11VideoProcessorEnumerator_CheckVideoProcessorFormat(processorEnumerator, format, &flags);
+        if (SUCCEEDED(hr) && (flags & D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT_INPUT))
+            msg_Dbg(o, "processor format %s (%d) is supported for input", DxgiFormatToStr(format),format);
+        if (SUCCEEDED(hr) && (flags & D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT_OUTPUT))
+            msg_Dbg(o, "processor format %s (%d) is supported for output", DxgiFormatToStr(format),format);
+    }
+}
+
+#endif
diff --git a/modules/video_chroma/d3d11_fmt.h b/modules/video_chroma/d3d11_fmt.h
index 9ed889edf9..277c3f8462 100644
--- a/modules/video_chroma/d3d11_fmt.h
+++ b/modules/video_chroma/d3d11_fmt.h
@@ -120,4 +120,9 @@ int AllocateTextures(vlc_object_t *obj, d3d11_device_t *d3d_dev,
                      const d3d_format_t *cfg, const video_format_t *fmt,
                      unsigned pool_size, ID3D11Texture2D *textures[]);
 
+#ifndef NDEBUG
+void D3D11_LogProcessorSupport(vlc_object_t*, ID3D11VideoProcessorEnumerator*);
+#define D3D11_LogProcessorSupport(a,b) D3D11_LogProcessorSupport( VLC_OBJECT(a), b )
+#endif
+
 #endif /* include-guard */
diff --git a/modules/video_chroma/d3d11_surface.c b/modules/video_chroma/d3d11_surface.c
index aeb5f432bb..1bdd22c0f7 100644
--- a/modules/video_chroma/d3d11_surface.c
+++ b/modules/video_chroma/d3d11_surface.c
@@ -116,13 +116,7 @@ static int SetupProcessor(filter_t *p_filter, ID3D11Device *d3ddevice,
 
     UINT flags;
 #ifndef NDEBUG
-    for (int format = 0; format < 188; format++) {
-        hr = ID3D11VideoProcessorEnumerator_CheckVideoProcessorFormat(processorEnumerator, format, &flags);
-        if (SUCCEEDED(hr) && (flags & D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT_INPUT))
-            msg_Dbg(p_filter, "processor format %s (%d) is supported for input", DxgiFormatToStr(format),format);
-        if (SUCCEEDED(hr) && (flags & D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT_OUTPUT))
-            msg_Dbg(p_filter, "processor format %s (%d) is supported for output", DxgiFormatToStr(format),format);
-    }
+    D3D11_LogProcessorSupport(p_filter, processorEnumerator);
 #endif
     /* shortcut for the rendering output */
     hr = ID3D11VideoProcessorEnumerator_CheckVideoProcessorFormat(processorEnumerator, srcFormat, &flags);
diff --git a/modules/video_output/win32/d3d11_adjust.c b/modules/video_output/win32/d3d11_adjust.c
index ea2e7ea1be..894ff78927 100644
--- a/modules/video_output/win32/d3d11_adjust.c
+++ b/modules/video_output/win32/d3d11_adjust.c
@@ -378,13 +378,7 @@ static int Open(vlc_object_t *obj)
 
     UINT flags;
 #ifndef NDEBUG
-    for (int format = 0; format < 188; format++) {
-        hr = ID3D11VideoProcessorEnumerator_CheckVideoProcessorFormat(processorEnumerator, format, &flags);
-        if (SUCCEEDED(hr) && (flags & D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT_INPUT))
-            msg_Dbg(filter, "processor format %s (%d) is supported for input", DxgiFormatToStr(format),format);
-        if (SUCCEEDED(hr) && (flags & D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT_OUTPUT))
-            msg_Dbg(filter, "processor format %s (%d) is supported for output", DxgiFormatToStr(format),format);
-    }
+    D3D11_LogProcessorSupport(filter, processorEnumerator);
 #endif
     hr = ID3D11VideoProcessorEnumerator_CheckVideoProcessorFormat(processorEnumerator, dst->p_sys->formatTexture, &flags);
     if (!SUCCEEDED(hr))
diff --git a/modules/video_output/win32/d3d11_deinterlace.c b/modules/video_output/win32/d3d11_deinterlace.c
index 438c4b836e..b68158b38e 100644
--- a/modules/video_output/win32/d3d11_deinterlace.c
+++ b/modules/video_output/win32/d3d11_deinterlace.c
@@ -360,13 +360,7 @@ static int Open(vlc_object_t *obj)
 
     UINT flags;
 #ifndef NDEBUG
-    for (int format = 0; format < 188; format++) {
-        hr = ID3D11VideoProcessorEnumerator_CheckVideoProcessorFormat(processorEnumerator, format, &flags);
-        if (SUCCEEDED(hr) && (flags & D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT_INPUT))
-            msg_Dbg(filter, "processor format %s (%d) is supported for input", DxgiFormatToStr(format),format);
-        if (SUCCEEDED(hr) && (flags & D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT_OUTPUT))
-            msg_Dbg(filter, "processor format %s (%d) is supported for output", DxgiFormatToStr(format),format);
-    }
+    D3D11_LogProcessorSupport(filter, processorEnumerator);
 #endif
     hr = ID3D11VideoProcessorEnumerator_CheckVideoProcessorFormat(processorEnumerator, dst->p_sys->formatTexture, &flags);
     if (!SUCCEEDED(hr))
-- 
2.14.2



More information about the vlc-devel mailing list