Author: daniel Date: 2003-11-15 03:12:06 -0500 (Sat, 15 Nov 2003) New Revision: 770
Added: branches/4.3.0/sid/debian/patches/000_stolen_from_HEAD_i830_driver.diff Removed: branches/4.3.0/sid/debian/patches/056_i810_make_i830_usable.diff Modified: branches/4.3.0/sid/debian/changelog Log: Make i830 driver automatically reserve the amount of video RAM specified in the configuration file, instead of needing an external program, or needing to change the BIOS settings. Also, grab a couple of other tiny fixes from HEAD, and reflect patch #056's status by merging it into the new stolen-from-HEAD. - debian/patches/000_stolen_from_HEAD_i830_driver.diff: new - debian/patches/056_i810_make_i830_usable.diff: removed Modified: branches/4.3.0/sid/debian/changelog =================================================================== --- branches/4.3.0/sid/debian/changelog 2003-11-14 19:04:50 UTC (rev 769) +++ branches/4.3.0/sid/debian/changelog 2003-11-15 08:12:06 UTC (rev 770) @@ -95,8 +95,15 @@ - debian/xlibs-dev.install.hurd-i386 - debian/xlibs-dev.install.s390 - -- Branden Robinson <[EMAIL PROTECTED]> Fri, 14 Nov 2003 00:12:13 -0500 + * Make i830 driver automatically reserve the amount of memory specified in + 'Option "VideoRAM"', eliminating the need for an external program. Grab a + couple of other small fixes from HEAD, and integrate this with patch #056. + - debian/patches/000_stolen_from_HEAD_i830_driver.diff: new + - debian/patches/056_i810_make_i830_usable.diff: deleted + [Daniel Stone] + -- Branden Robinson <[EMAIL PROTECTED]> Fri, 14 Nov 2003 03:14:37 -0500 + xfree86 (4.3.0-0pre1v4) experimental; urgency=low * Add missing symbolic links for libXTrap. [ISHIKAWA Mutsumi] @@ -2442,14 +2449,14 @@ + When parsing XInput XF86Config options, catch NULL option table instead of crashing. (David Dawes) + Fix a double free() that can cause a crash in XCloseIM() (based on - #5303, Mo DeJong). + #5303, Mo DeJong). + Fix for random crashes when a screen fails to initialise (Marc La France). + Fix server crash when using Xinerama when application closes. (#A.808, Tsukahara Ken). + Fix a SEGV on server reset in the PM3 driver. (Alan Hourihane) + Fixed GetTimeInMillis() to use deltas instead of absolute time returend - by gettimeofday(). This ensures time is monotonic in X (Egbert Eich). + by gettimeofday(). This ensures time is monotonic in X (Egbert Eich). (Closes: #85365) + Sync with Type1 font rasterizer from HEAD: - Some minor include cleanups. (David Dawes) @@ -4897,3 +4904,6 @@ $Id$ vim:set ai et sts=2 sw=2 tw=78: +<<<<<<< .mine +======= +>>>>>>> .r769 Added: branches/4.3.0/sid/debian/patches/000_stolen_from_HEAD_i830_driver.diff =================================================================== --- branches/4.3.0/sid/debian/patches/000_stolen_from_HEAD_i830_driver.diff 2003-11-14 19:04:50 UTC (rev 769) +++ branches/4.3.0/sid/debian/patches/000_stolen_from_HEAD_i830_driver.diff 2003-11-15 08:12:06 UTC (rev 770) @@ -0,0 +1,291 @@ +$Id$ + +Add a few tweaks to the i830_driver, the most significant being to automatically +attempt to reserve as much BIOS memory as we've asked for with Option +"VideoRAM", and a deadlock fix for i830G chips. + +diff -urN xc.orig/programs/Xserver/hw/xfree86/drivers/i810/i830.h xc/programs/Xserver/hw/xfree86/drivers/i810/i830.h +--- xc.orig/programs/Xserver/hw/xfree86/drivers/i810/i830.h 2003-11-15 18:12:41.000000000 +1100 ++++ xc/programs/Xserver/hw/xfree86/drivers/i810/i830.h 2003-11-15 18:14:32.000000000 +1100 +@@ -147,6 +147,7 @@ + unsigned long TotalVideoRam; + I830MemRange StolenMemory; /* pre-allocated memory */ + unsigned long BIOSMemorySize; /* min stolen pool size */ ++ int BIOSMemSizeLoc; + + /* These change according to what has been allocated. */ + long FreeMemory; +@@ -295,6 +296,11 @@ + Bool closing; + Bool suspended; + ++ /* fbOffset converted to (x, y). */ ++ int xoffset; ++ int yoffset; ++ ++ int SaveGeneration; + } I830Rec; + + #define I830PTR(p) ((I830Ptr)((p)->driverPrivate)) +@@ -391,5 +397,8 @@ + + #define ALLOCATE_DRY_RUN 0x80000000 + ++/* Chipset registers for VIDEO BIOS memory RW access */ ++#define DRAM_RW_CONTROL 0x58 ++#define DRAM_WRITE 0x33330000 + + #endif /* _I830_H_ */ +diff -urN xc.orig/programs/Xserver/hw/xfree86/drivers/i810/i830_driver.c xc/programs/Xserver/hw/xfree86/drivers/i810/i830_driver.c +--- xc.orig/programs/Xserver/hw/xfree86/drivers/i810/i830_driver.c 2003-11-15 18:12:41.000000000 +1100 ++++ xc/programs/Xserver/hw/xfree86/drivers/i810/i830_driver.c 2003-11-15 18:14:32.000000000 +1100 +@@ -1066,6 +1066,93 @@ + 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 +1161,9 @@ + + DPRINTF(PFX, "RestoreBIOSMemSize\n"); + ++ if (TweakMemorySize(pScrn, pI830->saveBIOSMemSize,FALSE)) ++ return; ++ + if (!pI830->overrideBIOSMemSize) + return; + +@@ -1246,6 +1336,7 @@ + return FALSE; + + pI830 = I830PTR(pScrn); ++ pI830->SaveGeneration = -1; + pI830->pEnt = pEnt; + + if (pI830->pEnt->location.type != BUS_PCI) +@@ -1608,10 +1699,13 @@ + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "BIOS now sees %d 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"); + } + } + } +@@ -1945,6 +2039,7 @@ + * 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)) { +@@ -2593,7 +2688,7 @@ + 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); +@@ -2891,7 +2986,8 @@ + * 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); +@@ -2990,9 +3086,13 @@ + 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; +@@ -3026,6 +3126,9 @@ + 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"); +@@ -3163,34 +3266,15 @@ + 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 +@@ -3253,6 +3337,10 @@ + #endif + + ResetState(pScrn, TRUE); ++#ifdef XF86DRI ++ /* NeedToSync is set TRUE in RefreshRing called from ResetState() */ ++ pI830->AccelInfoRec->NeedToSync = FALSE; ++#endif + RestoreHWState(pScrn); + RestoreBIOSMemSize(pScrn); + I830UnbindGARTMemory(pScrn); +@@ -3280,14 +3368,15 @@ + 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); Deleted: branches/4.3.0/sid/debian/patches/056_i810_make_i830_usable.diff =================================================================== --- branches/4.3.0/sid/debian/patches/056_i810_make_i830_usable.diff 2003-11-14 19:04:50 UTC (rev 769) +++ branches/4.3.0/sid/debian/patches/056_i810_make_i830_usable.diff 2003-11-15 08:12:06 UTC (rev 770) @@ -1,29 +0,0 @@ -$Id$ - -From Marcus C. Gottwald: -Hi Daniel! - -Egbert Eich's patch for the i830 driver applies fine to your -4.3.0-0ds4 sources and really only makes it usable on a i830. I -only had to create another patch file and recompile the whole -thing: - -===== - -Patch from Egbert Eich 2003-04-07 11:37 - -see bugs.xfree86.org #103 - ---- xc/programs/Xserver/hw/xfree86/drivers/i810/i830_driver.c~ 2003-10-24 17:19:18.000000000 -0500 -+++ xc/programs/Xserver/hw/xfree86/drivers/i810/i830_driver.c 2003-10-24 17:19:24.000000000 -0500 -@@ -3253,6 +3253,10 @@ - #endif - - ResetState(pScrn, TRUE); -+#ifdef XF86DRI -+ /* NeedToSync is set TRUE in RefreshRing called from ResetState() */ -+ pI830->AccelInfoRec->NeedToSync = FALSE; -+#endif - RestoreHWState(pScrn); - RestoreBIOSMemSize(pScrn); - I830UnbindGARTMemory(pScrn);