From 0294ff2a5cadddc8fcc77ba9a851f979f0b91fc3 Mon Sep 17 00:00:00 2001 From: Jesse Barnes Date: Mon, 8 Mar 2010 12:39:54 -0800 Subject: [PATCH] DRI2: throttle swaps at submission time too We need to throttle swaps here in addition to when the context is made current to avoid causing problems with clients that just swap. Throttling here also ensures our swaps get ordered as long as we block the client occasionally. Reported-by: Mario Kleiner Reviewed-by: Mario Kleiner Signed-off-by: Jesse Barnes --- hw/xfree86/dri2/dri2ext.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c index 7a9f8caa6..094d54dc0 100644 --- a/hw/xfree86/dri2/dri2ext.c +++ b/hw/xfree86/dri2/dri2ext.c @@ -384,6 +384,13 @@ ProcDRI2SwapBuffers(ClientPtr client) DixReadAccess | DixWriteAccess, &pDrawable, &status)) return status; + /* + * Ensures an out of control client can't exhaust our swap queue, and + * also orders swaps. + */ + if (DRI2ThrottleClient(client, pDrawable)) + return client->noClientException; + target_msc = vals_to_card64(stuff->target_msc_lo, stuff->target_msc_hi); divisor = vals_to_card64(stuff->divisor_lo, stuff->divisor_hi); remainder = vals_to_card64(stuff->remainder_lo, stuff->remainder_hi);