diff options
author | Eric Anholt <anholt@freebsd.org> | 2004-06-16 09:44:00 +0000 |
---|---|---|
committer | Eric Anholt <anholt@freebsd.org> | 2004-06-16 09:44:00 +0000 |
commit | 35a5cf103e9e41d178f980f685307f8c8063a006 (patch) | |
tree | 17ffd25f9890fc2a3187ef283ed3466d18eb166a | |
parent | bec47f9369b6f02ce4537ab1ac547ba933609edc (diff) |
Merge DRI-trunk-20040613 changes in programs/Xserver/hw/xfree86/drivers, with
the following notes:
- Savage and Mach64 (= ati/ati*.[ch] changes) DRI not merged due to insecurity.
- VIA driver converted to new drmContext and drmHandle names.
- Radeon driver merge conflicted in many places, and MergedFB at least could
probably use some checking at this point.
-rw-r--r-- | src/i810_dri.c | 4 | ||||
-rw-r--r-- | src/i810_driver.c | 104 | ||||
-rw-r--r-- | src/i810_hwmc.c | 2 | ||||
-rw-r--r-- | src/i830.h | 11 | ||||
-rw-r--r-- | src/i830_dri.h | 4 |
5 files changed, 94 insertions, 31 deletions
diff --git a/src/i810_dri.c b/src/i810_dri.c index 787eef56..a09ba6b7 100644 --- a/src/i810_dri.c +++ b/src/i810_dri.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c,v 1.40 2003/07/09 01:45:23 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c,v 1.41 2003/09/24 02:43:23 dawes Exp $ */ /* * Reformatted with GNU indent (2.2.8), using the following options: * @@ -525,7 +525,7 @@ I810DRIScreenInit(ScreenPtr pScreen) drmAgpAlloc(pI810->drmSubFD, 4096 * 1024, 1, NULL, &dcacheHandle); pI810->dcacheHandle = dcacheHandle; - xf86DrvMsg(pScreen->myNum, X_INFO, "[agp] dcacheHandle : %p\n", + xf86DrvMsg(pScreen->myNum, X_INFO, "[agp] dcacheHandle : 0x%lx\n", dcacheHandle); #define Elements(x) sizeof(x)/sizeof(*x) diff --git a/src/i810_driver.c b/src/i810_driver.c index 36dc956b..caadc879 100644 --- a/src/i810_driver.c +++ b/src/i810_driver.c @@ -25,7 +25,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c,v 1.87 2003/08/23 15:03:01 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c,v 1.101 2004/01/02 20:15:47 dawes Exp $ */ /* * Reformatted with GNU indent (2.2.8), using the following options: @@ -96,8 +96,8 @@ static void I810FreeScreen(int scrnIndex, int flags); static void I810DisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagermentMode, int flags); -static int I810ValidMode(int scrnIndex, DisplayModePtr mode, Bool - verbose, int flags); +static ModeStatus I810ValidMode(int scrnIndex, DisplayModePtr mode, + Bool verbose, int flags); #endif /* I830_ONLY */ @@ -243,8 +243,9 @@ const char *I810int10Symbols[] = { const char *I810xaaSymbols[] = { "XAACreateInfoRec", "XAADestroyInfoRec", - "XAAFillSolidRects", "XAAInit", + "XAACopyROP", + "XAAPatternROP", NULL }; @@ -255,10 +256,8 @@ const char *I810ramdacSymbols[] = { NULL }; -#ifndef I830_ONLY -#ifdef XFree86LOADER #ifdef XF86DRI -static const char *drmSymbols[] = { +const char *I810drmSymbols[] = { "drmAddBufs", "drmAddMap", "drmAgpAcquire", @@ -267,6 +266,7 @@ static const char *drmSymbols[] = { "drmAgpEnable", "drmAgpFree", "drmAgpRelease", + "drmAgpUnbind", "drmAuthMagic", "drmCommandWrite", "drmCreateContext", @@ -281,7 +281,7 @@ static const char *drmSymbols[] = { }; -static const char *driSymbols[] = { +const char *I810driSymbols[] = { "DRICloseScreen", "DRICreateInfoRec", "DRIDestroyInfoRec", @@ -296,9 +296,6 @@ static const char *driSymbols[] = { NULL }; -#endif -#endif - #ifdef XF86DRI static const char *driShadowFBSymbols[] = { @@ -351,7 +348,7 @@ static XF86ModuleVersionInfo i810VersRec = { MODULEVENDORSTRING, MODINFOSTRING1, MODINFOSTRING2, - XF86_VERSION_CURRENT, + XORG_VERSION_CURRENT, I810_MAJOR_VERSION, I810_MINOR_VERSION, I810_PATCHLEVEL, ABI_CLASS_VIDEODRV, ABI_VIDEODRV_VERSION, @@ -379,10 +376,10 @@ i810Setup(pointer module, pointer opts, int *errmaj, int *errmin) LoaderRefSymLists(I810vgahwSymbols, I810fbSymbols, I810xaaSymbols, I810ramdacSymbols, #ifdef XF86DRI - drmSymbols, - driSymbols, - driShadowFBSymbols, + I810drmSymbols, + I810driSymbols, I810shadowSymbols, + driShadowFBSymbols, #endif I810vbeSymbols, vbeOptionalSymbols, I810ddcSymbols, I810int10Symbols, NULL); @@ -859,7 +856,7 @@ I810PreInit(ScrnInfoPtr pScrn, int flags) pScrn->videoRam = 4096; } else { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Less than 6MB of AGP memory" - "is available. Cannot proceed.\n"); + " is available. Cannot proceed.\n"); I810FreeRec(pScrn); return FALSE; } @@ -934,7 +931,8 @@ I810PreInit(ScrnInfoPtr pScrn, int flags) } clockRanges = xnfcalloc(sizeof(ClockRange), 1); clockRanges->next = NULL; - clockRanges->minClock = 12000; /* !!! What's the min clock? !!! */ + /* 9.4MHz appears to be the smallest that works. */ + clockRanges->minClock = 9500; clockRanges->maxClock = pI810->MaxClock; clockRanges->clockIndex = -1; clockRanges->interlaceAllowed = TRUE; @@ -1069,6 +1067,15 @@ I810PreInit(ScrnInfoPtr pScrn, int flags) pI810->numSurfaces = 0; } +#ifdef XF86DRI + /* Load the dri module if requested. */ + if (xf86ReturnOptValBool(pI810->Options, OPTION_DRI, FALSE)) { + if (xf86LoadSubModule(pScrn, "dri")) { + xf86LoaderReqSymLists(I810driSymbols, I810drmSymbols, NULL); + } + } +#endif + /* We won't be using the VGA access after the probe */ I810SetMMIOAccess(pI810); xf86SetOperatingState(resVgaIo, pI810->pEnt->index, ResUnusedOpr); @@ -1405,13 +1412,20 @@ DoRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, I810RegPtr i810Reg, /* Setting the OVRACT Register for video overlay */ { CARD32 LCD_TV_Control = INREG(LCD_TV_C); + CARD32 TV_HTotal = INREG(LCD_TV_HTOTAL); + CARD32 ActiveStart, ActiveEnd; - if(!(LCD_TV_Control & LCD_TV_ENABLE) - || (LCD_TV_Control & LCD_TV_VGAMOD)) { - OUTREG(LCD_TV_OVRACT, - (i810Reg->OverlayActiveEnd << 16) - | i810Reg->OverlayActiveStart); + if((LCD_TV_Control & LCD_TV_ENABLE) + && !(LCD_TV_Control & LCD_TV_VGAMOD) + && TV_HTotal) { + ActiveStart = ((TV_HTotal >> 16) & 0xfff) - 31; + ActiveEnd = (TV_HTotal & 0x3ff) - 31; + } else { + ActiveStart = i810Reg->OverlayActiveStart; + ActiveEnd = i810Reg->OverlayActiveEnd; } + OUTREG(LCD_TV_OVRACT, + (ActiveEnd << 16) | ActiveStart); } /* Turn on DRAM Refresh */ @@ -1563,6 +1577,11 @@ I810CalcVCLK(ScrnInfoPtr pScrn, double freq) double err_best = 999999.0; p_best = p = log(MAX_VCO_FREQ / f_target) / log((double)2); + /* Make sure p is within range. */ + if (p_best > 5) { + p_best = p = 5; + } + f_vco = f_target * (1 << p); n = 2; @@ -1592,7 +1611,7 @@ I810CalcVCLK(ScrnInfoPtr pScrn, double freq) i810Reg->VideoClk2_DivisorSel = (p_best << 4); xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "Setting dot clock to %.1lf MHz " "[ 0x%x 0x%x 0x%x ] " + "Setting dot clock to %.1f MHz " "[ 0x%x 0x%x 0x%x ] " "[ %d %d %d ]\n", CALC_VCLK(m_best, n_best, p_best), i810Reg->VideoClk2_M, i810Reg->VideoClk2_N, i810Reg->VideoClk2_DivisorSel, m_best, n_best, p_best); @@ -2204,9 +2223,38 @@ Bool I810SwitchMode(int scrnIndex, DisplayModePtr mode, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + I810Ptr pI810 = I810PTR(pScrn); if (I810_DEBUG & DEBUG_VERBOSE_CURSOR) - ErrorF("I810SwitchMode %p %x\n", mode, flags); + ErrorF("I810SwitchMode %p %x\n", (void *)mode, flags); + +#ifdef XF86DRI + if (pI810->directRenderingEnabled) { + if (I810_DEBUG & DEBUG_VERBOSE_DRI) + ErrorF("calling dri lock\n"); + DRILock(screenInfo.screens[scrnIndex], 0); + pI810->LockHeld = 1; + } +#endif + + if (pI810->AccelInfoRec != NULL) { + I810RefreshRing(pScrn); + I810Sync(pScrn); + pI810->AccelInfoRec->NeedToSync = FALSE; + } + I810Restore(pScrn); + +#ifdef XF86DRI + if (!I810DRIEnter(pScrn)) { + return FALSE; + } + if (pI810->directRenderingEnabled) { + if (I810_DEBUG & DEBUG_VERBOSE_DRI) + ErrorF("calling dri unlock\n"); + DRIUnlock(screenInfo.screens[scrnIndex]); + pI810->LockHeld = 0; + } +#endif return I810ModeInit(pScrn, mode); } @@ -2218,6 +2266,7 @@ I810AdjustFrame(int scrnIndex, int x, int y, int flags) I810Ptr pI810 = I810PTR(pScrn); vgaHWPtr hwp = VGAHWPTR(pScrn); int Base; + #if 1 if (pI810->showCache) { int lastline = pI810->FbMapSize / @@ -2340,6 +2389,11 @@ I810CloseScreen(int scrnIndex, ScreenPtr pScreen) XAAInfoRecPtr infoPtr = pI810->AccelInfoRec; if (pScrn->vtSema == TRUE) { + if (pI810->AccelInfoRec != NULL) { + I810RefreshRing(pScrn); + I810Sync(pScrn); + pI810->AccelInfoRec->NeedToSync = FALSE; + } I810Restore(pScrn); vgaHWLock(hwp); } @@ -2400,7 +2454,7 @@ I810FreeScreen(int scrnIndex, int flags) vgaHWFreeHWRec(xf86Screens[scrnIndex]); } -static int +static ModeStatus I810ValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) { if (mode->Flags & V_INTERLACE) { diff --git a/src/i810_hwmc.c b/src/i810_hwmc.c index 8c9c3050..4a154d76 100644 --- a/src/i810_hwmc.c +++ b/src/i810_hwmc.c @@ -32,7 +32,7 @@ THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_hwmc.c,v 1.4 2002/09/11 00:29:32 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_hwmc.c,v 1.3 2001/12/04 21:17:56 tsi Exp $ */ #include "xf86.h" @@ -27,7 +27,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830.h,v 1.9 2003/09/03 15:32:26 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830.h,v 1.12 2004/01/07 03:43:19 dawes Exp $ */ /* * Authors: @@ -147,6 +147,7 @@ typedef struct _I830Rec { 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; @@ -182,6 +183,7 @@ typedef struct _I830Rec { Bool NeedRingBufferLow; Bool allowPageFlip; + Bool disableTiling; int auxPitch; int auxPitchBits; @@ -299,6 +301,9 @@ typedef struct _I830Rec { int xoffset; int yoffset; + int SaveGeneration; + Bool vbeRestoreWorkaround; + Bool displayInfo; } I830Rec; #define I830PTR(p) ((I830Ptr)((p)->driverPrivate)) @@ -395,5 +400,9 @@ extern void I830ChangeFrontbuffer(ScrnInfoPtr pScrn,int buffer); #define ALLOCATE_DRY_RUN 0x80000000 +/* Chipset registers for VIDEO BIOS memory RW access */ +#define _855_DRAM_RW_CONTROL 0x58 +#define _845_DRAM_RW_CONTROL 0x90 +#define DRAM_WRITE 0x33330000 #endif /* _I830_H_ */ diff --git a/src/i830_dri.h b/src/i830_dri.h index b427dc84..684d7e32 100644 --- a/src/i830_dri.h +++ b/src/i830_dri.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dri.h,v 1.5 2002/12/10 01:27:05 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dri.h,v 1.6 2003/09/28 20:15:59 alanh Exp $ */ #ifndef _I830_DRI_H #define _I830_DRI_H @@ -126,7 +126,7 @@ typedef struct _I830SAREA { unsigned int TexState3[I830_TEX_SETUP_SIZE]; unsigned int TexBlendState3[I830_TEXBLEND_SIZE]; unsigned int TexBlendStateWordsUsed3; - + unsigned int StippleState[I830_STP_SETUP_SIZE]; } I830SAREARec, *I830SAREAPtr; |