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:
wm4 2020-08-27 11:34:10 +02:00
parent b5b83a1ed5
commit 7fb972fd39
2 changed files with 3 additions and 2 deletions

View File

@ -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.

View File

@ -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
};