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 (cherry picked from commit b2c16a63d2127faa0ebd811fab65c8be97a74469) Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1441> Signed-off-by: Mingi Sung <sungmg@saltyming.net>
This commit is contained in:
parent
17ab8cbd70
commit
d7b8793f34
1 changed files with 18 additions and 12 deletions
|
@ -310,10 +310,6 @@ static void
|
||||||
maybe_update_longterm_max_duration_us (ClutterFrameClock *frame_clock,
|
maybe_update_longterm_max_duration_us (ClutterFrameClock *frame_clock,
|
||||||
ClutterFrameInfo *frame_info)
|
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) <
|
if ((frame_info->presentation_time - frame_clock->longterm_promotion_us) <
|
||||||
G_USEC_PER_SEC)
|
G_USEC_PER_SEC)
|
||||||
return;
|
return;
|
||||||
|
@ -443,21 +439,31 @@ clutter_frame_clock_notify_presented (ClutterFrameClock *frame_clock,
|
||||||
|
|
||||||
presented_frame->got_measurements = FALSE;
|
presented_frame->got_measurements = FALSE;
|
||||||
|
|
||||||
if (frame_info->cpu_time_before_buffer_swap_us != 0 &&
|
if ((frame_info->cpu_time_before_buffer_swap_us != 0 &&
|
||||||
frame_info->has_valid_gpu_rendering_duration)
|
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_to_swap_us, swap_to_rendering_done_us, swap_to_flip_us;
|
||||||
int64_t dispatch_time_us = presented_frame->dispatch_time_us;
|
int64_t dispatch_time_us = presented_frame->dispatch_time_us;
|
||||||
int64_t flip_time_us = presented_frame->flip_time_us;
|
int64_t flip_time_us = presented_frame->flip_time_us;
|
||||||
|
|
||||||
dispatch_to_swap_us =
|
if (frame_info->cpu_time_before_buffer_swap_us == 0)
|
||||||
frame_info->cpu_time_before_buffer_swap_us -
|
{
|
||||||
dispatch_time_us;
|
/* 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 =
|
swap_to_rendering_done_us =
|
||||||
frame_info->gpu_rendering_duration_ns / 1000;
|
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,
|
CLUTTER_NOTE (FRAME_TIMINGS,
|
||||||
"%s: update2dispatch %ld µs, dispatch2swap %ld µs, swap2render %ld µs, swap2flip %ld µs",
|
"%s: update2dispatch %ld µs, dispatch2swap %ld µs, swap2render %ld µs, swap2flip %ld µs",
|
||||||
|
|
Loading…
Reference in a new issue