From 8eb0ff8a1937b9dfd96998013c261ec01aef2041 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Tue, 3 Dec 2024 09:14:46 -0600 Subject: [PATCH] compositor: re-order paint node placeholder checks Doing these in the wrong order breaks content protection, and breaks placing direct-display paint nodes on underlays. Fixes: 827e2276 ("gl-renderer: Draw holes on primary plane for the view on underlay") Signed-off-by: Derek Foreman (cherry picked from commit 53189ebb89df65bee66088202a863cc5caec5af3) --- libweston/compositor.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/libweston/compositor.c b/libweston/compositor.c index 8c63f0a2a..c10e0b738 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -217,14 +217,22 @@ maybe_replace_paint_node(struct weston_paint_node *pnode) pnode->draw_solid = false; pnode->is_direct = false; - if (buffer->direct_display) { + /* Check for content protection first, as we should always prevent + * the rendering of protected content. + */ + if (surface->protection_mode == + WESTON_SURFACE_PROTECTION_MODE_ENFORCED && + (recording_censor || unprotected_censor)) { pnode->draw_solid = true; - pnode->is_direct = true; pnode->is_fully_opaque = true; pnode->is_fully_blended = false; pnode->solid = placeholder_color; return; } + /* Check if we need a hole before we check direct-display, otherwise + * we'll end up drawing an opaque placeholder over direct_display + * paint nodes when we place them on underlays. + */ if (pnode->need_hole) { pnode->draw_solid = true; pnode->is_fully_opaque = true; @@ -234,15 +242,13 @@ maybe_replace_paint_node(struct weston_paint_node *pnode) }; return; } - if (surface->protection_mode != - WESTON_SURFACE_PROTECTION_MODE_ENFORCED) - return; - - if (recording_censor || unprotected_censor) { + if (buffer->direct_display) { pnode->draw_solid = true; + pnode->is_direct = true; pnode->is_fully_opaque = true; pnode->is_fully_blended = false; pnode->solid = placeholder_color; + return; } }