From acacd3dd64ebb32d6c88c84f807e3cdaa221d836 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Tue, 4 Dec 2018 00:14:01 -0200 Subject: [PATCH] clutter/stage-cogl: Disable buffer age when painting red damage This is to ensure we're rendering a red damage area that actually represents what is being damaged. Fixes an always-fullscreen red damage on bare metal Wayland and GNOME Shell. --- clutter/clutter/cogl/clutter-stage-cogl.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/clutter/clutter/cogl/clutter-stage-cogl.c b/clutter/clutter/cogl/clutter-stage-cogl.c index 94f330dea..ad9dec304 100644 --- a/clutter/clutter/cogl/clutter-stage-cogl.c +++ b/clutter/clutter/cogl/clutter-stage-cogl.c @@ -576,6 +576,15 @@ calculate_scissor_region (cairo_rectangle_int_t *fb_clip_region, }; } +static inline gboolean +is_buffer_age_enabled (void) +{ + /* Buffer age is disabled when running with CLUTTER_PAINT=damage-region, + * to ensure the red damage represents the currently damaged area */ + return !(clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_DAMAGE_REGION) && + cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_BUFFER_AGE); +} + static gboolean clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window, ClutterStageView *view) @@ -613,9 +622,7 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window, cogl_is_onscreen (fb) && cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_SWAP_REGION); - has_buffer_age = - cogl_is_onscreen (fb) && - cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_BUFFER_AGE); + has_buffer_age = cogl_is_onscreen (fb) && is_buffer_age_enabled (); /* NB: a zero width redraw clip == full stage redraw */ if (stage_cogl->bounding_redraw_clip.width == 0) @@ -946,7 +953,7 @@ clutter_stage_cogl_get_dirty_pixel (ClutterStageWindow *stage_window, CoglFramebuffer *framebuffer = clutter_stage_view_get_framebuffer (view); gboolean has_buffer_age = cogl_is_onscreen (framebuffer) && - cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_BUFFER_AGE); + is_buffer_age_enabled (); float fb_scale; gboolean scale_is_fractional;