1
0
Fork 0

renderer/native: Discard pending swaps when rebuilding views

It's analogous to discard_pending_page_flips but represents swaps that
might become flips after the next frame notification callbacks, thanks
to triple buffering. Since the views are being rebuilt and their onscreens
are about to be destroyed, turning those swaps into more flips/posts would
just lead to unexpected behaviour (like trying to flip on a half-destroyed
inactive CRTC).

(cherry picked from commit ff972c6ef5f9f39302a5345aa85cd2bedf3acdcc)
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1441>
Signed-off-by: Mingi Sung <sungmg@saltyming.net>
This commit is contained in:
Daniel van Vugt 2021-11-04 16:09:52 +08:00 committed by Mingi Sung
parent 472a1cc51d
commit cbe7aa7ae6
Signed by: sungmg
GPG key ID: 41BAFD6FFD8036C5

View file

@ -1520,6 +1520,26 @@ detach_onscreens (MetaRenderer *renderer)
}
}
static void
discard_pending_swaps (MetaRenderer *renderer)
{
GList *views = meta_renderer_get_views (renderer);;
GList *l;
for (l = views; l; l = l->next)
{
ClutterStageView *stage_view = l->data;
CoglFramebuffer *fb = clutter_stage_view_get_onscreen (stage_view);
CoglOnscreen *onscreen;
if (!COGL_IS_ONSCREEN (fb))
continue;
onscreen = COGL_ONSCREEN (fb);
meta_onscreen_native_discard_pending_swaps (onscreen);
}
}
static void
meta_renderer_native_rebuild_views (MetaRenderer *renderer)
{
@ -1530,6 +1550,7 @@ meta_renderer_native_rebuild_views (MetaRenderer *renderer)
MetaRendererClass *parent_renderer_class =
META_RENDERER_CLASS (meta_renderer_native_parent_class);
discard_pending_swaps (renderer);
meta_kms_discard_pending_page_flips (kms);
g_hash_table_remove_all (renderer_native->mode_set_updates);