[mutter] clutter/frame-info: Add HW_CLOCK flag
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] clutter/frame-info: Add HW_CLOCK flag
- Date: Mon, 8 Mar 2021 10:19:07 +0000 (UTC)
commit 9f53b691c471187d5e07358cf0b1269c2480d294
Author: Ivan Molodetskikh <yalterz gmail com>
Date: Thu Jan 28 10:10:11 2021 +0300
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>
clutter/clutter/clutter-stage.h | 9 +++++++++
clutter/clutter/cogl/clutter-stage-cogl.c | 6 ++++++
src/tests/clutter/conform/frame-clock-timeline.c | 1 +
src/tests/clutter/conform/frame-clock.c | 1 +
4 files changed, 17 insertions(+)
---
diff --git a/clutter/clutter/clutter-stage.h b/clutter/clutter/clutter-stage.h
index 441b10ba62..758cfade68 100644
--- a/clutter/clutter/clutter-stage.h
+++ b/clutter/clutter/clutter-stage.h
@@ -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
diff --git a/clutter/clutter/cogl/clutter-stage-cogl.c b/clutter/clutter/cogl/clutter-stage-cogl.c
index b9f5af6e40..165e2eceac 100644
--- a/clutter/clutter/cogl/clutter-stage-cogl.c
+++ b/clutter/clutter/cogl/clutter-stage-cogl.c
@@ -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);
}
diff --git a/src/tests/clutter/conform/frame-clock-timeline.c
b/src/tests/clutter/conform/frame-clock-timeline.c
index 7e5798b4e2..cee2d369f3 100644
--- a/src/tests/clutter/conform/frame-clock-timeline.c
+++ b/src/tests/clutter/conform/frame-clock-timeline.c
@@ -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);
diff --git a/src/tests/clutter/conform/frame-clock.c b/src/tests/clutter/conform/frame-clock.c
index a055992b3a..1354c8423e 100644
--- a/src/tests/clutter/conform/frame-clock.c
+++ b/src/tests/clutter/conform/frame-clock.c
@@ -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,
};
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]