Add gdk_frame_timings_get/set_slept_before()
Add functions that tell us whether the main loop slept before we drew a frame. Blocking with the frame clock frozen doesn't count as sleeping. We'll use this to advertise to the compositor whether we are drawing as fast as possible (and it should do the same) or timing frames carefully (and it should do the same.) https://bugzilla.gnome.org/show_bug.cgi?id=685460
This commit is contained in:
@ -23,13 +23,15 @@ struct _GdkFrameTimings
|
||||
{
|
||||
guint ref_count;
|
||||
|
||||
gboolean complete;
|
||||
gint64 frame_counter;
|
||||
guint64 cookie;
|
||||
gint64 frame_time;
|
||||
gint64 drawn_time;
|
||||
gint64 presentation_time;
|
||||
gint64 refresh_interval;
|
||||
|
||||
guint complete : 1;
|
||||
guint slept_before : 1;
|
||||
};
|
||||
|
||||
G_DEFINE_BOXED_TYPE (GdkFrameTimings, gdk_frame_timings,
|
||||
@ -111,6 +113,23 @@ gdk_frame_timings_set_complete (GdkFrameTimings *timings,
|
||||
timings->complete = complete;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_frame_timings_get_slept_before (GdkFrameTimings *timings)
|
||||
{
|
||||
g_return_val_if_fail (timings != NULL, FALSE);
|
||||
|
||||
return timings->slept_before;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_frame_timings_set_slept_before (GdkFrameTimings *timings,
|
||||
gboolean slept_before)
|
||||
{
|
||||
g_return_if_fail (timings != NULL);
|
||||
|
||||
timings->slept_before = slept_before;
|
||||
}
|
||||
|
||||
gint64
|
||||
gdk_frame_timings_get_frame_time (GdkFrameTimings *timings)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user