From 79ade4c1654ea9f0ae42d57f0b735c7a9c325e62 Mon Sep 17 00:00:00 2001 From: Robert Mader Date: Fri, 26 Sep 2025 17:22:11 +0200 Subject: [PATCH] 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 --- libweston/backend-drm/state-propose.c | 7 +++++++ tests/drm-offload-test.c | 6 ++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/libweston/backend-drm/state-propose.c b/libweston/backend-drm/state-propose.c index b19b1a0a2..5a2eba616 100644 --- a/libweston/backend-drm/state-propose.c +++ b/libweston/backend-drm/state-propose.c @@ -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, diff --git a/tests/drm-offload-test.c b/tests/drm-offload-test.c index aa8188509..97556e02b 100644 --- a/tests/drm-offload-test.c +++ b/tests/drm-offload-test.c @@ -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);