[vlc-commits] dxva: allow per-vendor HEVC black listing
Steve Lhomme
git at videolan.org
Mon Jun 25 17:59:02 CEST 2018
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Jun 25 15:20:57 2018 +0200| [9daba7a1f7f7c793fd36cbd5c0409c8b350c929c] | committer: Steve Lhomme
dxva: allow per-vendor HEVC black listing
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9daba7a1f7f7c793fd36cbd5c0409c8b350c929c
---
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 4f7e9b899b..9f78f15280 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -558,10 +558,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 6aa4160c1a..2c0b5940c5 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 1b52d1736a..fb5e6c6b89 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 @@ typedef struct
#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