From f5cc28a627bc2adc3ce63e69384905a0c3fea66b Mon Sep 17 00:00:00 2001 From: sfan5 Date: Mon, 15 Nov 2021 21:34:05 +0100 Subject: context_drm_egl: use mpegl_get_display() helper over own code Although there are no known problems with this, using the helper should be more portable. It will also prefer EGL 1.5's eglGetPlatformDisplay over eglGetPlatformDisplayEXT if available. --- video/out/opengl/context_drm_egl.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/video/out/opengl/context_drm_egl.c b/video/out/opengl/context_drm_egl.c index 2bd17dc871..4487751266 100644 --- a/video/out/opengl/context_drm_egl.c +++ b/video/out/opengl/context_drm_egl.c @@ -46,8 +46,6 @@ #endif #ifndef EGL_EXT_platform_base -typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC) - (EGLenum platform, void *native_display, const EGLint *attrib_list); typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list); #endif @@ -201,18 +199,15 @@ static int match_config_to_visual(void *user_data, EGLConfig *configs, int num_c static EGLDisplay egl_get_display(struct gbm_device *gbm_device) { - const char *ext = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS); + EGLDisplay ret; - if (ext) { - PFNEGLGETPLATFORMDISPLAYEXTPROC get_platform_display = NULL; - get_platform_display = (void *) eglGetProcAddress("eglGetPlatformDisplayEXT"); - - if (get_platform_display && strstr(ext, "EGL_MESA_platform_gbm")) - return get_platform_display(EGL_PLATFORM_GBM_MESA, gbm_device, NULL); + ret = mpegl_get_display(EGL_PLATFORM_GBM_MESA, "EGL_MESA_platform_gbm", gbm_device); + if (ret != EGL_NO_DISPLAY) + return ret; - if (get_platform_display && strstr(ext, "EGL_KHR_platform_gbm")) - return get_platform_display(EGL_PLATFORM_GBM_KHR, gbm_device, NULL); - } + ret = mpegl_get_display(EGL_PLATFORM_GBM_KHR, "EGL_KHR_platform_gbm", gbm_device); + if (ret != EGL_NO_DISPLAY) + return ret; return eglGetDisplay(gbm_device); } -- cgit v1.2.3