[PATCH 1/3] present: Round fake MSC computations intead of truncating

Keith Packard keithp at keithp.com
Mon Nov 11 16:12:30 PST 2013


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 <keithp at keithp.com>
---
 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;
 }
 
-- 
1.8.4.2



More information about the xorg-devel mailing list