1
0
Fork 0

backends/native: Make await_flush later and inlined

"Later" as in after GL is finished rendering so as to not block the deadline
timer from updating the cursor smoothly during long GL renders. Indeed this
could make a primary plane frame late in some cases but that's only when
going from idle to active, so there is no previous frame to observe stutter
within the primary plane. It does however fix observable stutter in the
cursor plane by not dropping/stalling an otherwise good cursor update in a
continuous stream of cursor updates.

"Inlined" as in we don't need most of `meta_kms_device_await_flush`. The
important part is that it calls `disarm_crtc_frame_deadline_timer` to avoid
attempting two posts at once. So that's all that is kept.

This also fixes a deadlock in triple buffering. By not cancelling the
cursor update during a GL render we're also not cancelling a primary plane
update that might have already been piggybacked onto it by `queue_update`.

Cherry picked from !3149
This commit is contained in:
Daniel van Vugt 2023-07-26 17:27:10 +08:00
parent 17648c4b2d
commit bd3b5b64ee
2 changed files with 3 additions and 5 deletions

View file

@ -1586,9 +1586,11 @@ meta_kms_impl_device_handle_update (MetaKmsImplDevice *impl_device,
meta_kms_update_merge_from (crtc_frame->pending_update, update);
meta_kms_update_free (update);
update = g_steal_pointer (&crtc_frame->pending_update);
disarm_crtc_frame_deadline_timer (crtc_frame);
}
if (crtc_frame->deadline.armed)
disarm_crtc_frame_deadline_timer (crtc_frame);
meta_kms_device_handle_flush (priv->device, latch_crtc);
feedback = do_process (impl_device, latch_crtc, update, flags);

View file

@ -1899,11 +1899,7 @@ meta_onscreen_native_before_redraw (CoglOnscreen *onscreen,
ClutterFrame *frame)
{
MetaOnscreenNative *onscreen_native = META_ONSCREEN_NATIVE (onscreen);
MetaCrtcKms *crtc_kms = META_CRTC_KMS (onscreen_native->crtc);
MetaKmsCrtc *kms_crtc = meta_crtc_kms_get_kms_crtc (crtc_kms);
meta_kms_device_await_flush (meta_kms_crtc_get_device (kms_crtc),
kms_crtc);
maybe_update_frame_sync (onscreen_native, frame);
}