[vlc-commits] directx_va: disable Intel hybrid HEVC decoding by default

Steve Lhomme git at videolan.org
Thu Apr 19 09:54:35 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Apr 19 09:49:30 2018 +0200| [1bbc83770962e3674ead808de5882a72e44d2584] | committer: Steve Lhomme

directx_va: disable Intel hybrid HEVC decoding by default

GPUs with Intel Hybrid HEVC are the ones from the BroadWell family and is
causing decoding issues in 10 bits and 8 bits decoding.

If the HW decoder is forced it will be used anyway.

When blacklisted there is msg_Warn so that it's more visible to the user.

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

 modules/codec/avcodec/d3d11va.c    | 22 ++++++++++++----------
 modules/codec/avcodec/directx_va.c | 31 +++++++++++++++++++++++++++++++
 modules/codec/avcodec/directx_va.h |  1 +
 modules/codec/avcodec/dxva2.c      | 18 ++++++++----------
 4 files changed, 52 insertions(+), 20 deletions(-)

diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index 3aee0cd621..aa73b0ffe7 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -549,18 +549,20 @@ extern const GUID DXVA_ModeVP9_VLD_10bit_Profile2;
 static bool CanUseIntelHEVC(vlc_va_t *va)
 {
     vlc_va_sys_t *sys = va->sys;
-    /* it should be OK starting after driver 20.19.15.4835 */
-    struct wddm_version WDMM = {
-        .wddm         = 0,
-        .d3d_features = 0,
-        .revision     = 0,
-        .build        = 4836,
-    };
-    if (D3D11CheckDriverVersion(&sys->d3d_dev, GPU_MANUFACTURER_INTEL, &WDMM) == VLC_SUCCESS)
+    IDXGIAdapter *pAdapter = D3D11DeviceAdapter(sys->d3d_dev.d3ddevice);
+    if (!pAdapter)
+        return false;
+
+    DXGI_ADAPTER_DESC adapterDesc;
+    HRESULT hr = IDXGIAdapter_GetDesc(pAdapter, &adapterDesc);
+    IDXGIAdapter_Release(pAdapter);
+    if (FAILED(hr))
+        return false;
+
+    if (adapterDesc.VendorId != GPU_MANUFACTURER_INTEL)
         return true;
 
-    msg_Dbg(va, "HEVC not supported with these drivers");
-    return false;
+    return directx_va_canUseHevc( va, 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.c b/modules/codec/avcodec/directx_va.c
index 958ca783c0..fff547502a 100644
--- a/modules/codec/avcodec/directx_va.c
+++ b/modules/codec/avcodec/directx_va.c
@@ -451,3 +451,34 @@ static int FindVideoServiceConversion(vlc_va_t *va, directx_sys_t *dx_sys,
     p_list.pf_release(&p_list);
     return err;
 }
+
+static UINT hevc_blacklist[] = {
+    /* Intel Broadwell GPUs with hybrid HEVC */
+    0x1606, /* HD Graphics */
+    0x160E, /* HD Graphics */
+    0x1612, /* HD Graphics 5600 */
+    0x1616, /* HD Graphics 5500 */
+    0x161A, /* HD Graphics P5700 */
+    0x161E, /* HD Graphics 5300 */
+    0x1622, /* Iris Pro Graphics 6200 */
+    0x1626, /* HD Graphics 6000 */
+    0x162A, /* Iris Pro Graphics P6300 */
+    0x162B, /* Iris Graphics 6100 */
+};
+
+bool directx_va_canUseHevc(vlc_va_t *va, UINT DeviceId)
+{
+    if (va->obj.force)
+        return true;
+
+    for (size_t i=0; i<ARRAY_SIZE(hevc_blacklist); i++)
+    {
+        if (hevc_blacklist[i] == DeviceId)
+        {
+            msg_Warn(va, "Intel Hybrid HEVC detected, disabling hardware decoding");
+            return false;
+        }
+    }
+
+    return true;
+}
diff --git a/modules/codec/avcodec/directx_va.h b/modules/codec/avcodec/directx_va.h
index b8e62aa2c8..74c7443539 100644
--- a/modules/codec/avcodec/directx_va.h
+++ b/modules/codec/avcodec/directx_va.h
@@ -82,5 +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);
 
 #endif /* AVCODEC_DIRECTX_VA_H */
diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index 9131cdc8db..6ec00e3dcc 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -500,18 +500,16 @@ extern const GUID DXVA_ModeHEVC_VLD_Main10;
 static bool CanUseIntelHEVC(vlc_va_t *va)
 {
     vlc_va_sys_t *sys = va->sys;
-    /* it should be OK starting after driver 20.19.15.4835 */
-    struct wddm_version WDMM = {
-        .wddm         = 0,
-        .d3d_features = 0,
-        .revision     = 0,
-        .build        = 4836,
-    };
-    if (D3D9CheckDriverVersion(&sys->hd3d, &sys->d3d_dev, GPU_MANUFACTURER_INTEL, &WDMM) == VLC_SUCCESS)
+
+    D3DADAPTER_IDENTIFIER9 identifier;
+    HRESULT hr = IDirect3D9_GetAdapterIdentifier(sys->hd3d.obj, sys->d3d_dev.adapterId, 0, &identifier);
+    if (FAILED(hr))
+        return false;
+
+    if (identifier.VendorId != GPU_MANUFACTURER_INTEL)
         return true;
 
-    msg_Dbg(va, "HEVC not supported with these drivers");
-    return false;
+    return directx_va_canUseHevc( va, identifier.DeviceId );
 }
 
 static int DxSetupOutput(vlc_va_t *va, const GUID *input, const video_format_t *fmt)



More information about the vlc-commits mailing list