[vlc-devel] [PATCH 1/4] d3d11: use defines for the manufacturer IDs

Steve Lhomme robux4 at videolabs.io
Thu Nov 30 17:44:37 CET 2017


---
 modules/codec/avcodec/d3d11va.c         | 15 ++++++++-------
 modules/video_chroma/d3d11_fmt.c        |  5 ++---
 modules/video_chroma/d3d11_fmt.h        |  8 ++++++++
 modules/video_output/win32/direct3d11.c |  2 +-
 4 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index 8596119b58..96f479963f 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -441,6 +441,7 @@ static void D3dDestroyDevice(vlc_va_t *va)
         ID3D11VideoContext_Release(sys->d3dvidctx);
     D3D11_ReleaseDevice( &sys->d3d_dev );
 }
+
 /**
  * It describes our Direct3D object
  */
@@ -450,12 +451,12 @@ static char *DxDescribe(vlc_va_sys_t *sys)
         unsigned id;
         char     name[32];
     } vendors [] = {
-        { 0x1002, "ATI" },
-        { 0x10DE, "NVIDIA" },
-        { 0x1106, "VIA" },
-        { 0x8086, "Intel" },
-        { 0x5333, "S3 Graphics" },
-        { 0x4D4F4351, "Qualcomm" },
+        { GPU_MANUFACTURER_AMD,      "ATI"         },
+        { GPU_MANUFACTURER_NVIDIA,   "NVIDIA"      },
+        { GPU_MANUFACTURER_VIA,      "VIA"         },
+        { GPU_MANUFACTURER_INTEL,    "Intel"       },
+        { GPU_MANUFACTURER_S3,       "S3 Graphics" },
+        { GPU_MANUFACTURER_QUALCOMM, "Qualcomm"    },
         { 0, "" }
     };
 
@@ -663,7 +664,7 @@ static bool CanUseDecoderPadding(vlc_va_sys_t *sys)
 
     /* Qualcomm hardware has issues with textures and pixels that should not be
     * part of the decoded area */
-    return adapterDesc.VendorId != 0x4D4F4351;
+    return adapterDesc.VendorId != GPU_MANUFACTURER_QUALCOMM;
 }
 
 /**
diff --git a/modules/video_chroma/d3d11_fmt.c b/modules/video_chroma/d3d11_fmt.c
index f9b4130ee7..1eb71b502c 100644
--- a/modules/video_chroma/d3d11_fmt.c
+++ b/modules/video_chroma/d3d11_fmt.c
@@ -271,9 +271,8 @@ bool isNvidiaHardware(ID3D11Device *d3ddev)
 
     bool result = false;
     DXGI_ADAPTER_DESC adapterDesc;
-    if (SUCCEEDED(IDXGIAdapter_GetDesc(p_adapter, &adapterDesc))) {
-        result = adapterDesc.VendorId == 0x10DE;
-    }
+    if (SUCCEEDED(IDXGIAdapter_GetDesc(p_adapter, &adapterDesc)))
+        result = adapterDesc.VendorId == GPU_MANUFACTURER_NVIDIA;
 
     IDXGIAdapter_Release(p_adapter);
     return result;
diff --git a/modules/video_chroma/d3d11_fmt.h b/modules/video_chroma/d3d11_fmt.h
index 277c3f8462..867084d736 100644
--- a/modules/video_chroma/d3d11_fmt.h
+++ b/modules/video_chroma/d3d11_fmt.h
@@ -97,6 +97,14 @@ int D3D11_Create(vlc_object_t *, d3d11_handle_t *);
 
 void D3D11_Destroy(d3d11_handle_t *);
 
+#define GPU_MANUFACTURER_AMD           0x1002
+#define GPU_MANUFACTURER_NVIDIA        0x10DE
+#define GPU_MANUFACTURER_VIA           0x1106
+#define GPU_MANUFACTURER_INTEL         0x8086
+#define GPU_MANUFACTURER_S3            0x5333
+#define GPU_MANUFACTURER_QUALCOMM  0x4D4F4351
+
+
 bool isXboxHardware(ID3D11Device *d3ddev);
 bool isNvidiaHardware(ID3D11Device *d3ddev);
 IDXGIAdapter *D3D11DeviceAdapter(ID3D11Device *d3ddev);
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 3136294138..d10c95999b 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -1978,7 +1978,7 @@ static bool CanUseTextureArray(vout_display_t *vd)
         return false;
 
     /* ATI/AMD hardware has issues with pixel shaders with Texture2DArray */
-    if (adapterDesc.VendorId != 0x1002)
+    if (adapterDesc.VendorId != GPU_MANUFACTURER_AMD)
         return true;
 
 #if !VLC_WINSTORE_APP
-- 
2.14.2



More information about the vlc-devel mailing list