[vlc-commits] direct3d9: add more logs about possible format selection issues

Steve Lhomme git at videolan.org
Thu Mar 12 08:23:13 CET 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Mar 12 08:22:35 2020 +0100| [15db7dfc6c6115868dd5223805ec4e7d24f36819] | committer: Steve Lhomme

direct3d9: add more logs about possible format selection issues

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

 modules/video_output/win32/direct3d9.c | 33 ++++++++++++++++++++++++++++-----
 1 file changed, 28 insertions(+), 5 deletions(-)

diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index 63ef60b311..a66c442375 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -366,6 +366,15 @@ static int Direct3D9ImportPicture(vout_display_t *vd,
         inputStream.Enable = TRUE;
         inputStream.pInputSurface = source;
         hr = IDXVAHD_VideoProcessor_VideoProcessBltHD( sys->processor.proc, destination, 0, 1, &inputStream );
+        if (FAILED(hr)) {
+            D3DSURFACE_DESC srcDesc, dstDesc;
+            IDirect3DSurface9_GetDesc(source, &srcDesc);
+            IDirect3DSurface9_GetDesc(destination, &dstDesc);
+
+            msg_Dbg(vd, "Failed VideoProcessBltHD src:%4.4s (%d) dst:%4.4s (%d) (hr=0x%lX)",
+                    (const char*)&srcDesc.Format, srcDesc.Format,
+                    (const char*)&dstDesc.Format, dstDesc.Format, hr);
+        }
     }
     else
     {
@@ -400,13 +409,14 @@ static int Direct3D9ImportPicture(vout_display_t *vd,
         hr = IDirect3DDevice9_StretchRect(sys->d3d9_device->d3ddev.dev, source, &source_visible_rect,
                                         destination, &texture_visible_rect,
                                         D3DTEXF_NONE);
+        if (FAILED(hr)) {
+            msg_Dbg(vd, "Failed StretchRect: source 0x%p. (hr=0x%lX)",
+                    (LPVOID)source, hr);
+        }
     }
     IDirect3DSurface9_Release(destination);
-    if (FAILED(hr)) {
-        msg_Dbg(vd, "Failed StretchRect: source 0x%p 0x%lX",
-                (LPVOID)source, hr);
+    if (FAILED(hr))
         return VLC_EGENERIC;
-    }
 
     /* */
     region->texture = sys->sceneTexture;
@@ -1480,8 +1490,11 @@ static int InitRangeProcessor(vout_display_t *vd, const d3d9_format_t *d3dfmt,
     HRESULT hr;
 
     sys->processor.dll = LoadLibrary(TEXT("DXVA2.DLL"));
-    if (!sys->processor.dll)
+    if (unlikely(!sys->processor.dll))
+    {
+        msg_Err(vd, "Failed to load DXVA2.DLL");
         return VLC_EGENERIC;
+    }
 
     D3DFORMAT *formatsList = NULL;
     DXVAHD_VPCAPS *capsList = NULL;
@@ -1526,7 +1539,10 @@ static int InitRangeProcessor(vout_display_t *vd, const d3d9_format_t *d3dfmt,
 
     formatsList = malloc(devcaps.InputFormatCount * sizeof(*formatsList));
     if (unlikely(formatsList == NULL))
+    {
+        msg_Dbg(vd, "Failed to allocate %u input formats", devcaps.InputFormatCount);
         goto error;
+    }
 
     hr = IDXVAHD_Device_GetVideoProcessorInputFormats( hd_device, devcaps.InputFormatCount, formatsList);
     UINT i;
@@ -1544,7 +1560,10 @@ static int InitRangeProcessor(vout_display_t *vd, const d3d9_format_t *d3dfmt,
     free(formatsList);
     formatsList = malloc(devcaps.OutputFormatCount * sizeof(*formatsList));
     if (unlikely(formatsList == NULL))
+    {
+        msg_Dbg(vd, "Failed to allocate %u output formats", devcaps.OutputFormatCount);
         goto error;
+    }
 
     hr = IDXVAHD_Device_GetVideoProcessorOutputFormats( hd_device, devcaps.OutputFormatCount, formatsList);
     for (i=0; i<devcaps.OutputFormatCount; i++)
@@ -1560,7 +1579,10 @@ static int InitRangeProcessor(vout_display_t *vd, const d3d9_format_t *d3dfmt,
 
     capsList = malloc(devcaps.VideoProcessorCount * sizeof(*capsList));
     if (unlikely(capsList == NULL))
+    {
+        msg_Dbg(vd, "Failed to allocate %u video processors", devcaps.VideoProcessorCount);
         goto error;
+    }
     hr = IDXVAHD_Device_GetVideoProcessorCaps( hd_device, devcaps.VideoProcessorCount, capsList);
     if (FAILED(hr))
     {
@@ -1625,6 +1647,7 @@ static int Direct3D9Open(vout_display_t *vd, video_format_t *fmt, vlc_video_cont
              sys->d3d9_device->d3ddev.identifier.VendorId == GPU_MANUFACTURER_NVIDIA)
     {
         // NVIDIA bug, YUV to RGB internal conversion in StretchRect always converts from limited to limited range
+        msg_Dbg(vd, "Try to init DXVA-HD processor from %s to %s", d3dfmt->name, dst_format->name);
         InitRangeProcessor( vd, d3dfmt, &render_out );
     }
 



More information about the vlc-commits mailing list