summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/egl_helpers.h
Commit message (Collapse)AuthorAgeFilesLines
* egl_helpers: introduce wrapper around eglCreatePlatformWindowSurfacesfan52021-11-171-0/+3
| | | | | | It abstracts EGL 1.5, extension checks and other inconsistencies away. This can be used in context code as the (preferred) alternative to eglCreateWindowSurface().
* vo_gpu: opengl: make it work with EGL 1.4wm42019-12-161-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This tries to deal with the crazy EGL situation. The summary is: - using eglGetDisplay() with multiple windowing platforms doesn't really work, but Mesa had an awful hack for it - this hack can be disabled at build time, and some distros sometimes accidentally or intentionally do so - Mesa will probably eventually disable it by default - we switched to eglGetPlatformDisplay(), but this requires EGL 1.5 - the very regrettable graphics company (also known as Nvidia) ships drivers (for old hardware I think) that are EGL 1.4 only - that means even though we "require" EGL 1.5 and link against it, the runtime EGL may be 1.4 - trying to run mpv there crashes in the dynamic linker - so we have to go through some more awful compatibility hacks This commit tries to do it "properly", but using EGL 1.4 as base. The plaform selection mechanism is a messy extension there, which got elevated to core API in 1.5 (but OF COURSE in incompatible ways). I'm not sure whether the EGL 1.5 code path (by parsing the EGL_VERSION) is really needed, but if you ask me, it feels slightly saner not to rely on an EGL 1.4 kludge forever. But maybe this is just an instance of self-harm, since they will most likely never drop or not provide this API. Also, unlike before, we actually check the extension string for the individual platform extensions, because who knows, some EGL implementations might curse us if we pass unknown platform parameters. (But actually, the more I think about this, the more bullshit it is.) X11 and Wayland were the only ones trying to call eglGetPlatformDisplay, so they're the only ones which are adjusted in this commit. Unfortunately, correct function of this commit is unconfirmed. It's possible that it crashes with the old drivers mentioned above. Why didn't they solve it like this: struct native_display { int platform_type; void *native_display; }; Could have kept eglGetDisplay() without all the obnoxious extension BS.
* egl_helpers: mpegl_cb can now signal an error conditionAnton Kindestam2018-02-261-1/+3
| | | | | This can be used by client code that needs to fail when it cannot find a suitable EGLConfig.
* vo_opengl: refactor into vo_gpuNiklas Haas2017-09-211-11/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is done in several steps: 1. refactor MPGLContext -> struct ra_ctx 2. move GL-specific stuff in vo_opengl into opengl/context.c 3. generalize context creation to support other APIs, and add --gpu-api 4. rename all of the --opengl- options that are no longer opengl-specific 5. move all of the stuff from opengl/* that isn't GL-specific into gpu/ (note: opengl/gl_utils.h became opengl/utils.h) 6. rename vo_opengl to vo_gpu 7. to handle window screenshots, the short-term approach was to just add it to ra_swchain_fns. Long term (and for vulkan) this has to be moved to ra itself (and vo_gpu altered to compensate), but this was a stop-gap measure to prevent this commit from getting too big 8. move ra->fns->flush to ra_gl_ctx instead 9. some other minor changes that I've probably already forgotten Note: This is one half of a major refactor, the other half of which is provided by rossy's following commit. This commit enables support for all linux platforms, while his version enables support for all non-linux platforms. Note 2: vo_opengl_cb.c also re-uses ra_gl_ctx so it benefits from the --opengl- options like --opengl-early-flush, --opengl-finish etc. Should be a strict superset of the old functionality. Disclaimer: Since I have no way of compiling mpv on all platforms, some of these ports were done blindly. Specifically, the blind ports included context_mali_fbdev.c and context_rpi.c. Since they're both based on egl_helpers, the port should have gone smoothly without any major changes required. But if somebody complains about a compile error on those platforms (assuming anybody actually uses them), you know where to complain.
* vo_opengl: add a generic EGL function loader functionwm42017-04-061-0/+3
| | | | | | | This is pretty trivial, but also quite annoying due to details like mismatching eglGetProcAddress() function signature (most callers just cast the function pointer), and ARM/Linux hacks. So move them all to one place.
* vo_opengl: egl_helpers: add a way to override config selectionwm42016-12-301-0/+7
| | | | | | | Preparation for the following commits. Since at least theoretically the config selection depends on the context type (EGL_RENDERABLE_TYPE has separate bits for ES 2, ES 3, and desktop GL), doing it any other way would be too painful.
* vo_opengl: egl_helpers: add a way to pass more optionswm42016-12-301-0/+9
| | | | | | | | | | For X11 garbage we have to pass some annoying parameters to EGL context creation. Add some sort of extensible API, so that adding a new parameter doesn't break all callers. We still want to keep it as a single function, because it's so nice isolating all the EGL nonsense API boilerplate like this. (Did I mention yet that X11 and EGL are garbage?) Also somewhat simplifies the vo_flags mess in the helper internals.
* vo_opengl: factor some EGL context creation codewm42016-09-131-0/+7
| | | | | | | Add a function to egl_helpers.c for creating an EGL context and make context_x11egl.c use it. This is meant to be generic, and should work with other windowing APIs as well. The other EGL-using code in mpv can be switched to it.
* vo_opengl: use standard functions to retrieve display depthwm42016-06-141-3/+0
| | | | | | | | | | | | | Until now, we've used system-specific API (GLX, EGL, etc.) to retrieve the depth of the default framebuffer. (We equal this to display depth and use the determined depth for dithering.) We can actually retrieve this value through standard GL API, and it works everywhere (except GLES 2 of course). This simplifies everything a great deal. egl_helpers.c is empty now. But I expect that some EGL boilerplate will be moved to it, so don't remove it yet.
* vo_opengl: x11egl: retrieve framebuffer depthwm42015-12-191-0/+10
This is used for dithering, although I'm not aware of anyone who got higher than 8 bit depth support to work on Linux. Also put this into egl_helpers.c. Since EGL is pseudo-portable at best I have no hope that the EGL context creation code in all the backends can be fully shared. But some self-contained functionality can definitely be shared.