[Mesa-dev] [PATCH 2/2] egl: implement EGL_MESA_transparent_alpha for x11 and wayland

Daniel Stone daniel at fooishbar.org
Tue Mar 3 11:05:50 PST 2015


Hi,

On 3 March 2015 at 18:56, Jason Ekstrand <jason at jlekstrand.net> wrote:
> On Tue, Mar 3, 2015 at 10:07 AM, Chad Versace <chad.versace at intel.com>
> wrote:
>> On 02/23/2015 06:32 AM, Jonny Lamb wrote:
>> > +   static const EGLint argb_attrs[] = {
>> > +       EGL_TRANSPARENT_TYPE, EGL_TRANSPARENT_ALPHA_MESA,
>> > +       EGL_NONE
>> > +   };
>> >
>>
>> I tested this patch with X11 and Mesa, and it works as advertised. BUT...
>>
>> Pre-patch, Wayland applications who requested an EGLConfig with alpha
>> received one. The EGLSurface had compositor-transparent alpha, which
>> the application may not have expected. But the alpha configs *were*
>> available.
>>
>> Post-patch, existing Wayland applications that request an EGLConfig with
>> alpha will no longer receive one, because the existing applications
>> do not yet know about EGL_TRANSPARENT_ALPHA_MESA.
>>
>> I believe a correct solution is to continue create EGLConfigs
>> with EGL_ALPHA and without EGL_TRANSPARENT_TYPE, as Mesa does today,
>> but tell the compositor to ignore the alpha channel. The alpha channel
>> will be used for client-side alpha-blending but not for compositing.
>> Jason says that should be possible by telling the compositor that
>> the buffer format is WL_DRM_FORMAT_XRGB8888. And in addition to the
>> existing
>> EGLConfigs, also create new EGLConfigs with EGL_TRANSPARENT_ALPHA_MESA, as
>> this patch already does.
>
> Yes, XRGB8888 would be the correct *technical* way to handle that, but it
> still makes me wonder... What about Wayland apps that expect to get
> transparency by simply asking for alpha now?  Won't this break them?  I
> guess we have to break one class of apps or the other.

Yeah, it will break them. But then again, we had the same flag day for
X11 in that exact Bugzilla discussion, when X11 apps which requested
ALPHA_SIZE == 8 went from getting ARGB32 drawables which would be
blended by the compositor, to not - a change which was deemed totally
fine to enforce on people because it improved performance and matched
the spec.

Perhaps a better interim solution is to assume for Wayland that
EGL_TRANSPARENT_TYPE == EGL_DONT_CARE means that applications will get
a format determined by ALPHA_SIZE (i.e. size 8 means ARGB32, size 0
means XRGB32), but respect explicit demands for
TRANSPARENT_{NONE,ALPHA}.

Cheers,
Daniel


More information about the mesa-dev mailing list