[vlc-commits] vaapi-drm: try the render node before the card node

2016-11-28 Thread Mathieu Velten
vlc | branch: master | Mathieu Velten  | Mon Nov 28 19:54:28 
2016 +0100| [a3797ea8eae74bb622579705207df6fed6a6ed14] | committer: Rémi 
Denis-Courmont

vaapi-drm: try the render node before the card node

This patch make it work with Wayland on Fedora 25.

Signed-off-by: Rémi Denis-Courmont 

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

 modules/codec/avcodec/vaapi.c | 23 ---
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/modules/codec/avcodec/vaapi.c b/modules/codec/avcodec/vaapi.c
index 8671139..d0affab 100644
--- a/modules/codec/avcodec/vaapi.c
+++ b/modules/codec/avcodec/vaapi.c
@@ -356,14 +356,23 @@ static int Create( vlc_va_t *va, AVCodecContext *ctx, 
enum PixelFormat pix_fmt,
 sys->hw_ctx.display = vaGetDisplay(sys->p_display_x11);
 #endif
 #ifdef VLC_VA_BACKEND_DRM
-sys->drm_fd = vlc_open("/dev/dri/card0", O_RDWR);
-if( sys->drm_fd == -1 )
-{
-msg_Err( va, "Could not access rendering device: %m" );
-goto error;
-}
+static const char const *drm_device_paths[] = {
+"/dev/dri/renderD128",
+"/dev/dri/card0"
+};
+
+for (int i = 0; ARRAY_SIZE(drm_device_paths); i++) {
+sys->drm_fd = vlc_open(drm_device_paths[i], O_RDWR);
+if (sys->drm_fd < 0)
+continue;
 
-sys->hw_ctx.display = vaGetDisplayDRM(sys->drm_fd);
+sys->hw_ctx.display = vaGetDisplayDRM(sys->drm_fd);
+if (sys->hw_ctx.display)
+break;
+
+vlc_close(sys->drm_fd);
+sys->drm_fd = -1;
+}
 #endif
 if (sys->hw_ctx.display == NULL)
 {

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] vaapi-drm: try the render node before the card node

2016-11-25 Thread Mathieu Velten
vlc | branch: master | Mathieu Velten  | Fri Nov 25 16:13:20 
2016 +0100| [24bc6ae846ac589cc0a52fac2acf64f7d89ddd75] | committer: Rémi 
Denis-Courmont

vaapi-drm: try the render node before the card node

This patch make it work with Wayland on Fedora 25.

Signed-off-by: Rémi Denis-Courmont 

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

 modules/codec/avcodec/vaapi.c | 24 +---
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/modules/codec/avcodec/vaapi.c b/modules/codec/avcodec/vaapi.c
index 8671139..03faf20 100644
--- a/modules/codec/avcodec/vaapi.c
+++ b/modules/codec/avcodec/vaapi.c
@@ -356,14 +356,24 @@ static int Create( vlc_va_t *va, AVCodecContext *ctx, 
enum PixelFormat pix_fmt,
 sys->hw_ctx.display = vaGetDisplay(sys->p_display_x11);
 #endif
 #ifdef VLC_VA_BACKEND_DRM
-sys->drm_fd = vlc_open("/dev/dri/card0", O_RDWR);
-if( sys->drm_fd == -1 )
-{
-msg_Err( va, "Could not access rendering device: %m" );
-goto error;
-}
+static const char *drm_device_paths[] = {
+"/dev/dri/renderD128",
+"/dev/dri/card0",
+NULL
+};
+
+for (int i = 0; drm_device_paths[i]; i++) {
+sys->drm_fd = vlc_open(drm_device_paths[i], O_RDWR);
+if (sys->drm_fd < 0)
+continue;
 
-sys->hw_ctx.display = vaGetDisplayDRM(sys->drm_fd);
+sys->hw_ctx.display = vaGetDisplayDRM(sys->drm_fd);
+if (sys->hw_ctx.display)
+break;
+
+vlc_close(sys->drm_fd);
+sys->drm_fd = -1;
+}
 #endif
 if (sys->hw_ctx.display == NULL)
 {

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits