[vlc-commits] avcodec: add a specific source file to handle GPU blacklisting

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


vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Jun 25 15:00:37 2018 +0200| [9b2310cfd092fa0bd63a77824d934655990633eb] | committer: Steve Lhomme

avcodec: add a specific source file to handle GPU blacklisting

(cherry picked from commit ec1313ce0a5a5b9c54f0fa94d0d11afe06de4a0e)

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

 modules/codec/Makefile.am              |  6 ++-
 modules/codec/avcodec/directx_va.c     | 49 -------------------
 modules/codec/avcodec/dxva_blacklist.c | 88 ++++++++++++++++++++++++++++++++++
 3 files changed, 92 insertions(+), 51 deletions(-)

diff --git a/modules/codec/Makefile.am b/modules/codec/Makefile.am
index 10132a92f3..6a534c259a 100644
--- a/modules/codec/Makefile.am
+++ b/modules/codec/Makefile.am
@@ -432,7 +432,8 @@ libdxva2_plugin_la_SOURCES = \
 	codec/avcodec/dxva2.c codec/avcodec/directx_va.c codec/avcodec/directx_va.h \
 	codec/avcodec/va_surface.c codec/avcodec/va_surface.h codec/avcodec/va_surface_internal.h \
 	packetizer/h264_nal.c packetizer/h264_nal.h \
-	packetizer/hevc_nal.c packetizer/hevc_nal.h
+	packetizer/hevc_nal.c packetizer/hevc_nal.h \
+	codec/avcodec/dxva_blacklist.c
 libdxva2_plugin_la_LIBADD = libd3d9_common.la $(LIBCOM) -lshlwapi -luuid
 if HAVE_AVCODEC_DXVA2
 codec_LTLIBRARIES += libdxva2_plugin.la
@@ -449,7 +450,8 @@ libd3d11va_plugin_la_SOURCES = \
 	codec/avcodec/d3d11va.c codec/avcodec/directx_va.c codec/avcodec/directx_va.h \
         codec/avcodec/va_surface.c codec/avcodec/va_surface.h codec/avcodec/va_surface_internal.h \
 	packetizer/h264_nal.c packetizer/h264_nal.h \
-	packetizer/hevc_nal.c packetizer/hevc_nal.h
+	packetizer/hevc_nal.c packetizer/hevc_nal.h \
+	codec/avcodec/dxva_blacklist.c
 libd3d11va_plugin_la_LIBADD = libd3d11_common.la $(LIBCOM) -luuid
 if HAVE_WINSTORE
 libd3d11va_plugin_la_LIBADD += -ld3d11
diff --git a/modules/codec/avcodec/directx_va.c b/modules/codec/avcodec/directx_va.c
index fc5b88c28c..9de31587e3 100644
--- a/modules/codec/avcodec/directx_va.c
+++ b/modules/codec/avcodec/directx_va.c
@@ -447,52 +447,3 @@ 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 */
-
-    0x0402, /* HD Graphics */
-    0x0406, /* HD Graphics */
-    0x040A, /* HD Graphics */
-    0x0412, /* HD Graphics 4600 */
-    0x0416, /* HD Graphics 4600 */
-    0x041E, /* HD Graphics 4400 */
-    0x041A, /* HD Graphics P4600/P4700 */
-
-    0x0A06, /* HD Graphics */
-    0x0A0E, /* HD Graphics */
-    0x0A16, /* HD Graphics Family */
-    0x0A1E, /* HD Graphics Family */
-    0x0A26, /* HD Graphics 5000 */
-    0x0A2E, /* Iris(TM) Graphics 5100 */
-
-    0x0D22, /* Iris(TM) Pro Graphics 5200 */
-    0x0D26, /* Iris(TM) Pro Graphics 5200 */
-};
-
-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/dxva_blacklist.c b/modules/codec/avcodec/dxva_blacklist.c
new file mode 100644
index 0000000000..bf8b5ccf46
--- /dev/null
+++ b/modules/codec/avcodec/dxva_blacklist.c
@@ -0,0 +1,88 @@
+/*****************************************************************************
+ * directx_va.c: DirectX Generic Video Acceleration helpers
+ *****************************************************************************
+ * Copyright © 2018 VLC authors and VideoLAN, VideoLabs
+ *
+ * Authors: Steve Lhomme <robux4 at gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+#include <vlc_codecs.h>
+#include <vlc_codec.h>
+
+#define D3D_DecoderType     IUnknown
+#define D3D_DecoderDevice   IUnknown
+#define D3D_DecoderSurface  IUnknown
+
+struct picture_sys_t
+{
+    void *dummy;
+};
+
+#include "directx_va.h"
+
+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 */
+
+    0x0402, /* HD Graphics */
+    0x0406, /* HD Graphics */
+    0x040A, /* HD Graphics */
+    0x0412, /* HD Graphics 4600 */
+    0x0416, /* HD Graphics 4600 */
+    0x041E, /* HD Graphics 4400 */
+    0x041A, /* HD Graphics P4600/P4700 */
+
+    0x0A06, /* HD Graphics */
+    0x0A0E, /* HD Graphics */
+    0x0A16, /* HD Graphics Family */
+    0x0A1E, /* HD Graphics Family */
+    0x0A26, /* HD Graphics 5000 */
+    0x0A2E, /* Iris(TM) Graphics 5100 */
+
+    0x0D22, /* Iris(TM) Pro Graphics 5200 */
+    0x0D26, /* Iris(TM) Pro Graphics 5200 */
+};
+
+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;
+}



More information about the vlc-commits mailing list