[vlc-commits] [Git][videolan/vlc][master] opengl: egl_gbm: use DRM_DIR_NAME for path

Rémi Denis-Courmont (@Courmisch) gitlab at videolan.org
Sat Jan 22 12:38:07 UTC 2022



Rémi Denis-Courmont pushed to branch master at VideoLAN / VLC


Commits:
1735bf9d by Alexandre Janniaux at 2022-01-22T12:06:30+00:00
opengl: egl_gbm: use DRM_DIR_NAME for path

DRM_DIR_NAME can be different, for instance on OpenBSD, and the correct
location is defined by the xf86drm.h header.

This is commit 6218609ae411b6289174521a012e82376329109f resent after
revert from 0b8ce0dddadb13dacc01e8a6a2c25e9666818902 and a design
preventing failure if headers are missing or broken.

- - - - -


2 changed files:

- modules/video_output/opengl/Makefile.am
- modules/video_output/opengl/egl_display_gbm.c


Changes:

=====================================
modules/video_output/opengl/Makefile.am
=====================================
@@ -165,6 +165,10 @@ endif
 libegl_display_gbm_plugin_la_SOURCES = video_output/opengl/egl_display_gbm.c
 libegl_display_gbm_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) $(EGL_FLAGS) $(GBM_CFLAGS)
 libegl_display_gbm_plugin_la_LIBADD = $(EGL_LIBS) $(GBM_LIBS)
+if HAVE_KMS
+# DRM headers are bringing defines useful for opening DRM devices
+libegl_display_gbm_plugin_la_CPPFLAGS += $(KMS_CFLAGS) -DHAVE_KMS=1
+endif
 if HAVE_EGL
 if HAVE_GBM
 vout_LTLIBRARIES += libegl_display_gbm_plugin.la


=====================================
modules/video_output/opengl/egl_display_gbm.c
=====================================
@@ -31,8 +31,13 @@
 
 #include <EGL/egl.h>
 #include <EGL/eglext.h>
+
 #include <gbm.h>
 
+#ifdef HAVE_KMS
+#include <xf86drm.h>
+#endif
+
 #include "egl_display.h"
 
 struct sys
@@ -57,11 +62,22 @@ static void Close(struct vlc_egl_display *display)
 static int
 OpenDeviceFd(const char **out_path)
 {
+    /* Usually, /dev/dri/renderD* or /dev/dri/card* on Linux */
     static const char *default_drm_device_paths[] = {
+#if defined(HAVE_KMS)
+    /* OpenBSD has moved to Linux file path for DRM. libdrm defines will
+     * provide the correct path, but otherwise we'll always fallback to
+     * the standard path for Linux. */
+        DRM_DIR_NAME "/" DRM_RENDER_MINOR_NAME "128",
+        DRM_DIR_NAME "/" DRM_PRIMARY_MINOR_NAME "0",
+        DRM_DIR_NAME "/" DRM_RENDER_MINOR_NAME "129",
+        DRM_DIR_NAME "/" DRM_PRIMARY_MINOR_NAME "1",
+#else
         "/dev/dri/renderD128",
         "/dev/dri/card0",
         "/dev/dri/renderD129",
         "/dev/dri/card1",
+#endif
     };
 
     for (size_t i = 0; i < ARRAY_SIZE(default_drm_device_paths); ++i)



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/1735bf9d05592247ae8471c07c58c4560a4b8849

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/1735bf9d05592247ae8471c07c58c4560a4b8849
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list