cogl/onscreen/egl: Record CPU time only when GPU time can be queried

These are only useful together at the moment.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3080>
This commit is contained in:
Dor Askayo 2023-06-19 23:42:32 +03:00 committed by Marge Bot
parent e7a210d963
commit b43fb9fd98

View File

@ -313,13 +313,9 @@ cogl_onscreen_egl_swap_buffers_with_damage (CoglOnscreen *onscreen,
{ {
info->gpu_time_before_buffer_swap_ns = info->gpu_time_before_buffer_swap_ns =
cogl_context_get_gpu_time_ns (context); cogl_context_get_gpu_time_ns (context);
} info->cpu_time_before_buffer_swap_us = g_get_monotonic_time ();
info->cpu_time_before_buffer_swap_us = g_get_monotonic_time (); /* Set up a timestamp query for when all rendering will be finished. */
/* Set up a timestamp query for when all rendering will be finished. */
if (cogl_has_feature (context, COGL_FEATURE_ID_TIMESTAMP_QUERY))
{
info->timestamp_query = info->timestamp_query =
cogl_framebuffer_create_timestamp_query (COGL_FRAMEBUFFER (onscreen)); cogl_framebuffer_create_timestamp_query (COGL_FRAMEBUFFER (onscreen));
} }