backend-drm: Ignore views with fully transparent solid buffers

Some client use subsurfaces with fully transparent single-pixel buffers
for various reasons, such as making it easier to order trees of
subsurfaces. As they are invisible we can simply ignore them in the
scene graph.

This allows us to use direct-scanout/plane-only in more circumstances,
as ensured in the test.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
This commit is contained in:
Robert Mader 2025-09-26 17:22:11 +02:00
parent 1465362e9f
commit 79ade4c165
2 changed files with 9 additions and 4 deletions

View file

@ -876,6 +876,13 @@ drm_output_propose_state(struct weston_output *output_base,
continue;
}
if (pnode->view->alpha == 0.0f ||
(pnode->draw_solid && pnode->solid.a == 0.0f)) {
drm_debug(b, "\t\t\t\t[view] ignoring view %p " \
"(fully transparent)\n", ev);
continue;
}
/* Ignore views we know to be totally occluded. */
pixman_region32_init(&clipped_view);
pixman_region32_intersect(&clipped_view,

View file

@ -211,9 +211,7 @@ TEST(drm_offload_fullscreen) {
/*
* Test that a fullscreen client with fullscreen-sized buffer and a fully
* transparent overlay surface is *not* presented via direct-scanout.
*
* This should be optimized in the future.
* transparent overlay surface is presented via direct-scanout.
*/
TEST(drm_offload_fullscreen_transparent_overlay) {
struct xdg_client *xdg_client;
@ -278,7 +276,7 @@ TEST(drm_offload_fullscreen_transparent_overlay) {
&result);
wl_surface_commit(surface);
presentation_wait_nofail(client, &result);
test_assert_enum(result, FB_PRESENTED);
test_assert_enum(result, FB_PRESENTED_ZERO_COPY);
wp_viewport_destroy(overlay_viewport);
wl_subsurface_destroy(overlay_subsurface);