From 4f3c37a1f17ffcfbbff71d217e1caad3d0148c90 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 7 Nov 2013 14:17:12 -0800 Subject: [PATCH] present: Round fake MSC computations intead of truncating If the timer fired too early, we'd sometimes mis-compute the MSC for fake vblanks. Rounding the computation to the nearest MSC fixes this nicely. Signed-off-by: Keith Packard Reviewed-by: Adam Jackson --- present/present_fake.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/present/present_fake.c b/present/present_fake.c index a677592..e550e98 100644 --- a/present/present_fake.c +++ b/present/present_fake.c @@ -42,7 +42,7 @@ present_fake_get_ust_msc(ScreenPtr screen, uint64_t *ust, uint64_t *msc) present_screen_priv_ptr screen_priv = present_screen_priv(screen); *ust = GetTimeInMicros(); - *msc = *ust / screen_priv->fake_interval; + *msc = (*ust + screen_priv->fake_interval / 2) / screen_priv->fake_interval; return Success; } -- 2.7.4