This patch is a backport of the i810 driver from X.org CVS HEAD as of November 16th, 2004. It fixes the refresh problem described in https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=132267 Kristian Høgsberg --- xc/programs/Xserver/hw/xfree86/drivers/i810/i830_driver.c.i810-update 2004-11-17 15:44:32.185880437 -0500 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i830_driver.c 2004-11-17 15:44:45.043070325 -0500 @@ -4354,6 +4354,13 @@ SaveHWOperatingState(pScrn); #endif + ResetState(pScrn, TRUE); + RestoreHWState(pScrn); + RestoreBIOSMemSize(pScrn); + if (IsPrimary(pScrn)) + I830UnbindGARTMemory(pScrn); + if (pI830->AccelInfoRec) + pI830->AccelInfoRec->NeedToSync = FALSE; if (IsPrimary(pScrn)) { if (!SetDisplayDevices(pScrn, pI830->savedDevices)) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, @@ -4364,14 +4371,6 @@ "Successfully set original devices\n"); } } - - ResetState(pScrn, TRUE); - RestoreHWState(pScrn); - RestoreBIOSMemSize(pScrn); - if (IsPrimary(pScrn)) - I830UnbindGARTMemory(pScrn); - if (pI830->AccelInfoRec) - pI830->AccelInfoRec->NeedToSync = FALSE; } /* --- xc/programs/Xserver/hw/xfree86/drivers/i810/i810_reg.h.i810-update 2004-11-17 15:44:32.153884941 -0500 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810_reg.h 2004-11-17 15:44:45.040070747 -0500 @@ -459,11 +459,11 @@ #define I830_HEAD_MASK 0x001FFFFC #define RING_START 0x08 -#define START_ADDR 0x00FFFFF8 +#define START_ADDR 0x03FFFFF8 #define I830_RING_START_MASK 0xFFFFF000 #define RING_LEN 0x0C -#define RING_NR_PAGES 0x000FF000 +#define RING_NR_PAGES 0x001FF000 #define I830_RING_NR_PAGES 0x001FF000 #define RING_REPORT_MASK 0x00000006 #define RING_REPORT_64K 0x00000002 --- xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c.i810-update 2004-11-17 15:44:32.137887193 -0500 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c 2004-11-17 15:44:45.037071169 -0500 @@ -905,10 +905,13 @@ * Changed to 8 Meg so we can have acceleration by default (Mark). */ mem = I810CheckAvailableMemory(pScrn); - if (pI810->directRenderingDisabled || mem < 134217728) /* < 128 MB */ + if (pI810->directRenderingDisabled || mem < 131072) /* < 128 MB */ pScrn->videoRam = 8192; + else if (mem < 196608) + pScrn->videoRam = 16384; /* < 192 MB */ else - pScrn->videoRam = 16384; + pScrn->videoRam = 24576; + from = X_DEFAULT; if (pI810->pEnt->device->videoRam) { @@ -1124,14 +1127,6 @@ xf86SetOperatingState(resVgaIo, pI810->pEnt->index, ResUnusedOpr); xf86SetOperatingState(resVgaMem, pI810->pEnt->index, ResDisableOpr); - pI810->LpRing = xalloc(sizeof(I810RingBuffer)); - if (!pI810->LpRing) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Could not allocate lpring data structure.\n"); - I810FreeRec(pScrn); - return FALSE; - } - return TRUE; } @@ -1737,6 +1732,21 @@ i810Reg->ExtHorizBlank = (((mode->CrtcHBlankEnd >> 3) - 1) & 0x40) >> 6; /* + * the KGA fix in vgaHW.c results in the first + * scanline and the first character clock (8 pixels) + * of each scanline thereafter on display with an i810 + * to be blank. Restoring CRTC 3, 5, & 22 to their + * "theoretical" values corrects the problem. KAO. + */ + pVga->CRTC[3] = (((mode->CrtcHBlankEnd >> 3) - 1) & 0x1F) | 0x80; + pVga->CRTC[5] = ((((mode->CrtcHBlankEnd >> 3) - 1) & 0x20) << 2) + | (((mode->CrtcHSyncEnd >> 3)) & 0x1F); + pVga->CRTC[22] = (mode->CrtcVBlankEnd - 1) & 0xFF; + + i810Reg->ExtHorizBlank = vgaHWHBlankKGA(mode, pVga, 7, 0); + vgaHWVBlankKGA(mode, pVga, 8, 0); + + /* * The following workarounds are needed to get video overlay working * at 1024x768 and 1280x1024 display resolutions. */ @@ -1804,18 +1814,6 @@ if (!vgaHWInit(pScrn, mode)) return FALSE; - /* - * the KGA fix in vgaHW.c results in the first - * scanline and the first character clock (8 pixels) - * of each scanline thereafter on display with an i810 - * to be blank. Restoring CRTC 3, 5, & 22 to their - * "theoretical" values corrects the problem. KAO. - */ - pVga = &VGAHWPTR(pScrn)->ModeReg; - pVga->CRTC[3] = (((mode->CrtcHBlankEnd >> 3) - 1) & 0x1F) | 0x80; - pVga->CRTC[5] = ((((mode->CrtcHBlankEnd >> 3) - 1) & 0x20) << 2) - | (((mode->CrtcHSyncEnd >> 3)) & 0x1F); - pVga->CRTC[22] = (mode->CrtcVBlankEnd - 1) & 0xFF; pScrn->vtSema = TRUE; @@ -2074,6 +2072,13 @@ pI810 = I810PTR(pScrn); hwp = VGAHWPTR(pScrn); + pI810->LpRing = xcalloc(sizeof(I810RingBuffer),1); + if (!pI810->LpRing) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Could not allocate lpring data structure.\n"); + return FALSE; + } + miClearVisualTypes(); /* Re-implemented Direct Color support, -jens */