[vlc-commits] dxva: allow blacklisting based on the driver build

Steve Lhomme git at videolan.org
Mon Jun 25 17:59:05 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Jun 25 17:36:35 2018 +0200| [33cc4f2b1f9dace2b3a63098a458f3172fc6ae41] | committer: Steve Lhomme

dxva: allow blacklisting based on the driver build

Not used for now.

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

 modules/codec/avcodec/d3d11va.c        |  3 +-
 modules/codec/avcodec/directx_va.h     |  2 +-
 modules/codec/avcodec/dxva2.c          |  9 +++-
 modules/codec/avcodec/dxva_blacklist.c | 76 ++++++++++++++++++++--------------
 4 files changed, 56 insertions(+), 34 deletions(-)

diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index 95230bbe08..7244c29d88 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -570,7 +570,8 @@ static int DxSetupOutput(vlc_va_t *va, const GUID *input, const video_format_t *
     if (FAILED(hr))
         return VLC_EGENERIC;
 
-    if (!directx_va_canUseDecoder(va, adapterDesc.VendorId, adapterDesc.DeviceId, input))
+    if (!directx_va_canUseDecoder(va, adapterDesc.VendorId, adapterDesc.DeviceId,
+                                  input, sys->d3d_dev.WDDM.build))
     {
         msg_Warn(va, "GPU blacklisted for %s codec", directx_va_GetDecoderName(input));
         return VLC_EGENERIC;
diff --git a/modules/codec/avcodec/directx_va.h b/modules/codec/avcodec/directx_va.h
index 5e72f2188a..335cca7bd3 100644
--- a/modules/codec/avcodec/directx_va.h
+++ b/modules/codec/avcodec/directx_va.h
@@ -82,6 +82,6 @@ int directx_va_Open(vlc_va_t *, directx_sys_t *);
 void directx_va_Close(vlc_va_t *, directx_sys_t *);
 int directx_va_Setup(vlc_va_t *, directx_sys_t *, const AVCodecContext *avctx, const es_format_t *, int flag_xbox);
 char *directx_va_GetDecoderName(const GUID *guid);
-bool directx_va_canUseDecoder(vlc_va_t *, UINT VendorId, UINT DeviceId, const GUID *pCodec);
+bool directx_va_canUseDecoder(vlc_va_t *, UINT VendorId, UINT DeviceId, const GUID *pCodec, UINT driverBuild);
 
 #endif /* AVCODEC_DIRECTX_VA_H */
diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index e410f54097..e02295858c 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -505,7 +505,14 @@ static int DxSetupOutput(vlc_va_t *va, const GUID *input, const video_format_t *
     if (FAILED(hr))
         return VLC_EGENERIC;
 
-    if (!directx_va_canUseDecoder(va, identifier.VendorId, identifier.DeviceId, input))
+    UINT driverBuild = identifier.DriverVersion.LowPart & 0xFFFF;
+    if (identifier.VendorId == GPU_MANUFACTURER_INTEL && (identifier.DriverVersion.LowPart >> 16) >= 100)
+    {
+        /* new Intel driver format */
+        driverBuild += ((identifier.DriverVersion.LowPart >> 16) - 100) * 1000;
+    }
+    if (!directx_va_canUseDecoder(va, identifier.VendorId, identifier.DeviceId,
+                                  input, driverBuild))
     {
         msg_Warn(va, "GPU blacklisted for %s codec", directx_va_GetDecoderName(input));
         return VLC_EGENERIC;
diff --git a/modules/codec/avcodec/dxva_blacklist.c b/modules/codec/avcodec/dxva_blacklist.c
index 159c44b573..698aece161 100644
--- a/modules/codec/avcodec/dxva_blacklist.c
+++ b/modules/codec/avcodec/dxva_blacklist.c
@@ -43,9 +43,16 @@ typedef struct
 extern const GUID DXVA_ModeHEVC_VLD_Main;
 extern const GUID DXVA_ModeHEVC_VLD_Main10;
 
+enum DriverTestCommand {
+    BLAnyDriver,
+    BLBelowBuild, /* driverBuild is the first driver version known to work */
+};
+
 struct decoders {
     const UINT deviceID;
     const GUID **decoder_list;
+    const enum DriverTestCommand cmd;
+    const UINT driverBuild;
 };
 
 static const GUID *NoHEVC[] = {
@@ -56,35 +63,36 @@ static const GUID *NoHEVC[] = {
 
 static struct decoders IntelDevices[] = {
     /* Intel Broadwell GPUs with hybrid HEVC */
-    { 0x1606, NoHEVC }, /* HD Graphics */
-    { 0x160E, NoHEVC }, /* HD Graphics */
-    { 0x1612, NoHEVC }, /* HD Graphics 5600 */
-    { 0x1616, NoHEVC }, /* HD Graphics 5500 */
-    { 0x161A, NoHEVC }, /* HD Graphics P5700 */
-    { 0x161E, NoHEVC }, /* HD Graphics 5300 */
-    { 0x1622, NoHEVC }, /* Iris Pro Graphics 6200 */
-    { 0x1626, NoHEVC }, /* HD Graphics 6000 */
-    { 0x162A, NoHEVC }, /* Iris Pro Graphics P6300 */
-    { 0x162B, NoHEVC }, /* Iris Graphics 6100 */
-
-    { 0x0402, NoHEVC }, /* HD Graphics */
-    { 0x0406, NoHEVC }, /* HD Graphics */
-    { 0x040A, NoHEVC }, /* HD Graphics */
-    { 0x0412, NoHEVC }, /* HD Graphics 4600 */
-    { 0x0416, NoHEVC }, /* HD Graphics 4600 */
-    { 0x041E, NoHEVC }, /* HD Graphics 4400 */
-    { 0x041A, NoHEVC }, /* HD Graphics P4600/P4700 */
-
-    { 0x0A06, NoHEVC }, /* HD Graphics */
-    { 0x0A0E, NoHEVC }, /* HD Graphics */
-    { 0x0A16, NoHEVC }, /* HD Graphics Family */
-    { 0x0A1E, NoHEVC }, /* HD Graphics Family */
-    { 0x0A26, NoHEVC }, /* HD Graphics 5000 */
-    { 0x0A2E, NoHEVC }, /* Iris(TM) Graphics 5100 */
-
-    { 0x0D22, NoHEVC }, /* Iris(TM) Pro Graphics 5200 */
-    { 0x0D26, NoHEVC }, /* Iris(TM) Pro Graphics 5200 */
-    {0, NULL}
+    { 0x1606, NoHEVC, BLAnyDriver, 0 }, /* HD Graphics */
+    { 0x160E, NoHEVC, BLAnyDriver, 0 }, /* HD Graphics */
+    { 0x1612, NoHEVC, BLAnyDriver, 0 }, /* HD Graphics 5600 */
+    { 0x1616, NoHEVC, BLAnyDriver, 0 }, /* HD Graphics 5500 */
+    { 0x161A, NoHEVC, BLAnyDriver, 0 }, /* HD Graphics P5700 */
+    { 0x161E, NoHEVC, BLAnyDriver, 0 }, /* HD Graphics 5300 */
+    { 0x1622, NoHEVC, BLAnyDriver, 0 }, /* Iris Pro Graphics 6200 */
+    { 0x1626, NoHEVC, BLAnyDriver, 0 }, /* HD Graphics 6000 */
+    { 0x162A, NoHEVC, BLAnyDriver, 0 }, /* Iris Pro Graphics P6300 */
+    { 0x162B, NoHEVC, BLAnyDriver, 0 }, /* Iris Graphics 6100 */
+
+    { 0x0402, NoHEVC, BLAnyDriver, 0 }, /* HD Graphics */
+    { 0x0406, NoHEVC, BLAnyDriver, 0 }, /* HD Graphics */
+    { 0x040A, NoHEVC, BLAnyDriver, 0 }, /* HD Graphics */
+    { 0x0412, NoHEVC, BLAnyDriver, 0 }, /* HD Graphics 4600 */
+    { 0x0416, NoHEVC, BLAnyDriver, 0 }, /* HD Graphics 4600 */
+    { 0x041E, NoHEVC, BLAnyDriver, 0 }, /* HD Graphics 4400 */
+    { 0x041A, NoHEVC, BLAnyDriver, 0 }, /* HD Graphics P4600/P4700 */
+
+    { 0x0A06, NoHEVC, BLAnyDriver, 0 }, /* HD Graphics */
+    { 0x0A0E, NoHEVC, BLAnyDriver, 0 }, /* HD Graphics */
+    { 0x0A16, NoHEVC, BLAnyDriver, 0 }, /* HD Graphics Family */
+    { 0x0A1E, NoHEVC, BLAnyDriver, 0 }, /* HD Graphics Family */
+    { 0x0A26, NoHEVC, BLAnyDriver, 0 }, /* HD Graphics 5000 */
+    { 0x0A2E, NoHEVC, BLAnyDriver, 0 }, /* Iris(TM) Graphics 5100 */
+
+    { 0x0D22, NoHEVC, BLAnyDriver, 0 }, /* Iris(TM) Pro Graphics 5200 */
+    { 0x0D26, NoHEVC, BLAnyDriver, 0 }, /* Iris(TM) Pro Graphics 5200 */
+
+    {0, NULL, BLAnyDriver, 0}
 };
 
 static struct {
@@ -94,7 +102,7 @@ static struct {
     { .vendor = GPU_MANUFACTURER_INTEL, .devices = IntelDevices },
 };
 
-bool directx_va_canUseDecoder(vlc_va_t *va, UINT VendorId, UINT DeviceId, const GUID *pCodec)
+bool directx_va_canUseDecoder(vlc_va_t *va, UINT VendorId, UINT DeviceId, const GUID *pCodec, UINT driverBuild)
 {
     if (va->obj.force)
         return true;
@@ -112,7 +120,13 @@ bool directx_va_canUseDecoder(vlc_va_t *va, UINT VendorId, UINT DeviceId, const
                     while (*pGuid != NULL)
                     {
                         if (IsEqualGUID(pCodec, *pGuid))
-                            return false;
+                        {
+                            if (pDevice->cmd == BLAnyDriver)
+                                return false;
+                            if (pDevice->cmd == BLBelowBuild && driverBuild < pDevice->driverBuild)
+                                return false;
+                            break;
+                        }
                         pGuid++;
                     }
                     return true;



More information about the vlc-commits mailing list