Honor request for (no) alpha channel in SHM windows


Currently, all QWaylandShmWindows are ARGB32, even if the
application did not request an alpha channel (most toplevel
windows without client-side decoration).

Instead, create an ARGB32 or RGB32 buffer depending on whether
the surface requested an alpha channel. In order to do this,
set the red/green/blue channel of the QSurfaceFormat to 8 (since
that's all we support right now). Alpha channel is set to 8 or 0
depending on whether the surface requested alpha.

Due to client-side decorations we cannot know in advance whether we
need an alpha channel, so we have to update the surface format in
setWindowFlags.

While it doesn't particularly matter from the compositor's POV
(ARGB and XRGB are the same size and there's the opaque region
on the surface), Qt's backing store can skip certain steps in
the rendering, such as clearing the paint region before painting
when the surface is opaque.

Change-Id: I7b74f19ddb05d8ca9ae325f8fd5f42f41875cc51
Reviewed-by: David Redondo <qt@david-redondo.de>
Reviewed-by: Xaver Hugl <xaver.hugl@kde.org>
commitac1aaf1e039c6e549e0aafab42439692db351b57
parent7fe2869f5daa2f5496368a57a3ad1e3eeb9d425c
authorKai Uwe Broulik <kde@privat.broulik.de>
committerKai Uwe Broulik <kde@privat.broulik.de>
commit timeMon, 10 Mar 2025 09:47:37 +0100