mirror of
https://github.com/mpv-player/mpv
synced 2025-02-28 03:10:55 +00:00
vo_gpu: EGL: fix transparency on X11/EGL/Mesa
Transparent windows on X11/EGL/native Mesa GL didn't work for various reasons. From what I remember, the current code did work with nvidia at least. Mesa has made attempts to fix this, but they never really made it in. But it turns out you can make EGL/Mesa list the EGLConfigs that use X11 RGBA visuals, and context_x11egl.c contains code that explicitly selects them if alpha is requested (see pick_xrgba_config()). The reason EGL/Mesa did not list them (and thus breaking transparency) is because we requested a EGL_ALPHA_SIZE != 0 if alpha is requested. But the transparent EGLConfigs use EGL_ALPHA_SIZE == 0. That's because EGL doesn't actually support the concept of transparent windows; the alpha size parameter is something else (memory rendering without FBOs or something, I don't care enough to look up the real reasons). This still won't work on Wayland. Every EGL backend needs platform specific code. (Good job, EGL, such an awesome platform independent standard.) Fixes: #6590
This commit is contained in:
parent
b5b83a1ed5
commit
7fb972fd39
@ -6319,7 +6319,8 @@ The following video options are currently all specific to ``--vo=gpu`` and
|
||||
unavailable, it silently falls back on a normal framebuffer. Note that
|
||||
if you set the ``--fbo-format`` option to a non-default value, a
|
||||
format with alpha must be specified, or this won't work.
|
||||
This does not work on X11 with EGL and Mesa (freedesktop bug 67676).
|
||||
Whether this really works depends on the windowing system and desktop
|
||||
environment.
|
||||
no
|
||||
Ignore alpha component.
|
||||
|
||||
|
@ -120,7 +120,7 @@ static bool create_context(struct ra_ctx *ctx, EGLDisplay display,
|
||||
EGL_RED_SIZE, 8,
|
||||
EGL_GREEN_SIZE, 8,
|
||||
EGL_BLUE_SIZE, 8,
|
||||
EGL_ALPHA_SIZE, ctx->opts.want_alpha ? 1 : 0,
|
||||
EGL_ALPHA_SIZE, 0,
|
||||
EGL_RENDERABLE_TYPE, rend,
|
||||
EGL_NONE
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user