From 6df74e61afb7831ebf3fbab8782f46ddccbe262b Mon Sep 17 00:00:00 2001 From: Jesse Barnes Date: Mon, 8 Mar 2010 15:33:20 -0800 Subject: [PATCH] DRI2: truncate OML values to 32 bits We can only handle 32 bit values unless we totally virtualize the count, since the kernel only handles 32 bits itself. Rather than adding all that overhead, just tolerate the occasional missed event everytime the counter runs over. Reported-by: Mario Kleiner Signed-off-by: Jesse Barnes --- src/i830_dri.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/i830_dri.c b/src/i830_dri.c index e8f24247..fc178076 100644 --- a/src/i830_dri.c +++ b/src/i830_dri.c @@ -645,6 +645,12 @@ I830DRI2ScheduleSwap(ClientPtr client, DrawablePtr draw, DRI2BufferPtr front, BoxRec box; RegionRec region; + /* Truncate to match kernel interfaces; means occasional overflow + * misses, but that's generally not a big deal */ + *target_msc &= 0xffffffff; + divisor &= 0xffffffff; + remainder &= 0xffffffff; + swap_info = xcalloc(1, sizeof(DRI2FrameEventRec)); /* Drawable not displayed... just complete the swap */ @@ -849,6 +855,12 @@ I830DRI2ScheduleWaitMSC(ClientPtr client, DrawablePtr draw, CARD64 target_msc, int ret, pipe = I830DRI2DrawablePipe(draw); CARD64 current_msc; + /* Truncate to match kernel interfaces; means occasional overflow + * misses, but that's generally not a big deal */ + target_msc &= 0xffffffff; + divisor &= 0xffffffff; + remainder &= 0xffffffff; + /* Drawable not visible, return immediately */ if (pipe == -1) { DRI2WaitMSCComplete(client, draw, target_msc, 0, 0);