[vlc-devel] [PATCH 3/3] vout: opengl-egl: add drm-gbm platform

Victorien Le Couviour--Tuffet victorien.lecouviour.tuffet at gmail.com
Thu Jun 8 11:51:19 CEST 2017


---
 modules/video_output/Makefile.am  |  8 ++++++++
 modules/video_output/opengl/egl.c | 29 +++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+)

diff --git a/modules/video_output/Makefile.am b/modules/video_output/Makefile.am
index 750e903292..b18d9fe626 100644
--- a/modules/video_output/Makefile.am
+++ b/modules/video_output/Makefile.am
@@ -355,9 +355,17 @@ libdrm_gbm_window_plugin_la_SOURCES = video_output/drm_gbm.c
 libdrm_gbm_window_plugin_la_CFLAGS = $(AM_CFLAGS) $(LIBDRM_CFLAGS) $(GBM_CFLAGS)
 libdrm_gbm_window_plugin_la_LIBADD = $(LIBDRM_LIBS) $(GBM_LIBS)
 
+libegl_drm_gbm_plugin_la_SOURCES = video_output/opengl/egl.c
+libegl_drm_gbm_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) -DUSE_PLATFORM_DRM_GBM=1
+libegl_drm_gbm_plugin_la_CFLAGS = $(AM_CFLAGS) $(EGL_CFLAGS)
+libegl_drm_gbm_plugin_la_LIBADD = $(EGL_LIBS) $(LIBDRM_LIBS) $(GBM_LIBS)
+
 if HAVE_GBM
 if HAVE_LIBDRM
 vout_LTLIBRARIES += libdrm_gbm_window_plugin.la
+if HAVE_EGL
+vout_LTLIBRARIES += libegl_drm_gbm_plugin.la
+endif
 endif
 endif
 
diff --git a/modules/video_output/opengl/egl.c b/modules/video_output/opengl/egl.c
index 7a2bad0833..c836d9b1e5 100644
--- a/modules/video_output/opengl/egl.c
+++ b/modules/video_output/opengl/egl.c
@@ -95,6 +95,9 @@ static void SwapBuffers (vlc_gl_t *gl)
     vlc_gl_sys_t *sys = gl->sys;
 
     eglSwapBuffers (sys->display, sys->surface);
+#ifdef USE_PLATFORM_DRM_GBM
+    var_TriggerCallback(gl->surface, "drm-gbm-swap_frame_buffers");
+#endif
 }
 
 static void *GetSymbol(vlc_gl_t *gl, const char *procname)
@@ -301,6 +304,24 @@ static int Open (vlc_object_t *obj, const struct gl_api *api)
     sys->display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
 # endif
 
+#elif defined (USE_PLATFORM_DRM_GBM)
+    if (!CheckClientExt("EGL_MESA_platform_gbm") &&
+        !CheckClientExt("EGL_KHR_platform_gbm"))
+        goto error;
+
+    window = wnd->handle.gbm;
+# if defined(EGL_MESA_platform_gbm)
+    sys->display = GetDisplayEXT(EGL_PLATFORM_GBM_MESA,
+                                 wnd->display.gbm, NULL);
+    createSurface = CreateWindowSurfaceEXT;
+# elif defined(EGL_KHR_platform_gbm)
+    sys->display = GetDisplayEXT(EGL_PLATFORM_GBM_KHR,
+                                 wnd->display.gbm, NULL);
+    createSurface = CreateWindowSurfaceEXT;
+# else
+    goto error;
+# endif
+
 #endif
 
     if (sys->display == EGL_NO_DISPLAY)
@@ -401,12 +422,20 @@ vlc_module_begin ()
     set_description (N_("EGL extension for OpenGL"))
     set_category (CAT_VIDEO)
     set_subcategory (SUBCAT_VIDEO_VOUT)
+#ifndef USE_PLATFORM_DRM_GBM
     set_capability ("opengl", 50)
+#else
+    set_capability ("opengl", 40)
+#endif
     set_callbacks (OpenGL, Close)
     add_shortcut ("egl")
 
     add_submodule ()
+#ifndef USE_PLATFORM_DRM_GBM
     set_capability ("opengl es2", 50)
+#else
+    set_capability ("opengl es2", 40)
+#endif
     set_callbacks (OpenGLES2, Close)
     add_shortcut ("egl")
 
-- 
2.13.0



More information about the vlc-devel mailing list