diff options
author | memeka <mihailescu2m@gmail.com> | 2018-08-04 21:33:35 +0930 |
---|---|---|
committer | Anton Kindestam <antonki@kth.se> | 2019-09-20 19:09:36 +0200 |
commit | 0bdcbd75e001f6f344f28378227d5fbff0ed9a06 (patch) | |
tree | e9de548d4ce3f8fd2f1114c99ae480079d9867e2 /video/out | |
parent | 31a39334a271f48f7d671757c43ce14423010aa5 (diff) | |
download | mpv-0bdcbd75e001f6f344f28378227d5fbff0ed9a06.tar.bz2 mpv-0bdcbd75e001f6f344f28378227d5fbff0ed9a06.tar.xz |
context_drm_egl: Use eglGetPlatformDisplayEXT if available
Check if eglGetPlatformDisplayEXT is available and try to
use it to obtain the display connection. Fall back to eglGetDisplay
if eglGetPlatformDisplayEXT is not available or failing.
From PR #5992
Diffstat (limited to 'video/out')
-rw-r--r-- | video/out/opengl/context_drm_egl.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/video/out/opengl/context_drm_egl.c b/video/out/opengl/context_drm_egl.c index f06494b799..fe296d2592 100644 --- a/video/out/opengl/context_drm_egl.c +++ b/video/out/opengl/context_drm_egl.c @@ -180,11 +180,30 @@ static int match_config_to_visual(void *user_data, EGLConfig *configs, int num_c return -1; } +static EGLDisplay egl_get_display(struct gbm_device *gbm_device) +{ + const char *ext = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS); + + 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); + + if (get_platform_display && strstr(ext, "EGL_KHR_platform_gbm")) + return get_platform_display(EGL_PLATFORM_GBM_KHR, gbm_device, NULL); + } + + return eglGetDisplay(gbm_device); +} + static bool init_egl(struct ra_ctx *ctx) { struct priv *p = ctx->priv; MP_VERBOSE(ctx, "Initializing EGL\n"); - p->egl.display = eglGetDisplay(p->gbm.device); + p->egl.display = egl_get_display(p->gbm.device); + if (p->egl.display == EGL_NO_DISPLAY) { MP_ERR(ctx, "Failed to get EGL display.\n"); return false; |