From 3c79eb56b9b7370dceff6c6fbad727256417fd3d Mon Sep 17 00:00:00 2001 From: Robert Mader Date: Tue, 2 Aug 2022 20:00:55 +0200 Subject: [PATCH] compositor/native: Allow scanout for offscreen rotated views If a stage view uses an offscreen framebuffer exclusively for rotation and a Wayland client provides pre-rotated buffers, we should try to use scanout. This saves us one copy more than scanout in the onscreen case, i.e. two fullscreen copies in total. Offscreen rotation is notably used for all 90/270 degree rotations at the moment, as using display hardware for them is apparently more complex than for x-/y-flips and can even have detrimental effects on power consumption. This can be tested with `weston-simple-egl`. Part-of: --- src/compositor/meta-compositor-view-native.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/compositor/meta-compositor-view-native.c b/src/compositor/meta-compositor-view-native.c index ccba0ef72..932d43a3b 100644 --- a/src/compositor/meta-compositor-view-native.c +++ b/src/compositor/meta-compositor-view-native.c @@ -98,10 +98,13 @@ find_scanout_candidate (MetaCompositorView *compositor_view, if (!META_IS_CRTC_KMS (crtc)) return FALSE; - framebuffer = clutter_stage_view_get_framebuffer (stage_view); + framebuffer = clutter_stage_view_get_onscreen (stage_view); if (!COGL_IS_ONSCREEN (framebuffer)) return FALSE; + if (clutter_stage_view_has_shadowfb (stage_view)) + return FALSE; + window_actor = meta_compositor_view_get_top_window_actor (compositor_view); if (!window_actor) return FALSE;