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 /src/i810_driver.c | |
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.
Diffstat (limited to 'src/i810_driver.c')
-rw-r--r-- | src/i810_driver.c | 104 |
1 files changed, 79 insertions, 25 deletions
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) { |