diff options
author | alanh <alanh> | 2003-09-12 20:17:49 +0000 |
---|---|---|
committer | alanh <alanh> | 2003-09-12 20:17:49 +0000 |
commit | 7c5cdb3bfe8d4ae86d46092dc9735c334a5b52e8 (patch) | |
tree | 3a1203b4206e4c3074906f9139a2b16b2c3e932f /xc/programs/Xserver/hw/xfree86/drivers/tdfx | |
parent | 6cdb0fa7dedf58dc71c56756cf8bc6afc4abdada (diff) |
third round (just r128/radeon/i810/i830 to do)
Diffstat (limited to 'xc/programs/Xserver/hw/xfree86/drivers/tdfx')
3 files changed, 56 insertions, 163 deletions
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c index 0c0ce8060..fdedb6f79 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c @@ -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/tdfx/tdfx_driver.c,v 1.92 2002/11/25 14:05:00 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c,v 1.99 2003/08/23 16:09:20 dawes Exp $ */ /* * Authors: @@ -88,7 +88,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "tdfx.h" -#include "miscstruct.h" +#include "regionstr.h" #include "dixstruct.h" #include "xf86xv.h" @@ -244,6 +244,8 @@ static const char *int10Symbols[] = { NULL }; +#ifdef XFree86LOADER + #ifdef XF86DRI static const char *drmSymbols[] = { "drmAddMap", @@ -269,8 +271,6 @@ static const char *driSymbols[] = { #endif -#ifdef XFree86LOADER - static MODULESETUPPROTO(tdfxSetup); static XF86ModuleVersionInfo tdfxVersRec = @@ -743,38 +743,24 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags) * not sure if they are disabled. */ xf86SetOperatingState(resVgaIo, pTDFX->pEnt->index, ResDisableOpr); -#if 0 - pScrn->racIoFlags = RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT; - pScrn->racMemFlags = RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT; -#endif -#if 0 -#if 1 /* Is VGA memory disabled during OPERATING state? */ - - xf86SetOperatingState(resVgaMem, pTDFX->pEnt->index, ResDisableOpr); -#else - pScrn->racMemFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT; -#endif -#endif - -#if 1 + xf86SetOperatingState(resVgaMem, pTDFX->pEnt->index, ResUnusedOpr); /* * I'm sure we don't need to set these. All resources * for these operations are exclusive. */ if (pTDFX->usePIO) { - pScrn->racMemFlags = RAC_FB; + pScrn->racMemFlags = 0; pScrn->racIoFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT; } else - pScrn->racMemFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT; -#endif + pScrn->racMemFlags = 0; /* Set pScrn->monitor */ pScrn->monitor = pScrn->confScreen->monitor; flags24=Support24bppFb | Support32bppFb | SupportConvert32to24; - if (!xf86SetDepthBpp(pScrn, 8, 8, 8, flags24)) { + if (!xf86SetDepthBpp(pScrn, 0, 0, 0, flags24)) { return FALSE; } else { switch (pScrn->depth) { @@ -961,7 +947,18 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags) clockRanges->minClock= 12000; /* !!! What's the min clock? !!! */ clockRanges->maxClock=pTDFX->MaxClock; clockRanges->clockIndex = -1; - clockRanges->interlaceAllowed = FALSE; + switch (pTDFX->ChipType) { + case PCI_CHIP_BANSHEE: + clockRanges->interlaceAllowed = FALSE; + break; + case PCI_CHIP_VOODOO3: + case PCI_CHIP_VOODOO5: + clockRanges->interlaceAllowed = TRUE; + break; + default: + clockRanges->interlaceAllowed = FALSE; + break; + } clockRanges->doubleScanAllowed = TRUE; /* @@ -991,7 +988,7 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags) return FALSE; } - xf86SetCrtcForModes(pScrn, INTERLACE_HALVE_V); + xf86SetCrtcForModes(pScrn, 0); pScrn->currentMode = pScrn->modes; @@ -1667,6 +1664,10 @@ TDFXSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode) { tdfxReg->screensize=mode->HDisplay|(mode->VDisplay<<12); tdfxReg->vidcfg &= ~SST_HALF_MODE; } + if (mode->Flags&V_INTERLACE) { + tdfxReg->vidcfg|=SST_INTERLACE; + } else + tdfxReg->vidcfg&=~SST_INTERLACE; TDFXTRACEREG("cpp=%d Hdisplay=%d Vdisplay=%d stride=%d screensize=%x\n", pTDFX->cpp, mode->HDisplay, mode->VDisplay, tdfxReg->stride, @@ -2235,11 +2236,8 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { } #endif - -#ifdef XvExtension /* Initialize Xv support */ TDFXInitVideo (pScreen); -#endif pScreen->SaveScreen = TDFXSaveScreen; pTDFX->CloseScreen = pScreen->CloseScreen; @@ -2392,12 +2390,29 @@ TDFXFreeScreen(int scrnIndex, int flags) { static int TDFXValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) { + ScrnInfoPtr pScrn; + TDFXPtr pTDFX; + TDFXTRACE("TDFXValidMode start\n"); if ((mode->HDisplay>2048) || (mode->VDisplay>1536)) return MODE_BAD; - /* Banshee doesn't support interlace. Does V3? */ - if (mode->Flags&V_INTERLACE) - return MODE_BAD; + /* Banshee doesn't support interlace, but Voodoo 3 and higher do. */ + pScrn = xf86Screens[scrnIndex]; + pTDFX = TDFXPTR(pScrn); + if (mode->Flags&V_INTERLACE) { + switch (pTDFX->ChipType) { + case PCI_CHIP_BANSHEE: + return MODE_BAD; + break; + case PCI_CHIP_VOODOO3: + case PCI_CHIP_VOODOO5: + return MODE_OK; + break; + default: + return MODE_BAD; + break; + } + } /* In clock doubled mode widths must be divisible by 16 instead of 8 */ if ((mode->Clock>TDFX2XCUTOFF) && (mode->HDisplay%16)) return MODE_BAD; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c index 8d90c1fcd..89715883a 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c,v 1.16 2002/10/17 01:02:08 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c,v 1.17 2003/04/23 21:51:47 tsi Exp $ */ #include "xf86.h" #include "tdfx.h" @@ -35,9 +35,6 @@ static Atom xvColorKey, xvFilterQuality; #define GET_PORT_PRIVATE(pScrn) \ (TDFXPortPrivPtr)((TDFXPTR(pScrn))->overlayAdaptor->pPortPrivates[0].ptr) -/* Doesn't matter what screen we use */ -#define DummyScreen screenInfo.screens[0] - /* Needed for attribute atoms */ #define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) @@ -132,9 +129,6 @@ void TDFXInitVideo(ScreenPtr pScreen) if(pTDFX->cpp == 1) return; - if(!pTDFX->AccelInfoRec || !pTDFX->AccelInfoRec->FillSolidRects) - return; - if (!pTDFX->TextureXvideo) { /* Offscreen support for Overlay only */ TDFXInitOffscreenImages(pScreen); @@ -299,85 +293,6 @@ TDFXSetupImageVideoTexture(ScreenPtr pScreen) * MISCELLANEOUS ROUTINES */ -static Bool -TDFXClipVideo( - BoxPtr dst, - INT32 *xa, - INT32 *xb, - INT32 *ya, - INT32 *yb, - RegionPtr reg, - INT32 width, - INT32 height -){ - INT32 vscale, hscale, delta; - BoxPtr extents = REGION_EXTENTS(DummyScreen, reg); - int diff; - - hscale = ((*xb - *xa) << 16) / (dst->x2 - dst->x1); - vscale = ((*yb - *ya) << 16) / (dst->y2 - dst->y1); - - *xa <<= 16; *xb <<= 16; - *ya <<= 16; *yb <<= 16; - - diff = extents->x1 - dst->x1; - if(diff > 0) { - dst->x1 = extents->x1; - *xa += diff * hscale; - } - diff = dst->x2 - extents->x2; - if(diff > 0) { - dst->x2 = extents->x2; - *xb -= diff * hscale; - } - diff = extents->y1 - dst->y1; - if(diff > 0) { - dst->y1 = extents->y1; - *ya += diff * vscale; - } - diff = dst->y2 - extents->y2; - if(diff > 0) { - dst->y2 = extents->y2; - *yb -= diff * vscale; - } - - if(*xa < 0) { - diff = (- *xa + hscale - 1)/ hscale; - dst->x1 += diff; - *xa += diff * hscale; - } - delta = *xb - (width << 16); - if(delta > 0) { - diff = (delta + hscale - 1)/ hscale; - dst->x2 -= diff; - *xb -= diff * hscale; - } - if(*xa >= *xb) return FALSE; - - if(*ya < 0) { - diff = (- *ya + vscale - 1)/ vscale; - dst->y1 += diff; - *ya += diff * vscale; - } - delta = *yb - (height << 16); - if(delta > 0) { - diff = (delta + vscale - 1)/ vscale; - dst->y2 -= diff; - *yb -= diff * vscale; - } - if(*ya >= *yb) return FALSE; - - if((dst->x1 != extents->x1) || (dst->x2 != extents->x2) || - (dst->y1 != extents->y1) || (dst->y2 != extents->y2)) - { - RegionRec clipReg; - REGION_INIT(DummyScreen, &clipReg, dst, 1); - REGION_INTERSECT(DummyScreen, reg, reg, &clipReg); - REGION_UNINIT(DummyScreen, &clipReg); - } - return TRUE; -} - static int TDFXQueryImageAttributes( ScrnInfoPtr pScrn, @@ -766,39 +681,6 @@ TDFXPutImageTexture( /* - * COMMON DRAWING FUNCTIONS - */ - -static Bool -RegionsEqual(RegionPtr A, RegionPtr B) -{ - int *dataA, *dataB; - int num; - - num = REGION_NUM_RECTS(A); - if(num != REGION_NUM_RECTS(B)) - return FALSE; - - if((A->extents.x1 != B->extents.x1) || - (A->extents.x2 != B->extents.x2) || - (A->extents.y1 != B->extents.y1) || - (A->extents.y2 != B->extents.y2)) - return FALSE; - - dataA = (int*)REGION_RECTS(A); - dataB = (int*)REGION_RECTS(B); - - while(num--) { - if((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])) - return FALSE; - dataA += 2; - dataB += 2; - } - - return TRUE; -} - -/* * OVERLAY DRAWING FUNCTIONS */ @@ -1044,7 +926,8 @@ TDFXPutImageOverlay( dstBox.y1 = drw_y; dstBox.y2 = drw_y + drw_h; - if(!TDFXClipVideo(&dstBox, &xa, &xb, &ya, &yb, clipBoxes, width, height)) + if(!xf86XVClipVideoHelper(&dstBox, &xa, &xb, &ya, &yb, + clipBoxes, width, height)) return Success; dstBox.x1 -= pScrn->frameX0; @@ -1129,12 +1012,9 @@ TDFXPutImageOverlay( break; } - if(!RegionsEqual(&pPriv->clip, clipBoxes)) { - REGION_COPY(pScreen, &pPriv->clip, clipBoxes); - (*pTDFX->AccelInfoRec->FillSolidRects)(pScrn, pPriv->colorKey, - GXcopy, ~0, - REGION_NUM_RECTS(clipBoxes), - REGION_RECTS(clipBoxes)); + if(!REGION_EQUAL(pScrn->pScreen, &pPriv->clip, clipBoxes)) { + REGION_COPY(pScrn->pScreen, &pPriv->clip, clipBoxes); + xf86XVFillKeyHelper(pScrn->pScreen, pPriv->colorKey, clipBoxes); } TDFXDisplayVideoOverlay(pScrn, id, offset, width, height, dstPitch, xa, xb, ya, &dstBox, src_w, src_h, drw_w, drw_h); @@ -1410,8 +1290,8 @@ TDFXDisplaySurface( dstBox.y1 = drw_y; dstBox.y2 = drw_y + drw_h; - if(!TDFXClipVideo(&dstBox, &x1, &x2, &y1, &y2, clipBoxes, - surface->width, surface->height)) + if(!xf86XVClipVideoHelper(&dstBox, &x1, &x2, &y1, &y2, clipBoxes, + surface->width, surface->height)) { return Success; } @@ -1429,10 +1309,7 @@ TDFXDisplaySurface( surface->width, surface->height, surface->pitches[0], x1, y1, x2, &dstBox, src_w, src_h, drw_w, drw_h); - (*pTDFX->AccelInfoRec->FillSolidRects)(pScrn, portPriv->colorKey, - GXcopy, ~0, - REGION_NUM_RECTS(clipBoxes), - REGION_RECTS(clipBoxes)); + xf86XVFillKeyHelper(pScrn->pScreen, portPriv->colorKey, clipBoxes); pPriv->isOn = TRUE; /* we've prempted the XvImage stream so set its free timer */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h index a9ef1dfbf..b9c01ce17 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h,v 1.13 2002/10/17 01:02:08 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h,v 1.14 2003/06/18 16:17:41 eich Exp $ */ /* Voodoo Banshee driver version 1.0.1 @@ -45,6 +45,7 @@ #define SST_DESKTOP_EN BIT(7) #define SST_DESKTOP_PIXEL_FORMAT_SHIFT 18 #define SST_DESKTOP_CLUT_BYPASS BIT(10) +#define SST_INTERLACE BIT(3) #define SST_HALF_MODE BIT(4) #define SST_CURSOR_EN BIT(27) #define SST_FBI_BUSY BIT(7) |