[Cogl] [PATCH 3/3] Add CoglFrameTimings
Robert Bragg
robert at sixbynine.org
Tue Dec 4 06:56:54 PST 2012
>> +void
>> +cogl_onscreen_begin_frame (CoglOnscreen *onscreen,
>> + gint64 frame_time)
>> +{
>> + onscreen->frame_counter++;
>> + onscreen->current_frame_timings = (onscreen->current_frame_timings + 1) % COGL_ONSCREEN_MAX_FRAME_TIMINGS;
>> +
>> + if (onscreen->n_frame_timings < COGL_ONSCREEN_MAX_FRAME_TIMINGS)
>> + onscreen->n_frame_timings++;
>> + else
>> + cogl_object_unref (onscreen->frame_timings[onscreen->current_frame_timings]);
>> +
>> + onscreen->frame_timings[onscreen->current_frame_timings] = _cogl_frame_timings_new ();
>> + onscreen->frame_timings[onscreen->current_frame_timings]->frame_counter = onscreen->frame_counter;
>> + onscreen->frame_timings[onscreen->current_frame_timings]->frame_time = frame_time;
>> +}
>
> Assuming we leave it to applications to track the frame_time
> themselves as discussed above I think we can remove this api since we
> can increment onscreen->frame_counter in cogl_onscreen_swap_buffers
> instead and the CoglSwapInfo state can be created at the last moment
> before we notify the application of swap completion.
Er, apparently I forgot to send the bit "as discussed above", oops :-)
What I'd intended on saying was that it looks like the frame_time is
simply passed through Cogl un-interpreted and un-touched so it seems
like it can be left to applications to track this information
themselves in the closure that gets passed to
cogl_onscreen_add_swap_complete_callback(). The documentation also
seemed a bit asymmetric too since we don't document anything about the
required scale of frame_time that should be passed to
cogl_onscreen_begin_frame() but the docs for _get_frame_time()
guarantee the timestamp is in the timescale of g_get_monotonic_time().
regards,
- Robert
More information about the Cogl
mailing list