clutter/frame-clock: Record measurements of zero for cursor-only updates
But only if we've ever got actual swap measurements (COGL_FEATURE_ID_TIMESTAMP_QUERY). If it's supported then we now drop to double buffering and get optimal latency on a burst of cursor-only updates. Closes: https://launchpad.net/bugs/2023363 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1441>
This commit is contained in:
parent
463fc8b92c
commit
2dbca5ff39
@ -353,10 +353,6 @@ static void
|
||||
maybe_update_longterm_max_duration_us (ClutterFrameClock *frame_clock,
|
||||
ClutterFrameInfo *frame_info)
|
||||
{
|
||||
/* Do not update long-term max if there has been no measurement */
|
||||
if (!frame_clock->shortterm_max_update_duration_us)
|
||||
return;
|
||||
|
||||
if ((frame_info->presentation_time - frame_clock->longterm_promotion_us) <
|
||||
G_USEC_PER_SEC)
|
||||
return;
|
||||
@ -486,21 +482,31 @@ clutter_frame_clock_notify_presented (ClutterFrameClock *frame_clock,
|
||||
|
||||
presented_frame->got_measurements = FALSE;
|
||||
|
||||
if (frame_info->cpu_time_before_buffer_swap_us != 0 &&
|
||||
frame_info->has_valid_gpu_rendering_duration)
|
||||
if ((frame_info->cpu_time_before_buffer_swap_us != 0 &&
|
||||
frame_info->has_valid_gpu_rendering_duration) ||
|
||||
frame_clock->ever_got_measurements)
|
||||
{
|
||||
int64_t dispatch_to_swap_us, swap_to_rendering_done_us, swap_to_flip_us;
|
||||
int64_t dispatch_time_us = presented_frame->dispatch_time_us;
|
||||
int64_t flip_time_us = presented_frame->flip_time_us;
|
||||
|
||||
dispatch_to_swap_us =
|
||||
frame_info->cpu_time_before_buffer_swap_us -
|
||||
if (frame_info->cpu_time_before_buffer_swap_us == 0)
|
||||
{
|
||||
/* User thread cursor-only updates with no "swap": we do know
|
||||
* the combined time from dispatch to flip at least.
|
||||
*/
|
||||
dispatch_to_swap_us = 0;
|
||||
swap_to_flip_us = flip_time_us - dispatch_time_us;
|
||||
}
|
||||
else
|
||||
{
|
||||
dispatch_to_swap_us = frame_info->cpu_time_before_buffer_swap_us -
|
||||
dispatch_time_us;
|
||||
swap_to_flip_us = flip_time_us -
|
||||
frame_info->cpu_time_before_buffer_swap_us;
|
||||
}
|
||||
swap_to_rendering_done_us =
|
||||
frame_info->gpu_rendering_duration_ns / 1000;
|
||||
swap_to_flip_us =
|
||||
flip_time_us -
|
||||
frame_info->cpu_time_before_buffer_swap_us;
|
||||
|
||||
CLUTTER_NOTE (FRAME_TIMINGS,
|
||||
"%s: update2dispatch %ld µs, dispatch2swap %ld µs, swap2render %ld µs, swap2flip %ld µs",
|
||||
|
Loading…
x
Reference in New Issue
Block a user