summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2024-03-20 22:47:04 +0100
committersfan5 <sfan5@live.de>2024-03-21 18:27:08 +0100
commit6b8bd8072fc2abcc14183f91e31f5823481e5614 (patch)
tree55b97a7e8f952e9de95a25de64152c4f4a8cc49f
parentb3ca600acbbcdc002d28a0160366f0ac21fc4de8 (diff)
downloadmpv-6b8bd8072fc2abcc14183f91e31f5823481e5614.tar.bz2
mpv-6b8bd8072fc2abcc14183f91e31f5823481e5614.tar.xz
video/egl_helpers: fix fallback logic for EGL_KHR_create_context
Both possible paths had bugs: For OpenGL it passed EGL_CONTEXT_CLIENT_VERSION, which - in older versions of the standard - was not permitted. For GLES it always assumed EGL_CONTEXT_FLAGS_KHR to work, which belongs to the aforementioned extension. Ironically this was never a problem (probably saved by implementations not being overly strict) except in 2024 on an emulated Android 14 device that trips over this edge case. It is a mystery.
-rw-r--r--video/out/opengl/egl_helpers.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/video/out/opengl/egl_helpers.c b/video/out/opengl/egl_helpers.c
index cc83b27349..18d9027762 100644
--- a/video/out/opengl/egl_helpers.c
+++ b/video/out/opengl/egl_helpers.c
@@ -192,14 +192,15 @@ static bool create_context(struct ra_ctx *ctx, EGLDisplay display,
}
if (!egl_ctx) {
// Fallback for EGL 1.4 without EGL_KHR_create_context or GLES
- // Add the context flags only for GLES - GL has been attempted above
EGLint attrs[] = {
- EGL_CONTEXT_CLIENT_VERSION, 2,
- es ? EGL_CONTEXT_FLAGS_KHR : EGL_NONE, ctx_flags,
+ EGL_CONTEXT_FLAGS_KHR, ctx_flags,
+ es ? EGL_CONTEXT_CLIENT_VERSION : EGL_NONE, 2,
EGL_NONE
};
egl_ctx = eglCreateContext(display, config, EGL_NO_CONTEXT, attrs);
+ if (!egl_ctx)
+ egl_ctx = eglCreateContext(display, config, EGL_NO_CONTEXT, &attrs[2]);
}
if (!egl_ctx) {