compositor/sync-ring: Allow the gpu_fence to be moved
When the compositor inserts two waits in a frame, such as f606a4424a
,
the second insertion shouldn't break the ring's state machine as easily
as it does. We can instead merge the two GL waits into one by simply moving
the GL fence to the latest insertion. Each insertion still does its own X11
sync though.
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3384
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3685>
This commit is contained in:

committed by
Marge Bot

parent
82c0f9c57d
commit
22689d722a
@ -544,20 +544,29 @@ gboolean
|
|||||||
meta_sync_ring_insert_wait (void)
|
meta_sync_ring_insert_wait (void)
|
||||||
{
|
{
|
||||||
MetaSyncRing *ring = meta_sync_ring_get ();
|
MetaSyncRing *ring = meta_sync_ring_get ();
|
||||||
|
MetaSync *sync;
|
||||||
|
|
||||||
if (!ring)
|
if (!ring)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
g_return_val_if_fail (ring->xdisplay != NULL, FALSE);
|
g_return_val_if_fail (ring->xdisplay != NULL, FALSE);
|
||||||
|
|
||||||
if (ring->current_sync->state != META_SYNC_STATE_READY)
|
sync = ring->current_sync;
|
||||||
|
|
||||||
|
if (sync->state == META_SYNC_STATE_WAITING)
|
||||||
|
{
|
||||||
|
meta_gl_delete_sync (sync->gpu_fence);
|
||||||
|
sync->gpu_fence = 0;
|
||||||
|
sync->state = META_SYNC_STATE_READY;
|
||||||
|
}
|
||||||
|
else if (sync->state != META_SYNC_STATE_READY)
|
||||||
{
|
{
|
||||||
meta_warning ("MetaSyncRing: Sync object is not ready -- were events handled properly?");
|
meta_warning ("MetaSyncRing: Sync object is not ready -- were events handled properly?");
|
||||||
if (!meta_sync_ring_reboot (ring->xdisplay))
|
if (!meta_sync_ring_reboot (ring->xdisplay))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
meta_sync_insert (ring->current_sync);
|
meta_sync_insert (sync);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user