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.
This commit is contained in:
Georges Basile Stavracas Neto 2018-12-04 00:14:01 -02:00
parent 20b271fa49
commit acacd3dd64

View File

@ -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 static gboolean
clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window, clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
ClutterStageView *view) ClutterStageView *view)
@ -613,9 +622,7 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
cogl_is_onscreen (fb) && cogl_is_onscreen (fb) &&
cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_SWAP_REGION); cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_SWAP_REGION);
has_buffer_age = has_buffer_age = cogl_is_onscreen (fb) && is_buffer_age_enabled ();
cogl_is_onscreen (fb) &&
cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_BUFFER_AGE);
/* NB: a zero width redraw clip == full stage redraw */ /* NB: a zero width redraw clip == full stage redraw */
if (stage_cogl->bounding_redraw_clip.width == 0) 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); CoglFramebuffer *framebuffer = clutter_stage_view_get_framebuffer (view);
gboolean has_buffer_age = gboolean has_buffer_age =
cogl_is_onscreen (framebuffer) && cogl_is_onscreen (framebuffer) &&
cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_BUFFER_AGE); is_buffer_age_enabled ();
float fb_scale; float fb_scale;
gboolean scale_is_fractional; gboolean scale_is_fractional;