window-actor/x11: Queue full actor redraw when redraw queued

With frame timings, we might end up in a situation where a frame drawn
is expected, but no damage was posted. Up until now, mutter handled
this, if the window wasn't completely hidden, by posting a 1x1 pixel
damage region. The problem with this is that we now are a bit more
aggressive optimizing away no-op redraws, meaning we still might end up
not drawing, making things get stuck.

Fix this by doing a full actor redraw, as that is the only reliable way
to both a new frame being drawn, as well as the actor in question itself
getting redrawn.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1516
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3369
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1471
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1754>
This commit is contained in:
Jonas Ådahl 2021-03-05 09:55:34 +01:00 committed by Marge Bot
parent 44a4e61665
commit 9b90b5a1b0

View File

@ -483,10 +483,12 @@ meta_window_actor_x11_queue_frame_drawn (MetaWindowActor *actor,
* damage or any unobscured, or while we had the window frozen * damage or any unobscured, or while we had the window frozen
* (e.g. during an interactive resize.) We need to make sure that the * (e.g. during an interactive resize.) We need to make sure that the
* before_paint/after_paint functions get called, enabling us to * before_paint/after_paint functions get called, enabling us to
* send a _NET_WM_FRAME_DRAWN. We do a 1-pixel redraw to get * send a _NET_WM_FRAME_DRAWN. We need to do full damage to ensure that
* consistent timing with non-empty frames. If the window * the window is actually repainted, otherwise any subregion we would pass
* is completely obscured, or completely off screen we fire off the * might end up being either outside of any stage view, or be occluded by
* send_frame_messages timeout. * something else, which could potentially result in no frame being drawn
* after all. If the window is completely obscured, or completely off
* screen we fire off the send_frame_messages timeout.
*/ */
if (is_obscured || if (is_obscured ||
!clutter_actor_peek_stage_views (CLUTTER_ACTOR (actor))) !clutter_actor_peek_stage_views (CLUTTER_ACTOR (actor)))
@ -495,8 +497,7 @@ meta_window_actor_x11_queue_frame_drawn (MetaWindowActor *actor,
} }
else if (surface) else if (surface)
{ {
const cairo_rectangle_int_t clip = { 0, 0, 1, 1 }; clutter_actor_queue_redraw (CLUTTER_ACTOR (surface));
clutter_actor_queue_redraw_with_clip (CLUTTER_ACTOR (surface), &clip);
actor_x11->repaint_scheduled = TRUE; actor_x11->repaint_scheduled = TRUE;
} }
} }