From: Ian Romanick <idr@freedesktop.org>
To: "Michel Dänzer" <michel@daenzer.net>
Cc: Joakim Plate <elupus@ecce.se>, dri-devel@lists.freedesktop.org
Subject: Re: RFC: Change OML_sync_control UST to CLOCK_MONOTONIC
Date: Tue, 12 Jun 2012 20:04:03 -0700 [thread overview]
Message-ID: <4FD80323.6060601@freedesktop.org> (raw)
In-Reply-To: <1339408948.25194.634.camel@thor.local>
On 06/11/2012 03:02 AM, Michel Dänzer wrote:
> On Son, 2012-06-10 at 11:56 +0000, Joakim Plate wrote:
>> Hi,
>>
>> I'm currently trying to make use of OML_sync_control extension to schedule
>> presentation of video frames in xbmc.
>>
>> I've run into somewhat of a snag. It seem the spec doesn't specify what
>> time the UST clock really is, nor can i find any mention of it elsewhere
>> in docs.
>>
>> Code wise it seem to be using do_gettimeofday(), which seems like a rather
>> poor choice given that it can jump forward and back in time due to
>> settimeofday calls.
>>
>> We normally make use of clock_gettime(CLOCK_MONOTONIC) to timestamp display
>> of video frames, so to avoid major changes I'd need a way to convert to
>> gettimeofday (seem same as CLOCK_REALTIME).
>>
>> Currently i'm trying:
>> struct timespec mon, rel;
>> clock_gettime(CLOCK_MONOTONIC,&mon);
>> clock_gettime(CLOCK_REALTIME ,&rel);
>>
>> ticks += (rel.tv_sec - mon.tv_sec) * 1000000000;
>> ticks += (rel.tv_nsec - mon.tv_nsec);
>>
>> To convert between the two, but that is quite a hack both in the
>> possibility of clock changes and scheduling errors.
>>
>> Is there a better way, or perhaps the DRI code should use CLOCK_MONOTONIC
>> in the first place?
>
> From the GLX_OML_sync_control spec:
>
> The Unadjusted System Time (or UST) is a 64-bit monotonically
> increasing counter [...]
>
> So, without having thought a lot about potential ramifications, I'm
> inclined to say that CLOCK_MONOTONIC should indeed be used.
Maybe. Isn't CLOCK_MONOTONIC per-process? UST is supposed to be
relatively consistent across the system. Some relevant was elided above:
"The Unadjusted System Time (or UST) is a 64-bit monotonically
increasing counter that is available throughout the system. UST
is not a resource that is controlled by OpenGL, so it is not
defined further as part of this extension."
do_gettimeofday is definitely the wrong choice, but it was the best
thing that I knew to use back in 2002(ish) when I wrote that code. I'm
just not sure CLOCK_MONOTONIC is quite right either.
What's behind door #3? :)
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2012-06-13 3:05 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-10 11:56 RFC: Change OML_sync_control UST to CLOCK_MONOTONIC Joakim Plate
2012-06-11 10:02 ` Michel Dänzer
2012-06-13 3:04 ` Ian Romanick [this message]
2012-06-13 7:42 ` Michel Dänzer
2012-06-13 20:11 ` Joakim Plate
2012-06-13 20:18 ` Jerome Glisse
2012-06-14 17:19 ` Joakim Plate
2012-06-14 18:17 ` Jerome Glisse
2012-06-14 18:21 ` Jerome Glisse
2012-06-13 8:11 ` Julien Cristau
[not found] <mailman.63.1339700426.712.dri-devel@lists.freedesktop.org>
2012-06-14 20:50 ` Mario Kleiner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FD80323.6060601@freedesktop.org \
--to=idr@freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=elupus@ecce.se \
--cc=michel@daenzer.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.