[vlc-commits] [Git][videolan/vlc][master] 2 commits: egl: display information about device/platform

Steve Lhomme (@robUx4) gitlab at videolan.org
Wed Jun 10 12:17:38 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
4440bc45 by Alexandre Janniaux at 2026-06-10T11:55:13+00:00
egl: display information about device/platform

Much like in the d3d11 code, display which device/vendor/driver is used,
which is useful in a multi-gpu context.

Typical output on Linux:

egl_x11 gl debug: EGL version 1.5 by NVIDIA
egl_x11 gl debug: EGL has 3 devices:
egl_x11 gl debug:  - device 0:
egl_x11 gl debug:    vendor='NVIDIA' renderer='NVIDIA GeForce RTX 2060'
egl_x11 gl debug:    extensions: EGL_NV_device_cuda EGL_EXT_device_drm EGL_EXT_device_drm_render_node EGL_EXT_device_query_name...
egl_x11 gl debug:    drm device: /dev/dri/card1
egl_x11 gl debug:    drm render node: /dev/dri/renderD128
egl_x11 gl debug:  - device 1:
egl_x11 gl debug:    vendor='unknown' renderer='unknown'
egl_x11 gl debug:    extensions: EGL_EXT_device_drm EGL_EXT_device_drm_render_node EGL_EXT_device_query_name...
egl_x11 gl debug:    drm device: /dev/dri/card1
egl_x11 gl debug:    drm render node: /dev/dri/renderD128
egl_x11 gl debug:  - device 2:
egl_x11 gl debug:    extensions: EGL_MESA_device_software EGL_EXT_device_drm_render_node
egl_x11 gl debug: Using EGL device:
egl_x11 gl debug:    vendor='NVIDIA' renderer='NVIDIA GeForce RTX 2060'
egl_x11 gl debug:    extensions: EGL_NV_device_cuda EGL_EXT_device_drm EGL_EXT_device_drm_render_node EGL_EXT_device_query_name...
egl_x11 gl debug:    drm device: /dev/dri/card1
egl_x11 gl debug:    drm render node: /dev/dri/renderD128
egl_x11 gl debug: EGL_MESA_query_driver is unavailable
main generic debug: using opengl module "egl_x11"

When the device exposes EGL_EXT_device_query_name the vendor and
renderer are printed. When EGL_MESA_query_driver is available the driver
name is reported instead.

It also paves the way for user selection of the GPU to use.

- - - - -
006f09a3 by Alexandre Janniaux at 2026-06-10T11:55:13+00:00
egl: gbm: display information about device/platform

Mirror the device/driver reporting from the egl module so the GBM/Wayland
backend also logs the available EGL devices, the device in use and the
driver name.

- - - - -


2 changed files:

- modules/video_output/opengl/egl.c
- modules/video_output/opengl/egl_gbm.c


Changes:

=====================================
modules/video_output/opengl/egl.c
=====================================
@@ -87,6 +87,81 @@ static bool CheckClientExt(const char *name)
     return vlc_gl_StrHasToken(clientExts, name);
 }
 
+static bool CheckDisplayExt(EGLDisplay display, const char *name)
+{
+    const char *exts = eglQueryString(display, EGL_EXTENSIONS);
+    return vlc_gl_StrHasToken(exts, name);
+}
+
+static void LogDeviceInfo(vlc_gl_t *gl,
+                          PFNEGLQUERYDEVICESTRINGEXTPROC eglQueryDeviceStringEXT,
+                          EGLDeviceEXT device)
+{
+    const char *device_ext = eglQueryDeviceStringEXT(device, EGL_EXTENSIONS);
+    if (device_ext == NULL)
+        device_ext = "";
+
+    /* EGL_EXT_device_query_name is a device extension, so it must be tested
+     * against the device's own extension string, not the client one. */
+    if (vlc_gl_StrHasToken(device_ext, "EGL_EXT_device_query_name"))
+    {
+        const char *vendor = eglQueryDeviceStringEXT(device, EGL_VENDOR);
+        const char *renderer = eglQueryDeviceStringEXT(device, EGL_RENDERER_EXT);
+        msg_Dbg(gl, "   vendor='%s' renderer='%s'",
+                vendor ? vendor : "unknown", renderer ? renderer : "unknown");
+    }
+
+    msg_Dbg(gl, "   extensions: %s", device_ext);
+
+    if (vlc_gl_StrHasToken(device_ext, "EGL_EXT_device_drm"))
+    {
+        const char *path = eglQueryDeviceStringEXT(device, EGL_DRM_DEVICE_FILE_EXT);
+        if (path != NULL)
+            msg_Dbg(gl, "   drm device: %s", path);
+    }
+    if (vlc_gl_StrHasToken(device_ext, "EGL_EXT_device_drm_render_node"))
+    {
+        const char *path = eglQueryDeviceStringEXT(device, EGL_DRM_RENDER_NODE_FILE_EXT);
+        if (path != NULL)
+            msg_Dbg(gl, "   drm render node: %s", path);
+    }
+}
+
+static void DisplayAvailableDevices(vlc_gl_t *gl)
+{
+    PFNEGLQUERYDEVICESEXTPROC eglQueryDevicesEXT =
+        (PFNEGLQUERYDEVICESEXTPROC)eglGetProcAddress("eglQueryDevicesEXT");
+    PFNEGLQUERYDEVICESTRINGEXTPROC eglQueryDeviceStringEXT =
+        (PFNEGLQUERYDEVICESTRINGEXTPROC)eglGetProcAddress("eglQueryDeviceStringEXT");
+
+    EGLint device_count = 0;
+    if (eglQueryDevicesEXT(0, NULL, &device_count) != EGL_TRUE
+     || device_count <= 0)
+    {
+        msg_Dbg(gl, "could not enumerate EGL devices");
+        return;
+    }
+
+    EGLDeviceEXT *devices = vlc_alloc(device_count, sizeof(*devices));
+    if (devices == NULL)
+        return;
+
+    if (eglQueryDevicesEXT(device_count, devices, &device_count) != EGL_TRUE)
+    {
+        free(devices);
+        return;
+    }
+
+    msg_Dbg(gl, "EGL has %d devices:", device_count);
+    for (EGLint i = 0; i < device_count; ++i)
+    {
+        msg_Dbg(gl, " - device %d:", i);
+        LogDeviceInfo(gl, eglQueryDeviceStringEXT, devices[i]);
+    }
+
+    free(devices);
+}
+
 struct gl_api
 {
    const char name[10];
@@ -690,6 +765,42 @@ static int Open(vlc_gl_t *gl, const struct gl_api *api,
         goto error;
     }
 
+    bool has_device_enum = CheckClientExt("EGL_EXT_device_enumeration");
+    bool has_device_query = CheckClientExt("EGL_EXT_device_query");
+
+    if (has_device_query && has_device_enum)
+    {
+        DisplayAvailableDevices(gl);
+        PFNEGLQUERYDISPLAYATTRIBEXTPROC eglQueryDisplayAttribEXT =
+            (PFNEGLQUERYDISPLAYATTRIBEXTPROC)eglGetProcAddress("eglQueryDisplayAttribEXT");
+        PFNEGLQUERYDEVICESTRINGEXTPROC eglQueryDeviceStringEXT =
+            (PFNEGLQUERYDEVICESTRINGEXTPROC)eglGetProcAddress("eglQueryDeviceStringEXT");
+
+        EGLAttrib device_attr;
+        if (eglQueryDisplayAttribEXT(sys->display, EGL_DEVICE_EXT,
+                                     &device_attr) == EGL_TRUE)
+        {
+            EGLDeviceEXT device = (EGLDeviceEXT)device_attr;
+            msg_Dbg(gl, "Using EGL device:");
+            LogDeviceInfo(gl, eglQueryDeviceStringEXT, device);
+        }
+        else
+            msg_Dbg(gl, "could not query the EGL device in use");
+    }
+
+    bool has_query_driver =
+        CheckDisplayExt(sys->display, "EGL_MESA_query_driver");
+
+    if (has_query_driver)
+    {
+        PFNEGLGETDISPLAYDRIVERNAMEPROC eglGetDisplayDriverName =
+            (PFNEGLGETDISPLAYDRIVERNAMEPROC) eglGetProcAddress("eglGetDisplayDriverName");
+        const char *driver = eglGetDisplayDriverName(sys->display);
+        msg_Dbg(gl, "Using EGL driver: %s", driver ? driver : "unknown");
+    }
+    else
+        msg_Dbg(gl, "EGL_MESA_query_driver is unavailable");
+
     const EGLint conf_attr[] = {
         EGL_RED_SIZE, 5,
         EGL_GREEN_SIZE, 5,


=====================================
modules/video_output/opengl/egl_gbm.c
=====================================
@@ -104,6 +104,81 @@ static bool CheckClientExt(const char* name)
     return vlc_gl_StrHasToken(clientExts, name);
 }
 
+static bool CheckDisplayExt(EGLDisplay display, const char *name)
+{
+    const char *exts = eglQueryString(display, EGL_EXTENSIONS);
+    return vlc_gl_StrHasToken(exts, name);
+}
+
+static void LogDeviceInfo(vlc_gl_t *gl,
+                          PFNEGLQUERYDEVICESTRINGEXTPROC eglQueryDeviceStringEXT,
+                          EGLDeviceEXT device)
+{
+    const char *device_ext = eglQueryDeviceStringEXT(device, EGL_EXTENSIONS);
+    if (device_ext == NULL)
+        device_ext = "";
+
+    /* EGL_EXT_device_query_name is a device extension, so it must be tested
+     * against the device's own extension string, not the client one. */
+    if (vlc_gl_StrHasToken(device_ext, "EGL_EXT_device_query_name"))
+    {
+        const char *vendor = eglQueryDeviceStringEXT(device, EGL_VENDOR);
+        const char *renderer = eglQueryDeviceStringEXT(device, EGL_RENDERER_EXT);
+        msg_Dbg(gl, "   vendor='%s' renderer='%s'",
+                vendor ? vendor : "unknown", renderer ? renderer : "unknown");
+    }
+
+    msg_Dbg(gl, "   extensions: %s", device_ext);
+
+    if (vlc_gl_StrHasToken(device_ext, "EGL_EXT_device_drm"))
+    {
+        const char *path = eglQueryDeviceStringEXT(device, EGL_DRM_DEVICE_FILE_EXT);
+        if (path != NULL)
+            msg_Dbg(gl, "   drm device: %s", path);
+    }
+    if (vlc_gl_StrHasToken(device_ext, "EGL_EXT_device_drm_render_node"))
+    {
+        const char *path = eglQueryDeviceStringEXT(device, EGL_DRM_RENDER_NODE_FILE_EXT);
+        if (path != NULL)
+            msg_Dbg(gl, "   drm render node: %s", path);
+    }
+}
+
+static void DisplayAvailableDevices(vlc_gl_t *gl)
+{
+    PFNEGLQUERYDEVICESEXTPROC eglQueryDevicesEXT =
+        (PFNEGLQUERYDEVICESEXTPROC)eglGetProcAddress("eglQueryDevicesEXT");
+    PFNEGLQUERYDEVICESTRINGEXTPROC eglQueryDeviceStringEXT =
+        (PFNEGLQUERYDEVICESTRINGEXTPROC)eglGetProcAddress("eglQueryDeviceStringEXT");
+
+    EGLint device_count = 0;
+    if (eglQueryDevicesEXT(0, NULL, &device_count) != EGL_TRUE
+     || device_count <= 0)
+    {
+        msg_Dbg(gl, "could not enumerate EGL devices");
+        return;
+    }
+
+    EGLDeviceEXT *devices = vlc_alloc(device_count, sizeof(*devices));
+    if (devices == NULL)
+        return;
+
+    if (eglQueryDevicesEXT(device_count, devices, &device_count) != EGL_TRUE)
+    {
+        free(devices);
+        return;
+    }
+
+    msg_Dbg(gl, "EGL has %d devices:", device_count);
+    for (EGLint i = 0; i < device_count; ++i)
+    {
+        msg_Dbg(gl, " - device %d:", i);
+        LogDeviceInfo(gl, eglQueryDeviceStringEXT, devices[i]);
+    }
+
+    free(devices);
+}
+
 struct gl_api
 {
     const char name[10];
@@ -788,6 +863,42 @@ static int Open(vlc_gl_t* gl, const struct gl_api* api,
         goto error;
     }
 
+    bool has_device_enum = CheckClientExt("EGL_EXT_device_enumeration");
+    bool has_device_query = CheckClientExt("EGL_EXT_device_query");
+
+    if (has_device_query && has_device_enum)
+    {
+        DisplayAvailableDevices(gl);
+        PFNEGLQUERYDISPLAYATTRIBEXTPROC eglQueryDisplayAttribEXT =
+            (PFNEGLQUERYDISPLAYATTRIBEXTPROC)eglGetProcAddress("eglQueryDisplayAttribEXT");
+        PFNEGLQUERYDEVICESTRINGEXTPROC eglQueryDeviceStringEXT =
+            (PFNEGLQUERYDEVICESTRINGEXTPROC)eglGetProcAddress("eglQueryDeviceStringEXT");
+
+        EGLAttrib device_attr;
+        if (eglQueryDisplayAttribEXT(sys->egl.display, EGL_DEVICE_EXT,
+                                     &device_attr) == EGL_TRUE)
+        {
+            EGLDeviceEXT device = (EGLDeviceEXT)device_attr;
+            msg_Dbg(gl, "Using EGL device:");
+            LogDeviceInfo(gl, eglQueryDeviceStringEXT, device);
+        }
+        else
+            msg_Dbg(gl, "could not query the EGL device in use");
+    }
+
+    bool has_query_driver =
+        CheckDisplayExt(sys->egl.display, "EGL_MESA_query_driver");
+
+    if (has_query_driver)
+    {
+        PFNEGLGETDISPLAYDRIVERNAMEPROC eglGetDisplayDriverName =
+            (PFNEGLGETDISPLAYDRIVERNAMEPROC) eglGetProcAddress("eglGetDisplayDriverName");
+        const char *driver = eglGetDisplayDriverName(sys->egl.display);
+        msg_Dbg(gl, "Using EGL driver: %s", driver ? driver : "unknown");
+    }
+    else
+        msg_Dbg(gl, "EGL_MESA_query_driver is unavailable");
+
     ret = FindEglConfig(gl, gl_cfg->need_alpha);
     if (!ret)
         goto error;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/949374c3fde7c76f48021b13809a7c5cb6ddaea1...006f09a37b040e71ce8d70538859e5d7027a4147

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/949374c3fde7c76f48021b13809a7c5cb6ddaea1...006f09a37b040e71ce8d70538859e5d7027a4147
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list