Re: [AD] X vsync emulation (timing) |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- To: alleg-developers@xxxxxxxxxx
- Subject: Re: [AD] X vsync emulation (timing)
- From: Chris <chris.kcat@xxxxxxxxxx>
- Date: Thu, 18 Nov 2004 18:59:47 -0800
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:return-path:message-id:date:from:user-agent:x-accept-language:mime-version:to:subject:references:in-reply-to:x-enigmail-version:x-enigmail-supports:content-type:content-transfer-encoding; b=HjdU+2UqHWqfI73BZw8qnm43Ajiou+4a5Oj0MDBRME5fHQ1Zl8zDm2Df84wf25WCMXnNvUDEIjA0z0Ewcf+DZGpHFtSYmvOaHCZrhafZjcUuvPpX9qo7Xe3FiVU/0PGjfYAkLKteWVsYvt8NUYk51uZdIno80Oswbov2XrlNpMA=
Peter Wang wrote:
Chris wrote:
True.. but I think the timer should be designed so it attempts to
increment at the speed of the reported refresh rate, instead of a flat
100Hz.
How do you propose to do that?
Perhaps something along the lines of:
void x_retrace_proc(void)
{
static u_int64_t x_vsync_hack = 0;
static unsigned int last_retrace_count = 0;
x_vsync_hack++;
retrace_count = (unsigned int)(x_vsync_hack *
(u_int64_t)refresh_rate / 100LL);
if(retrace_count != last_retrace_count)
{
last_retrace_count = retrace_count;
if(retrace_proc)
retrace_proc();
}
}
? You'd need to install that as a bg_func and make sure the timer that
updates retrace_count is never installed, but it should work.