mpv/video/out/opengl
Dudemanguy f8e62d3d82 egl_helpers: fix create_context fallback behavior
The EGL stuff is really complicated because of historical reasons
(tl;dr: blame EGL). There was one edge case with EGL context creation
that lead to incorrect behavior. EGL_KHR_create_context was created with
EGL 1.4 (which mpv does support) but it is still possible for an EGL 1.4
device to not implement this extension. That means that none of the EGL
attrs that pass a specific opengl version work. So for this obscure
case, there is a fallback context creation at the very end which simply
creates an EGLContext without passing any special attrs.

This has another problem however. mpv has a hard requirement on at least
desktop opengl 2.1 or opengl ES 2.0 to function (we're not asking for
much here). Since the fallback EGL context creation has no version
checking, it is entirely possible to create an EGL context with a
desktop opengl version under 2.1. As you get further along in the code,
the user will encounter the hard opengl version check and then error
out. However, we're supposed to also actually check if GLES works
(that's what the opengl-es=auto option is for) so this is a bug.

The fix is to do a bit of code duplication and make a mpgl_check_version
specifically for if we hit the edge case of needing to create an EGL
context without the EGL_KHR_create_context extension. Grab the version
with the function pointer, check if it's under 210, if so destroy the
EGL context and set it to NULL. After that, if the user has set
opengl-es to auto, mpv will try GLES next. If it is set to no, then mpv
will simply fail as desired. Fixes #5915.

Sidenote: the ra_gl_ctx_test_version originally testing 140 doesn't make
any sense. Passing the version number in that function only does
something if the user has set opengl-restrict. What we need to do is to
pass the version of the created context to that function. If the version
is higher than the opengl-restrict option, then make this a failure.
2021-07-25 15:32:53 +00:00
..
angle_dynamic.c
angle_dynamic.h
common.c egl_helpers: fix create_context fallback behavior 2021-07-25 15:32:53 +00:00
common.h egl_helpers: fix create_context fallback behavior 2021-07-25 15:32:53 +00:00
context.c vo_gpu: opengl: make sure to always clean up debug callbacks 2020-04-15 07:21:36 +02:00
context.h
context_android.c
context_angle.c options: change option macros and all option declarations 2020-03-18 19:52:01 +01:00
context_cocoa.c options: change option macros and all option declarations 2020-03-18 19:52:01 +01:00
context_drm_egl.c context_drm_egl: allow autoprobe selection 2021-07-23 17:54:58 +00:00
context_dxinterop.c
context_glx.c
context_rpi.c
context_wayland.c wayland: fix wl_surface_set_buffer_scale usage 2021-06-27 10:58:59 -05:00
context_win.c
context_x11egl.c vo_gpu: EGL: hack for alpha on different platforms 2020-10-15 13:44:07 +00:00
egl_helpers.c egl_helpers: fix create_context fallback behavior 2021-07-25 15:32:53 +00:00
egl_helpers.h
formats.c
formats.h
gl_headers.h
hwdec_d3d11egl.c
hwdec_drmprime_drm.c
hwdec_dxva2egl.c
hwdec_dxva2gldx.c
hwdec_ios.m
hwdec_osx.c
hwdec_rpi.c
hwdec_vdpau.c
libmpv_gl.c
oml_sync.c
oml_sync.h
ra_gl.c video: fix rgb30 component order 2020-05-09 18:02:57 +02:00
ra_gl.h
utils.c
utils.h