--- xc.orig/programs/Xserver/hw/xfree86/drivers/ati/r128.h 2004-08-08 14:22:29.000000000 +0200 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h 2004-08-08 15:11:32.996891824 +0200 @@ -314,6 +314,8 @@ unsigned char *AGP; /* Map */ int agpMode; + CARD32 pciCommand; + Bool CCEInUse; /* CCE is currently active */ int CCEMode; /* CCE mode that server/clients use */ int CCEFifoSize; /* Size of the CCE command FIFO */ --- xc.orig/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c 2004-08-08 14:22:29.000000000 +0200 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c 2004-08-08 15:11:32.999891368 +0200 @@ -440,6 +440,9 @@ int flags; unsigned long agpBase; + /* Save the old PCI command reg */ + info->pciCommand = pciReadLong(info->PciTag, PCI_CMD_STAT_REG); + if (drmAgpAcquire(info->drmFD) < 0) { xf86DrvMsg(pScreen->myNum, X_WARNING, "[agp] AGP not available\n"); return FALSE; @@ -623,6 +626,11 @@ OUTREG(R128_PCI_GART_PAGE, 1); /* Ensure AGP GART is used (for now) */ + /* Enable bus mastering in PCI config + space */ + pciWriteLong(info->PciTag, PCI_CMD_STAT_REG, + info->pciCommand | PCI_CMD_MASTER_ENABLE); + return TRUE; } @@ -1333,6 +1341,9 @@ drmAgpFree(info->drmFD, info->agpMemHandle); info->agpMemHandle = DRM_AGP_NO_HANDLE; drmAgpRelease(info->drmFD); + + /* Restore PCI command register */ + pciWriteLong(info->PciTag, PCI_CMD_STAT_REG, info->pciCommand); } if (info->pciMemHandle) { drmScatterGatherFree(info->drmFD, info->pciMemHandle);