MetaRendererNative: Wait for the last flip callback before flipping

We might still end up in swap-buffer without the previous flip callback
having been invoked. This can happen if there are two monitors, and we
manage to draw before having all monitor flip callbacks invoked.

https://bugzilla.gnome.org/show_bug.cgi?id=774923
This commit is contained in:
Jonas Ådahl 2016-11-23 22:41:22 +08:00 committed by Rui Matos
parent 77384ffa9a
commit 227187f1f1

View File

@ -800,12 +800,22 @@ meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen *onscreen,
MetaRendererNative *renderer_native = egl_renderer->platform;
CoglOnscreenEGL *egl_onscreen = onscreen->winsys;
MetaOnscreenNative *onscreen_native = egl_onscreen->platform;
MetaBackend *backend = meta_get_backend ();
MetaMonitorManager *monitor_manager =
meta_backend_get_monitor_manager (backend);
MetaMonitorManagerKms *monitor_manager_kms =
META_MONITOR_MANAGER_KMS (monitor_manager);
CoglFrameInfo *frame_info;
frame_info = g_queue_peek_tail (&onscreen->pending_frame_infos);
frame_info->global_frame_counter = renderer_native->frame_counter;
g_warn_if_fail (!onscreen_native->pending_queue_swap_notify);
/*
* Wait for the flip callback before continuing, as we might have started the
* animation earlier due to the animation being driven by some other monitor.
*/
while (onscreen_native->pending_flips)
meta_monitor_manager_kms_wait_for_flip (monitor_manager_kms);
parent_vtable->onscreen_swap_buffers_with_damage (onscreen,
rectangles,