diff options
author | sfan5 <sfan5@live.de> | 2021-11-15 21:34:05 +0100 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2021-11-17 22:38:34 +0100 |
commit | f5cc28a627bc2adc3ce63e69384905a0c3fea66b (patch) | |
tree | c5b947121351518bd66d6ac2267f81558f74ec64 | |
parent | 3d9c0eae9e4d42494b9435ad3cf5c31217e262ad (diff) | |
download | mpv-f5cc28a627bc2adc3ce63e69384905a0c3fea66b.tar.bz2 mpv-f5cc28a627bc2adc3ce63e69384905a0c3fea66b.tar.xz |
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.
-rw-r--r-- | video/out/opengl/context_drm_egl.c | 19 |
1 files 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); } |