From b1648e75a8ca5b604135ee77d0a848747d73233b Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Fri, 28 Aug 2020 23:01:11 -0300 Subject: [PATCH] monitor-stream-src: Blit scanout when available When there's a direct scanout set in the stage view, we have to use it instead of the view's regular onscreen framebuffer. Use the new CoglScanout API to implement blitting to the stream framebuffer. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1421 --- .../meta-screen-cast-monitor-stream-src.c | 32 +++++++++++++------ 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/src/backends/meta-screen-cast-monitor-stream-src.c b/src/backends/meta-screen-cast-monitor-stream-src.c index 78aba0a95..760fe7471 100644 --- a/src/backends/meta-screen-cast-monitor-stream-src.c +++ b/src/backends/meta-screen-cast-monitor-stream-src.c @@ -520,6 +520,7 @@ meta_screen_cast_monitor_stream_src_record_to_framebuffer (MetaScreenCastStreamS { ClutterStageView *view = CLUTTER_STAGE_VIEW (l->data); CoglFramebuffer *view_framebuffer; + CoglScanout *scanout; MetaRectangle view_layout; int x, y; @@ -528,19 +529,30 @@ meta_screen_cast_monitor_stream_src_record_to_framebuffer (MetaScreenCastStreamS if (!meta_rectangle_overlap (&logical_monitor_layout, &view_layout)) continue; - view_framebuffer = clutter_stage_view_get_framebuffer (view); - x = (int) roundf ((view_layout.x - logical_monitor_layout.x) * view_scale); y = (int) roundf ((view_layout.y - logical_monitor_layout.y) * view_scale); - if (!cogl_blit_framebuffer (view_framebuffer, - framebuffer, - 0, 0, - x, y, - cogl_framebuffer_get_width (view_framebuffer), - cogl_framebuffer_get_height (view_framebuffer), - error)) - return FALSE; + scanout = clutter_stage_view_peek_scanout (view); + if (scanout) + { + if (!cogl_scanout_blit_to_framebuffer (scanout, + framebuffer, + x, y, + error)) + return FALSE; + } + else + { + view_framebuffer = clutter_stage_view_get_framebuffer (view); + if (!cogl_blit_framebuffer (view_framebuffer, + framebuffer, + 0, 0, + x, y, + cogl_framebuffer_get_width (view_framebuffer), + cogl_framebuffer_get_height (view_framebuffer), + error)) + return FALSE; + } } cogl_framebuffer_finish (framebuffer);