$Id: 009_ati_r128_retry_idle_until_timeout.diff 2011 2004-11-04 14:25:23Z branden $ Attempt to mitigate serious DRI performance problems on Rage 128 chips by retrying CCE idle commands until the timeout is reached. See Debian #223089, #236187, #236373, #243436. This patch by Daniel Jacobowitz. Not submitted to XFree86 upstream. --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c~ 2004-06-01 12:17:33.000000000 -0500 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c 2004-06-01 12:21:37.000000000 -0500 @@ -237,17 +237,23 @@ i = 0; do { ret = drmCommandNone(info->drmFD, DRM_R128_CCE_IDLE); - } while ( ret && errno == EBUSY && i++ < R128_IDLE_RETRY ); + } while ( ret && errno == EBUSY && i++ < (R128_IDLE_RETRY * R128_IDLE_RETRY) ); if (ret && ret != -EBUSY) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "%s: CCE idle %d\n", __FUNCTION__, ret); } + if (i > R128_IDLE_RETRY) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "%s: (DEBUG) CCE idle took i = %d\n", __FUNCTION__, i); + } + if (ret == 0) return; xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Idle timed out, resetting engine...\n"); + R128CCE_STOP(pScrn, info); R128EngineReset(pScrn); /* Always restart the engine when doing CCE 2D acceleration */