[vlc-commits] dxva: allow per-vendor HEVC black listing

Steve Lhomme git at videolan.org
Tue Aug 7 09:12:56 CEST 2018


vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Jun 25 15:20:57 2018 +0200| [cc7d112d68fc73a415857898d77958c343ec0e1e] | committer: Steve Lhomme

dxva: allow per-vendor HEVC black listing

(cherry picked from commit 9daba7a1f7f7c793fd36cbd5c0409c8b350c929c)

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

 modules/codec/avcodec/d3d11va.c        |  5 +----
 modules/codec/avcodec/directx_va.h     |  2 +-
 modules/codec/avcodec/dxva2.c          |  5 +----
 modules/codec/avcodec/dxva_blacklist.c | 29 ++++++++++++++++++++++++-----
 4 files changed, 27 insertions(+), 14 deletions(-)

diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index 5ab8fd2b8b..ad742a487c 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -557,10 +557,7 @@ static bool CanUseIntelHEVC(vlc_va_t *va)
     if (FAILED(hr))
         return false;
 
-    if (adapterDesc.VendorId != GPU_MANUFACTURER_INTEL)
-        return true;
-
-    return directx_va_canUseHevc( va, adapterDesc.DeviceId );
+    return directx_va_canUseHevc( va, adapterDesc.VendorId, adapterDesc.DeviceId );
 }
 
 static int DxSetupOutput(vlc_va_t *va, const GUID *input, const video_format_t *fmt)
diff --git a/modules/codec/avcodec/directx_va.h b/modules/codec/avcodec/directx_va.h
index 74c7443539..635d8e6eb6 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_canUseHevc(vlc_va_t *, UINT DeviceId);
+bool directx_va_canUseHevc(vlc_va_t *, UINT VendorId, UINT DeviceId);
 
 #endif /* AVCODEC_DIRECTX_VA_H */
diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index 6ec00e3dcc..eba36a8b14 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -506,10 +506,7 @@ static bool CanUseIntelHEVC(vlc_va_t *va)
     if (FAILED(hr))
         return false;
 
-    if (identifier.VendorId != GPU_MANUFACTURER_INTEL)
-        return true;
-
-    return directx_va_canUseHevc( va, identifier.DeviceId );
+    return directx_va_canUseHevc( va, identifier.VendorId, identifier.DeviceId );
 }
 
 static int DxSetupOutput(vlc_va_t *va, const GUID *input, const video_format_t *fmt)
diff --git a/modules/codec/avcodec/dxva_blacklist.c b/modules/codec/avcodec/dxva_blacklist.c
index bf8b5ccf46..b7abcf3e3d 100644
--- a/modules/codec/avcodec/dxva_blacklist.c
+++ b/modules/codec/avcodec/dxva_blacklist.c
@@ -27,6 +27,8 @@
 #include <vlc_codecs.h>
 #include <vlc_codec.h>
 
+#include "../../video_chroma/dxgi_fmt.h"
+
 #define D3D_DecoderType     IUnknown
 #define D3D_DecoderDevice   IUnknown
 #define D3D_DecoderSurface  IUnknown
@@ -38,7 +40,7 @@ struct picture_sys_t
 
 #include "directx_va.h"
 
-static UINT hevc_blacklist[] = {
+static UINT IntelDevices[] = {
     /* Intel Broadwell GPUs with hybrid HEVC */
     0x1606, /* HD Graphics */
     0x160E, /* HD Graphics */
@@ -68,19 +70,36 @@ static UINT hevc_blacklist[] = {
 
     0x0D22, /* Iris(TM) Pro Graphics 5200 */
     0x0D26, /* Iris(TM) Pro Graphics 5200 */
+    0
+};
+
+static struct {
+    UINT vendor;
+    const UINT *devices;
+} hevc_blacklist[] = {
+    { .vendor = GPU_MANUFACTURER_INTEL, .devices = IntelDevices },
 };
 
-bool directx_va_canUseHevc(vlc_va_t *va, UINT DeviceId)
+bool directx_va_canUseHevc(vlc_va_t *va, UINT VendorId, UINT DeviceId)
 {
     if (va->obj.force)
         return true;
 
     for (size_t i=0; i<ARRAY_SIZE(hevc_blacklist); i++)
     {
-        if (hevc_blacklist[i] == DeviceId)
+        if (hevc_blacklist[i].vendor == VendorId)
         {
-            msg_Warn(va, "Intel Hybrid HEVC detected, disabling hardware decoding");
-            return false;
+            const UINT *pDevice = hevc_blacklist[i].devices;
+            while (*pDevice != 0)
+            {
+                if (*pDevice == DeviceId)
+                {
+                    msg_Warn(va, "Intel Hybrid HEVC detected, disabling hardware decoding");
+                    return false;
+                }
+                pDevice++;
+            }
+            break;
         }
     }
 



More information about the vlc-commits mailing list