[vlc-commits] opengl: vaapi: use vlc_vaapi_InitializeInstanceDRM

Thomas Guillem git at videolan.org
Fri Dec 1 16:30:49 CET 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Dec  1 16:08:51 2017 +0100| [1dc94297779123d9e706ea0d8a46f6225a5ca518] | committer: Thomas Guillem

opengl: vaapi: use vlc_vaapi_InitializeInstanceDRM

Fixes #19173

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

 modules/video_output/opengl/converter_vaapi.c | 32 +++------------------------
 1 file changed, 3 insertions(+), 29 deletions(-)

diff --git a/modules/video_output/opengl/converter_vaapi.c b/modules/video_output/opengl/converter_vaapi.c
index 882b091b27..4f99b266c7 100644
--- a/modules/video_output/opengl/converter_vaapi.c
+++ b/modules/video_output/opengl/converter_vaapi.c
@@ -370,38 +370,12 @@ x11_init_vaapi_instance(opengl_tex_converter_t *tc, struct priv *priv)
 #endif
 
 #ifdef HAVE_VA_DRM
-static void
-drm_native_destroy_cb(VANativeDisplay native)
-{
-    vlc_close((intptr_t) native);
-}
 static int
 drm_init_vaapi_instance(opengl_tex_converter_t *tc, struct priv *priv)
 {
-    static const char *const drm_device_paths[] = {
-        "/dev/dri/renderD128",
-        "/dev/dri/card0"
-    };
-
-    for (size_t i = 0; i < ARRAY_SIZE(drm_device_paths); i++)
-    {
-        int drm_fd = vlc_open(drm_device_paths[i], O_RDWR);
-        if (drm_fd == -1)
-            continue;
-
-        priv->vadpy = vaGetDisplayDRM(drm_fd);
-        if (priv->vadpy)
-        {
-            priv->vainst =
-                vlc_vaapi_InitializeInstance(VLC_OBJECT(tc->gl), priv->vadpy,
-                                             (VANativeDisplay) (intptr_t)drm_fd,
-                                             drm_native_destroy_cb);
-            if (priv->vainst != NULL)
-                break;
-        }
-        else
-            vlc_close(drm_fd);
-    }
+    priv->vainst =
+        vlc_vaapi_InitializeInstanceDRM(VLC_OBJECT(tc->gl), vaGetDisplayDRM,
+                                        &priv->vadpy, NULL);
     return priv->vainst != NULL ? VLC_SUCCESS : VLC_EGENERIC;
 }
 #endif



More information about the vlc-commits mailing list