summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/common/vblank.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-12-30 18:01:15 -0700
committerBrian Paul <[email protected]>2008-12-30 18:01:15 -0700
commitc789bd376f09c3b61617aeef6f5adbba2c541178 (patch)
treeb50aba807e609ef6084e52d814370a2cc761f1c8 /src/mesa/drivers/dri/common/vblank.c
parent369115e4c7a2985d880951fd8248deefa92025dd (diff)
parente8d7db31e2a6784c765911233cb3d888f612837f (diff)
Merge commit 'origin/master' into gallium-0.2
Conflicts: src/mesa/main/config.h
Diffstat (limited to 'src/mesa/drivers/dri/common/vblank.c')
-rw-r--r--src/mesa/drivers/dri/common/vblank.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/mesa/drivers/dri/common/vblank.c b/src/mesa/drivers/dri/common/vblank.c
index d610253fe6f..12aeaa108f7 100644
--- a/src/mesa/drivers/dri/common/vblank.c
+++ b/src/mesa/drivers/dri/common/vblank.c
@@ -130,9 +130,8 @@ int driWaitForMSC32( __DRIdrawablePrivate *priv,
if ( divisor != 0 ) {
- unsigned int target = (unsigned int)target_msc;
- unsigned int next = target;
- unsigned int r;
+ int64_t next = target_msc;
+ int64_t r;
int dont_wait = (target_msc == 0);
do {
@@ -154,9 +153,9 @@ int driWaitForMSC32( __DRIdrawablePrivate *priv,
*msc = vblank_to_msc(priv, vbl.reply.sequence);
- dont_wait = 0;
- if (target_msc != 0 && *msc == target)
+ if (!dont_wait && *msc == next)
break;
+ dont_wait = 0;
/* Assuming the wait-done test fails, the next refresh to wait for
* will be one that satisfies (MSC % divisor) == remainder. The
@@ -165,11 +164,12 @@ int driWaitForMSC32( __DRIdrawablePrivate *priv,
* If this refresh has already happened, we add divisor to obtain
* the next refresh after the current one that will satisfy it.
*/
- r = (*msc % (unsigned int)divisor);
- next = (*msc - r + (unsigned int)remainder);
- if (next <= *msc) next += (unsigned int)divisor;
+ r = ((uint64_t)*msc % divisor);
+ next = (*msc - r + remainder);
+ if (next <= *msc)
+ next += divisor;
- } while ( r != (unsigned int)remainder );
+ } while (r != remainder);
}
else {
/* If the \c divisor is zero, just wait until the MSC is greater