Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Miouyouyou/b9273ee3d949db3e1eb12f6bf99c1101 to your computer and use it in GitHub Desktop.
Save Miouyouyou/b9273ee3d949db3e1eb12f6bf99c1101 to your computer and use it in GitHub Desktop.
MPV EGL patch
From 93a400edcabee9de0d6b464e081aa9c562085559 Mon Sep 17 00:00:00 2001
From: Myy Miouyouyou <myy@miouyouyou.fr>
Date: Fri, 1 Feb 2019 17:13:57 +0000
Subject: [PATCH] Use eglGetPlatformDisplay when possible
And then fallback on eglGetDisplay if the initialization fails...
That said, currently the code only handle eglGetPlatformDisplay
with GBMm in order to initialize displays with DRM/KMS backends.
Signed-off-by: Myy Miouyouyou <myy@miouyouyou.fr>
---
video/out/opengl/context_drm_egl.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/video/out/opengl/context_drm_egl.c b/video/out/opengl/context_drm_egl.c
index 6aa3d95..de118a5 100644
--- a/video/out/opengl/context_drm_egl.c
+++ b/video/out/opengl/context_drm_egl.c
@@ -158,9 +158,18 @@ 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);
+ PFNEGLGETPLATFORMDISPLAYEXTPROC get_platform_display = NULL;
+ get_platform_display = (void *) eglGetProcAddress("eglGetPlatformDisplayEXT");
+ if (get_platform_display)
+ p->egl.display = get_platform_display(EGL_PLATFORM_GBM_KHR, p->gbm.device, NULL);
+ else {
+ MP_ERR(ctx, "WHAT !?");
+ p->egl.display = eglGetDisplay(p->gbm.device);
+ }
+
if (p->egl.display == EGL_NO_DISPLAY) {
MP_ERR(ctx, "Failed to get EGL display.\n");
+ MP_ERR(ctx, "Error : %d\n", eglGetError());
return false;
}
if (!eglInitialize(p->egl.display, NULL, NULL)) {
--
2.7.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment