[vlc-commits] d3d11va: simplify the device logging

Steve Lhomme git at videolan.org
Thu Jun 13 15:09:59 CEST 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Jun 13 14:42:19 2019 +0200| [cc8be04c47440c06acb488ec3e64d87d4e64d616] | committer: Steve Lhomme

d3d11va: simplify the device logging

No need to allocate a string anymore.

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

 modules/codec/avcodec/d3d11va.c | 40 ++++++++++------------------------------
 1 file changed, 10 insertions(+), 30 deletions(-)

diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index c02844f0da..24c4db5066 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -129,7 +129,6 @@ struct vlc_va_sys_t
 /* */
 static int D3dCreateDevice(vlc_va_t *, const video_format_t *);
 static void D3dDestroyDevice(vlc_va_t *);
-static char *DxDescribe(vlc_va_sys_t *);
 
 static int DxCreateVideoService(vlc_va_t *);
 static void DxDestroyVideoService(vlc_va_t *);
@@ -396,11 +395,16 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
     if (err != VLC_SUCCESS)
         goto error;
 
-    /* TODO print the hardware name/vendor for debugging purposes */
-    char *desc = DxDescribe(sys);
-    if (desc != NULL) {
-        msg_Info(va, "Using %s", desc);
-        free(desc);
+    IDXGIAdapter *p_adapter = D3D11DeviceAdapter(sys->d3d_dev.d3ddevice);
+    if (p_adapter) {
+        char *description = NULL;
+        DXGI_ADAPTER_DESC adapterDesc;
+        if (SUCCEEDED(IDXGIAdapter_GetDesc(p_adapter, &adapterDesc))) {
+            msg_Info(va, "Using D3D11VA (%ls, vendor %x(%s), device %x, revision %x)",
+                        adapterDesc.Description,
+                        adapterDesc.VendorId, DxgiVendorStr(adapterDesc.VendorId), adapterDesc.DeviceId, adapterDesc.Revision));
+        }
+        IDXGIAdapter_Release(p_adapter);
     }
 
     ctx->hwaccel_context = &sys->hw;
@@ -475,30 +479,6 @@ static void D3dDestroyDevice(vlc_va_t *va)
 }
 
 /**
- * It describes our Direct3D object
- */
-static char *DxDescribe(vlc_va_sys_t *sys)
-{
-
-    IDXGIAdapter *p_adapter = D3D11DeviceAdapter(sys->d3d_dev.d3ddevice);
-    if (!p_adapter) {
-       return NULL;
-    }
-
-    char *description = NULL;
-    DXGI_ADAPTER_DESC adapterDesc;
-    if (SUCCEEDED(IDXGIAdapter_GetDesc(p_adapter, &adapterDesc))) {
-        if (asprintf(&description, "D3D11VA (%ls, vendor %x(%s), device %x, revision %x)",
-                     adapterDesc.Description,
-                     adapterDesc.VendorId, DxgiVendorStr(adapterDesc.VendorId), adapterDesc.DeviceId, adapterDesc.Revision) < 0)
-            description = NULL;
-    }
-
-    IDXGIAdapter_Release(p_adapter);
-    return description;
-}
-
-/**
  * It creates a DirectX video service
  */
 static int DxCreateVideoService(vlc_va_t *va)



More information about the vlc-commits mailing list