diff options
author | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-25 19:28:37 +0000 |
---|---|---|
committer | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-25 19:28:37 +0000 |
commit | 72063c52b82faf80a0183f66d2fd5789def76d8f (patch) | |
tree | 44777a8a902d417599c3e9abb0c70200e2aa274c /src/i830_driver.c | |
parent | e04a1a8f862eb63b546fb74e73ee602fefb82e00 (diff) |
XFree86 4.3.99.16xf86-4_3_99_16
Bring the tree up to date for the Cygwin folks
Diffstat (limited to 'src/i830_driver.c')
-rw-r--r-- | src/i830_driver.c | 290 |
1 files changed, 186 insertions, 104 deletions
diff --git a/src/i830_driver.c b/src/i830_driver.c index 073f8eb6..539dcece 100644 --- a/src/i830_driver.c +++ b/src/i830_driver.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_driver.c,v 1.27 2003/02/14 17:12:42 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_driver.c,v 1.47 2003/11/03 14:47:28 alanh Exp $ */ /************************************************************************** Copyright 2001 VA Linux Systems Inc., Fremont, California. @@ -43,7 +43,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* * Authors: Jeff Hartmann <jhartmann@valinux.com> * Abraham van der Merwe <abraham@2d3d.co.za> - * David Dawes <dawes@tungstengraphics.com> + * David Dawes <dawes@xfree86.org> */ /* @@ -154,7 +154,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "micmap.h" #include "fb.h" -#include "miscstruct.h" +#include "regionstr.h" #include "xf86xv.h" #include "Xv.h" #include "vbe.h" @@ -201,9 +201,7 @@ typedef enum { OPTION_PAGEFLIP, OPTION_XVIDEO, OPTION_VIDEO_KEY, - OPTION_COLOR_KEY, - OPTION_STRETCH, - OPTION_CENTER + OPTION_COLOR_KEY } I830Opts; static OptionInfoRec I830BIOSOptions[] = { @@ -215,8 +213,6 @@ static OptionInfoRec I830BIOSOptions[] = { {OPTION_XVIDEO, "XVideo", OPTV_BOOLEAN, {0}, TRUE}, {OPTION_COLOR_KEY, "ColorKey", OPTV_INTEGER, {0}, FALSE}, {OPTION_VIDEO_KEY, "VideoKey", OPTV_INTEGER, {0}, FALSE}, - {OPTION_STRETCH, "Stretch", OPTV_BOOLEAN, {0}, FALSE}, - {OPTION_CENTER, "Center", OPTV_BOOLEAN, {0}, FALSE}, {-1, NULL, OPTV_NONE, {0}, FALSE} }; /* *INDENT-ON* */ @@ -230,9 +226,6 @@ static Bool I830BIOSEnterVT(int scrnIndex, int flags); static Bool I830VESASetVBEMode(ScrnInfoPtr pScrn, int mode, VbeCRTCInfoBlock *block); -static Bool OffsetFrame = FALSE; - - #ifdef I830DEBUG void @@ -1066,6 +1059,93 @@ SaveBIOSMemSize(ScrnInfoPtr pScrn) return FALSE; } +/* + * TweakMemorySize() tweaks the BIOS image to set the correct size. + * Original implementation by Christian Zietz in a stand-alone tool. + */ +static CARD32 +TweakMemorySize(ScrnInfoPtr pScrn, CARD32 newsize, Bool preinit) +{ +#define SIZE 0x10000 +#define IDOFFSET (-23) + const char *MAGICstring = "Total time for VGA POST:"; + const int len = strlen(MAGICstring); + I830Ptr pI830 = I830PTR(pScrn); + char *position; + char *biosAddr; + CARD32 oldsize; + CARD32 oldpermission; + CARD32 ret = 0; + int i,j = 0; + PCITAG tag =pciTag(0,0,0); + + if(!pI830->PciInfo + || !(pI830->PciInfo->chipType == PCI_CHIP_I855_GM + || pI830->PciInfo->chipType == PCI_CHIP_I865_G)) + return 0; + + if (!pI830->pVbe) + return 0; + + biosAddr = xf86int10Addr(pI830->pVbe->pInt10, + pI830->pVbe->pInt10->BIOSseg << 4); + + if (!pI830->BIOSMemSizeLoc) { + + if (!preinit) + return 0; + + /* Search for MAGIC string */ + for (i = 0; i < SIZE; i++) { + if (biosAddr[i] == MAGICstring[j]) { + if (++j == len) + break; + } else { + i -= j; + j = 0; + } + } + if (j < len) return 0; + + pI830->BIOSMemSizeLoc = (i - j + 1 + IDOFFSET); + } + + position = biosAddr + pI830->BIOSMemSizeLoc; + oldsize = *(CARD32 *)position; + ret = oldsize - (3 << 16); + + /* verify that register really contains current size */ + if (preinit && ((oldsize) >> 16) - 3 != pI830->vbeInfo->TotalMemory) + return 0; + + oldpermission = pciReadLong(tag, DRAM_RW_CONTROL); + pciWriteLong(tag, DRAM_RW_CONTROL, 0x33330000); + + *(CARD32 *)position = newsize + (3 << 16); + if (preinit) { + /* reinitialize VBE for new size */ + VBEFreeVBEInfo(pI830->vbeInfo); + vbeFree(pI830->pVbe); + pI830->pVbe = VBEInit(NULL, pI830->pEnt->index); + pI830->vbeInfo = VBEGetVBEInfo(pI830->pVbe); + + /* verify that change was successful */ + if (pI830->vbeInfo->TotalMemory * 64 * 1024 != pI830->newBIOSMemSize) { + ret = 0; + *(CARD32 *)position = oldsize; + } else { + pI830->BIOSMemorySize = KB(pI830->vbeInfo->TotalMemory * 64); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Tweak BIOS image to %d kB VideoRAM\n", + (int)(pI830->BIOSMemorySize / 1024)); + } + } + + pciWriteLong(tag, DRAM_RW_CONTROL, oldpermission); + + return ret; +} + static void RestoreBIOSMemSize(ScrnInfoPtr pScrn) { @@ -1074,6 +1154,9 @@ RestoreBIOSMemSize(ScrnInfoPtr pScrn) DPRINTF(PFX, "RestoreBIOSMemSize\n"); + if (TweakMemorySize(pScrn, pI830->saveBIOSMemSize,FALSE)) + return; + if (!pI830->overrideBIOSMemSize) return; @@ -1096,7 +1179,7 @@ static void SetBIOSMemSize(ScrnInfoPtr pScrn, int newSize) { I830Ptr pI830 = I830PTR(pScrn); - CARD32 swf1; + unsigned long swf1; Bool mapped; DPRINTF(PFX, "SetBIOSMemSize: %d kB\n", newSize / 1024); @@ -1112,7 +1195,7 @@ SetBIOSMemSize(ScrnInfoPtr pScrn, int newSize) #endif if ((IS_I830(pI830) || IS_845G(pI830)) && pI830->useSWF1) { - CARD32 newSWF1; + unsigned long newSWF1; /* Need MMIO access here. */ mapped = (pI830->MMIOBase != NULL); @@ -1125,10 +1208,10 @@ SetBIOSMemSize(ScrnInfoPtr pScrn, int newSize) newSWF1 = 8; swf1 = INREG(SWF1); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Before: SWF1 is 0x%08x\n", swf1); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Before: SWF1 is 0x%08lx\n", swf1); swf1 &= ~0x0f; swf1 |= (newSWF1 & 0x0f); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "After: SWF1 is 0x%08x\n", swf1); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "After: SWF1 is 0x%08lx\n", swf1); OUTREG(SWF1, swf1); if (!mapped) I830UnmapMMIO(pScrn); @@ -1246,6 +1329,7 @@ I830BIOSPreInit(ScrnInfoPtr pScrn, int flags) return FALSE; pI830 = I830PTR(pScrn); + pI830->SaveGeneration = -1; pI830->pEnt = pEnt; if (pI830->pEnt->location.type != BUS_PCI) @@ -1458,7 +1542,7 @@ I830BIOSPreInit(ScrnInfoPtr pScrn, int flags) /* Sanity check: compare with what the BIOS thinks. */ if (pI830->vbeInfo->TotalMemory != pI830->StolenMemory.Size / 1024 / 64) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Detected stolen memory (%d kB) doesn't match what the BIOS" + "Detected stolen memory (%ld kB) doesn't match what the BIOS" " reports (%d kB)\n", ROUND_DOWN_TO(pI830->StolenMemory.Size / 1024, 64), pI830->vbeInfo->TotalMemory * 64); @@ -1562,7 +1646,7 @@ I830BIOSPreInit(ScrnInfoPtr pScrn, int flags) "VideoRam reduced to %d kByte (limited to aperture size)\n", pScrn->videoRam); } - + if (mem > 0) { /* * If the reserved (BIOS accessible) memory is less than the desired @@ -1589,13 +1673,11 @@ I830BIOSPreInit(ScrnInfoPtr pScrn, int flags) else pI830->newBIOSMemSize = KB(ROUND_DOWN_TO(pScrn->videoRam - reserve, 64)); - if (pI830->vbeInfo->TotalMemory * 64 < pI830->newBIOSMemSize / 1024) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Will attempt to tell the BIOS that there is " "%d kB VideoRAM\n", pI830->newBIOSMemSize / 1024); - if (SaveBIOSMemSize(pScrn)) { pI830->overrideBIOSMemSize = TRUE; SetBIOSMemSize(pScrn, pI830->newBIOSMemSize); @@ -1608,17 +1690,22 @@ I830BIOSPreInit(ScrnInfoPtr pScrn, int flags) pI830->BIOSMemorySize = KB(pI830->vbeInfo->TotalMemory * 64); xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "BIOS now sees %d kB VideoRAM\n", + "BIOS now sees %ld kB VideoRAM\n", pI830->BIOSMemorySize / 1024); - } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "BIOS view of memory size can't be changed " - "(this is not an error).\n"); + } else if ((pI830->saveBIOSMemSize + = TweakMemorySize(pScrn, pI830->newBIOSMemSize, TRUE)) != 0) + pI830->overrideBIOSMemSize = TRUE; + else { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "BIOS view of memory size can't be changed " + "(this is not an error).\n"); } } } - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Pre-allocated VideoRAM: %d kByte\n", + pVbe = pI830->pVbe; + + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Pre-allocated VideoRAM: %ld kByte\n", pI830->StolenMemory.Size / 1024); xf86DrvMsg(pScrn->scrnIndex, from, "VideoRAM: %d kByte\n", pScrn->videoRam); pI830->TotalVideoRam = KB(pScrn->videoRam); @@ -1677,8 +1764,8 @@ I830BIOSPreInit(ScrnInfoPtr pScrn, int flags) else pI830->CursorNeedsPhysical = FALSE; - /* Force ring buffer to be in low memory for the 845G. */ - if (IS_845G(pI830)) + /* Force ring buffer to be in low memory for the 845G and later. */ + if (IS_845G(pI830) || IS_I85X(pI830) || IS_I865G(pI830)) pI830->NeedRingBufferLow = TRUE; /* @@ -1923,7 +2010,7 @@ I830BIOSPreInit(ScrnInfoPtr pScrn, int flags) xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Allocation with DRI tiling enabled would " "exceed the\n" - "\tmemory aperture size (%d kB) by %d kB.\n" + "\tmemory aperture size (%ld kB) by %ld kB.\n" "\tReduce VideoRam amount to avoid this!\n", pI830->FbMapSize / 1024, -pI830->MemoryAperture.Size / 1024); @@ -1947,6 +2034,7 @@ I830BIOSPreInit(ScrnInfoPtr pScrn, int flags) * Tiling can't be enabled. Check if there's enough memory for DRI * without tiling. */ + pI830->disableTiling = TRUE; I830ResetAllocations(pScrn, 0); if (I830Allocate2DMemory(pScrn, ALLOCATE_DRY_RUN | ALLOC_INITIAL) && I830Allocate3DMemory(pScrn, ALLOCATE_DRY_RUN | ALLOC_NO_TILING)) { @@ -1962,7 +2050,7 @@ I830BIOSPreInit(ScrnInfoPtr pScrn, int flags) xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Allocation with DRI enabled would " "exceed the\n" - "\tmemory aperture size (%d kB) by %d kB.\n" + "\tmemory aperture size (%ld kB) by %ld kB.\n" "\tReduce VideoRam amount to avoid this!\n", pI830->FbMapSize / 1024, -pI830->MemoryAperture.Size / 1024); @@ -2037,6 +2125,14 @@ I830BIOSPreInit(ScrnInfoPtr pScrn, int flags) vbeFree(pVbe); #if defined(XF86DRI) + /* Load the dri module if requested. */ + if (xf86ReturnOptValBool(pI830->Options, OPTION_DRI, FALSE) && + !pI830->directRenderingDisabled) { + if (xf86LoadSubModule(pScrn, "dri")) { + xf86LoaderReqSymLists(I810driSymbols, I810drmSymbols, NULL); + } + } + if (!pI830->directRenderingDisabled) { if (!xf86LoadSubModule(pScrn, "shadow")) { PreInitCleanup(pScrn); @@ -2063,26 +2159,26 @@ CheckInheritedState(ScrnInfoPtr pScrn) /* Check first for page table errors */ temp = INREG(PGE_ERR); if (temp != 0) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "PGTBL_ER is 0x%08x\n", temp); + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "PGTBL_ER is 0x%08lx\n", temp); errors++; } temp = INREG(PGETBL_CTL); if (!(temp & 1)) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "PGTBL_CTL (0x%08x) indicates GTT is disabled\n", temp); + "PGTBL_CTL (0x%08lx) indicates GTT is disabled\n", temp); errors++; } temp = INREG(LP_RING + RING_LEN); if (temp & 1) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "PRB0_CTL (0x%08x) indicates ring buffer enabled\n", temp); + "PRB0_CTL (0x%08lx) indicates ring buffer enabled\n", temp); errors++; } head = INREG(LP_RING + RING_HEAD); tail = INREG(LP_RING + RING_TAIL); if ((tail & I830_TAIL_MASK) != (head & I830_HEAD_MASK)) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "PRB0_HEAD (0x%08x) and PRB0_TAIL (0x%08x) indicate " + "PRB0_HEAD (0x%08lx) and PRB0_TAIL (0x%08lx) indicate " "ring buffer not flushed\n", head, tail); errors++; } @@ -2167,7 +2263,7 @@ SetRingRegs(ScrnInfoPtr pScrn) if ((pI830->LpRing.mem.Start & I830_RING_START_MASK) != pI830->LpRing.mem.Start) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "I830SetRingRegs: Ring buffer start (%x) violates its " + "I830SetRingRegs: Ring buffer start (%lx) violates its " "mask (%x)\n", pI830->LpRing.mem.Start, I830_RING_START_MASK); } /* Don't care about the old value. Reserved bits must be zero anyway. */ @@ -2177,7 +2273,7 @@ SetRingRegs(ScrnInfoPtr pScrn) if (((pI830->LpRing.mem.Size - 4096) & I830_RING_NR_PAGES) != pI830->LpRing.mem.Size - 4096) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "I830SetRingRegs: Ring buffer size - 4096 (%x) violates its " + "I830SetRingRegs: Ring buffer size - 4096 (%lx) violates its " "mask (%x)\n", pI830->LpRing.mem.Size - 4096, I830_RING_NR_PAGES); } @@ -2238,16 +2334,17 @@ SaveHWState(ScrnInfoPtr pScrn) #endif pVesa = pI830->vesa; - /* This save/restore method doesn't work for 845G BIOS */ /* - * XXX If it's fixed in production versions, this could be removed. - * + * This save/restore method doesn't work for 845G BIOS, or for some + * other platforms. Enable it in all cases. + */ + /* * KW: This may have been because of the behaviour I've found on my * board: The 'save' command actually modifies the interrupt * registers, turning off the irq & breaking the kernel module * behaviour. */ - if (!I845G_VBE_WORKAROUND || !IS_845G(pI830)) { + if (!I845G_VBE_WORKAROUND) { CARD16 imr = INREG16(IMR); CARD16 ier = INREG16(IER); CARD16 hwstam = INREG16(HWSTAM); @@ -2546,10 +2643,10 @@ I830VESASetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode) * Print out the PIPEACONF and PIPEBCONF registers. */ temp = INREG(PIPEACONF); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "PIPEACONF is 0x%08x\n", temp); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "PIPEACONF is 0x%08lx\n", temp); if (IS_MOBILE(pI830)) { temp = INREG(PIPEBCONF); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "PIPEBCONF is 0x%08x\n", temp); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "PIPEBCONF is 0x%08lx\n", temp); } #if PRINT_MODE_INFO @@ -2594,7 +2691,7 @@ I830VESASetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode) if (temp / pI830->cpp != pScrn->displayWidth) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Correcting plane %c stride (%d -> %d)\n", PIPE_NAME(i), - temp / pI830->cpp, pScrn->displayWidth); + (int)(temp / pI830->cpp), pScrn->displayWidth); OUTREG(stridereg, pScrn->displayWidth * pI830->cpp); /* Trigger update */ temp = INREG(basereg); @@ -2892,7 +2989,8 @@ I830BIOSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) * first, then re-initialise the VBE information. */ pI830->pVbe = VBEInit(NULL, pI830->pEnt->index); - SetBIOSMemSize(pScrn, pI830->newBIOSMemSize); + if (!TweakMemorySize(pScrn, pI830->newBIOSMemSize,FALSE)) + SetBIOSMemSize(pScrn, pI830->newBIOSMemSize); if (!pI830->pVbe) return FALSE; pI830->vbeInfo = VBEGetVBEInfo(pI830->pVbe); @@ -2991,9 +3089,13 @@ I830BIOSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) if (pI830->directRenderingEnabled) pI830->directRenderingEnabled = I830DRIScreenInit(pScreen); - if (pI830->directRenderingEnabled) - if (!(pI830->directRenderingEnabled = I830Allocate3DMemory(pScrn, 0))) + if (pI830->directRenderingEnabled) { + pI830->directRenderingEnabled = + I830Allocate3DMemory(pScrn, + pI830->disableTiling ? ALLOC_NO_TILING : 0); + if (!pI830->directRenderingEnabled) I830DRICloseScreen(pScreen); + } #else pI830->directRenderingEnabled = FALSE; @@ -3027,6 +3129,9 @@ I830BIOSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pScrn->memPhysBase = (unsigned long)pI830->FbBase; pScrn->fbOffset = pI830->FrontBuffer.Start; + pI830->xoffset = (pScrn->fbOffset / pI830->cpp) % pScrn->displayWidth; + pI830->yoffset = (pScrn->fbOffset / pI830->cpp) / pScrn->displayWidth; + vgaHWSetMmioFuncs(hwp, pI830->MMIOBase, 0); vgaHWGetIOBase(hwp); DPRINTF(PFX, "assert( if(!vgaHWMapMem(pScrn)) )\n"); @@ -3108,9 +3213,7 @@ I830BIOSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) return FALSE; } -#ifdef DPMSExtension xf86DPMSInit(pScreen, I830DisplayPowerManagementSet, 0); -#endif #ifdef I830_XV /* Init video */ @@ -3164,34 +3267,15 @@ I830BIOSAdjustFrame(int scrnIndex, int x, int y, int flags) ScrnInfoPtr pScrn; I830Ptr pI830; vbeInfoPtr pVbe; - static int xoffset = 0, yoffset = 0; - static int adjustGeneration = -1; pScrn = xf86Screens[scrnIndex]; pI830 = I830PTR(pScrn); pVbe = pI830->pVbe; DPRINTF(PFX, "I830BIOSAdjustFrame: y = %d (+ %d), x = %d (+ %d)\n", - x, xoffset, y, yoffset); + x, pI830->xoffset, y, pI830->yoffset); - /* Calculate the offsets once per server generation. */ - if (adjustGeneration != serverGeneration) { - adjustGeneration = serverGeneration; - xoffset = (pScrn->fbOffset / pI830->cpp) % pScrn->displayWidth; - yoffset = (pScrn->fbOffset / pI830->cpp) / pScrn->displayWidth; - } - - if (OffsetFrame) { - y = (pI830->FbMemBox.y2 - pScrn->currentMode->VDisplay); - ErrorF("AdjustFrame: OffsetFrame is set, setting y to %d\n", y); - } - x += xoffset; - y += yoffset; -#if 0 - x >>= 4; - x <<= 4; -#endif - VBESetDisplayStart(pVbe, x, y, TRUE); + VBESetDisplayStart(pVbe, x + pI830->xoffset, y + pI830->yoffset, TRUE); } static void @@ -3234,9 +3318,7 @@ static void I830BIOSLeaveVT(int scrnIndex, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; -#ifdef XF86DRI I830Ptr pI830 = I830PTR(pScrn); -#endif DPRINTF(PFX, "Leave VT\n"); @@ -3257,6 +3339,8 @@ I830BIOSLeaveVT(int scrnIndex, int flags) RestoreHWState(pScrn); RestoreBIOSMemSize(pScrn); I830UnbindGARTMemory(pScrn); + if (pI830->AccelInfoRec) + pI830->AccelInfoRec->NeedToSync = FALSE; } /* @@ -3267,7 +3351,6 @@ I830BIOSEnterVT(int scrnIndex, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; I830Ptr pI830 = I830PTR(pScrn); - static int SaveGeneration = -1; DPRINTF(PFX, "Enter VT\n"); @@ -3275,14 +3358,15 @@ I830BIOSEnterVT(int scrnIndex, int flags) return FALSE; CheckInheritedState(pScrn); - SetBIOSMemSize(pScrn, pI830->newBIOSMemSize); + if (!TweakMemorySize(pScrn, pI830->newBIOSMemSize,FALSE)) + SetBIOSMemSize(pScrn, pI830->newBIOSMemSize); /* * Only save state once per server generation since that's what most * drivers do. Could change this to save state at each VT enter. */ - if (SaveGeneration != serverGeneration) { - SaveGeneration = serverGeneration; + if (pI830->SaveGeneration != serverGeneration) { + pI830->SaveGeneration = serverGeneration; SaveHWState(pScrn); } ResetState(pScrn, FALSE); @@ -3348,11 +3432,6 @@ I830BIOSSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) } while (_head != _tail); } -#if 0 - OffsetFrame = !OffsetFrame; - pScrn->AdjustFrame(scrnIndex, 0, 0, 0); -#endif - #ifndef BINDUNBIND #define BINDUNBIND 0 #endif @@ -3386,35 +3465,36 @@ I830BIOSSaveScreen(ScreenPtr pScreen, int mode) DPRINTF(PFX, "I830BIOSSaveScreen: %d, on is %s\n", mode, BOOLTOSTRING(on)); - for (i = 0; i < MAX_DISPLAY_PIPES; i++) { - if (i == 0) { - ctrl = DSPACNTR; - base = DSPABASE; - } else { - ctrl = DSPBCNTR; - base = DSPBADDR; + if (pScrn->vtSema) { + for (i = 0; i < MAX_DISPLAY_PIPES; i++) { + if (i == 0) { + ctrl = DSPACNTR; + base = DSPABASE; + } else { + ctrl = DSPBCNTR; + base = DSPBADDR; + } + if (pI830->planeEnabled[i]) { + temp = INREG(ctrl); + if (on) + temp |= DISPLAY_PLANE_ENABLE; + else + temp &= ~DISPLAY_PLANE_ENABLE; + OUTREG(ctrl, temp); + /* Flush changes */ + temp = INREG(base); + OUTREG(base, temp); + } } - if (pI830->planeEnabled[i]) { - temp = INREG(ctrl); + + if (pI830->CursorInfoRec && !pI830->SWCursor && pI830->cursorOn) { if (on) - temp |= DISPLAY_PLANE_ENABLE; + pI830->CursorInfoRec->ShowCursor(pScrn); else - temp &= ~DISPLAY_PLANE_ENABLE; - OUTREG(ctrl, temp); - /* Flush changes */ - temp = INREG(base); - OUTREG(base, temp); + pI830->CursorInfoRec->HideCursor(pScrn); + pI830->cursorOn = TRUE; } } - - if (pI830->CursorInfoRec && !pI830->SWCursor && pI830->cursorOn) { - if (on) - pI830->CursorInfoRec->ShowCursor(pScrn); - else - pI830->CursorInfoRec->HideCursor(pScrn); - pI830->cursorOn = TRUE; - } - return TRUE; } @@ -3498,7 +3578,7 @@ I830BIOSCloseScreen(int scrnIndex, ScreenPtr pScreen) return (*pScreen->CloseScreen) (scrnIndex, pScreen); } -static int +static ModeStatus I830ValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) { if (mode->Flags & V_INTERLACE) { @@ -3584,3 +3664,5 @@ I830InitpScrn(ScrnInfoPtr pScrn) pScrn->ValidMode = I830ValidMode; pScrn->PMEvent = I830PMEvent; } + + |