frametimings: reuse previous frame timing in common case
Typically, there won't be any references on old frame timings except for the most recent timing. So instead of discarding these and re-entering gslice twice, just steal the old frame timing and reuse it. https://bugzilla.gnome.org/show_bug.cgi?id=765592
This commit is contained in:
committed by
Matthias Clasen
parent
8f64e4a8e3
commit
f27dd21426
@ -17,6 +17,8 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "gdkframeclockprivate.h"
|
||||
|
||||
/**
|
||||
@ -48,6 +50,21 @@ _gdk_frame_timings_new (gint64 frame_counter)
|
||||
return timings;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gdk_frame_timings_steal (GdkFrameTimings *timings,
|
||||
gint64 frame_counter)
|
||||
{
|
||||
if (timings->ref_count == 1)
|
||||
{
|
||||
memset (timings, 0, sizeof *timings);
|
||||
timings->ref_count = 1;
|
||||
timings->frame_counter = frame_counter;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_frame_timings_ref:
|
||||
* @timings: a #GdkFrameTimings
|
||||
|
||||
Reference in New Issue
Block a user