clutter/frame-info: Add HW_CLOCK flag

A flag indicating whether the presentation timestamp was provided by
the display hardware (rather than sampled in user space).

It will be used for the presentation-time Wayland protocol.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1484>
This commit is contained in:
Ivan Molodetskikh 2021-01-28 10:10:11 +03:00 committed by Marge Bot
parent 9d54ef3994
commit 9f53b691c4
4 changed files with 17 additions and 0 deletions

View File

@ -114,6 +114,13 @@ struct _ClutterPerspective
gfloat z_far;
};
typedef enum
{
CLUTTER_FRAME_INFO_FLAG_NONE = 0,
/* presentation_time timestamp was provided by the hardware */
CLUTTER_FRAME_INFO_FLAG_HW_CLOCK = 1 << 0,
} ClutterFrameInfoFlag;
/**
* ClutterFrameInfo: (skip)
*/
@ -122,6 +129,8 @@ struct _ClutterFrameInfo
int64_t frame_counter;
int64_t presentation_time;
float refresh_rate;
ClutterFrameInfoFlag flags;
};
typedef struct _ClutterCapture

View File

@ -318,6 +318,7 @@ swap_framebuffer (ClutterStageWindow *stage_window,
.frame_counter = priv->global_frame_counter,
.refresh_rate = clutter_stage_view_get_refresh_rate (view),
.presentation_time = g_get_monotonic_time (),
.flags = CLUTTER_FRAME_INFO_FLAG_NONE,
};
priv->global_frame_counter++;
@ -825,12 +826,17 @@ frame_cb (CoglOnscreen *onscreen,
else
{
ClutterFrameInfo clutter_frame_info;
ClutterFrameInfoFlag flags = CLUTTER_FRAME_INFO_FLAG_NONE;
if (cogl_frame_info_is_hw_clock (frame_info))
flags |= CLUTTER_FRAME_INFO_FLAG_HW_CLOCK;
clutter_frame_info = (ClutterFrameInfo) {
.frame_counter = cogl_frame_info_get_global_frame_counter (frame_info),
.refresh_rate = cogl_frame_info_get_refresh_rate (frame_info),
.presentation_time =
ns2us (cogl_frame_info_get_presentation_time (frame_info)),
.flags = flags,
};
clutter_stage_view_notify_presented (view, &clutter_frame_info);
}

View File

@ -14,6 +14,7 @@ timeline_frame_clock_frame (ClutterFrameClock *frame_clock,
frame_info = (ClutterFrameInfo) {
.presentation_time = g_get_monotonic_time (),
.refresh_rate = refresh_rate,
.flags = CLUTTER_FRAME_INFO_FLAG_NONE,
};
clutter_frame_clock_notify_presented (frame_clock, &frame_info);
clutter_frame_clock_schedule_update (frame_clock);

View File

@ -32,6 +32,7 @@ init_frame_info (ClutterFrameInfo *frame_info,
*frame_info = (ClutterFrameInfo) {
.presentation_time = presentation_time_us,
.refresh_rate = refresh_rate,
.flags = CLUTTER_FRAME_INFO_FLAG_NONE,
};
}