diff options
Diffstat (limited to 'xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c')
-rw-r--r-- | xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c | 78 |
1 files changed, 28 insertions, 50 deletions
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c index d97363b57..f52859e39 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c,v 1.3 2000/06/17 00:03:25 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c,v 1.5 2001/01/13 00:06:29 mvojkovi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -32,13 +32,7 @@ DGAFunctionRec TDFX_DGAFuncs = { TDFX_BlitTransRect }; -/* -We should allow you to change the depth, but the accel driver isn't -ready to handle that yet. Also, we are currently taking the default -visual and using it for the visual reported by DGA. It would be -relatively easy to at least give DirectColor and TrueColor visuals -instead of just the default -*/ + Bool TDFXDGAInit(ScreenPtr pScreen) { @@ -47,22 +41,19 @@ TDFXDGAInit(ScreenPtr pScreen) DisplayModePtr pMode, firstMode; DGAModePtr modes=0, newmodes=0, currentMode; int num=0; - Bool oneMore; pTDFX = TDFXPTR(pScrn); pMode = firstMode = pScrn->modes; while (pMode) { newmodes = xrealloc(modes, (num+1)*sizeof(DGAModeRec)); - oneMore = FALSE; + if (!newmodes) { xfree(modes); return FALSE; } modes = newmodes; -SECOND_PASS: - currentMode = modes+num; num++; currentMode->mode = pMode; @@ -82,33 +73,21 @@ SECOND_PASS: currentMode->visualClass = pScrn->defaultVisual; currentMode->viewportWidth = pMode->HDisplay; currentMode->viewportHeight = pMode->VDisplay; - currentMode->xViewportStep = (3 - pTDFX->cpp); + currentMode->xViewportStep = 1; currentMode->yViewportStep = 1; currentMode->viewportFlags = DGA_FLIP_RETRACE; - currentMode->offset = pTDFX->fbOffset; + currentMode->offset = 0; currentMode->address = pTDFX->FbBase; - - if (oneMore) { /* first one is narrow width */ - currentMode->bytesPerScanline = ((pMode->HDisplay * pTDFX->cpp) + 3) & ~3L; - currentMode->imageWidth = pMode->HDisplay; - currentMode->imageHeight = pScrn->virtualY; - currentMode->pixmapWidth = currentMode->imageWidth; - currentMode->pixmapHeight = currentMode->imageHeight; - currentMode->maxViewportX = currentMode->imageWidth - currentMode->viewportWidth; - /* this might need to get clamped to some maximum */ - currentMode->maxViewportY = currentMode->imageHeight - currentMode->viewportHeight; - oneMore = FALSE; - goto SECOND_PASS; - } else { - currentMode->bytesPerScanline = ((pScrn->displayWidth * pTDFX->cpp) + 3) & ~3L; - currentMode->imageWidth = pScrn->displayWidth; - currentMode->imageHeight = pScrn->virtualY; - currentMode->pixmapWidth = currentMode->imageWidth; - currentMode->pixmapHeight = currentMode->imageHeight; - currentMode->maxViewportX = currentMode->imageWidth - currentMode->viewportWidth; - /* this might need to get clamped to some maximum */ - currentMode->maxViewportY = currentMode->imageHeight - currentMode->viewportHeight; - } + currentMode->bytesPerScanline = ((pScrn->displayWidth*pTDFX->cpp)+3) & ~3L; + currentMode->imageWidth = pScrn->displayWidth; + currentMode->imageHeight = pTDFX->pixmapCacheLinesMax; + currentMode->pixmapWidth = currentMode->imageWidth; + currentMode->pixmapHeight = currentMode->imageHeight; + currentMode->maxViewportX = currentMode->imageWidth - + currentMode->viewportWidth; + /* this might need to get clamped to some maximum */ + currentMode->maxViewportY = currentMode->imageHeight - + currentMode->viewportHeight; pMode = pMode->next; if (pMode == firstMode) break; @@ -129,19 +108,17 @@ TDFX_SetMode(ScrnInfoPtr pScrn, DGAModePtr pMode) if (!pMode) { /* restore the original mode */ /* put the ScreenParameters back */ - if (pTDFX->DGAactive) { - TDFXSwitchMode(index, OldModes[index], 0); - TDFXAdjustFrame(pScrn->pScreen->myNum, 0, 0, 0); - pTDFX->DGAactive = FALSE; + if(pTDFX->DGAactive) { + TDFXSwitchMode(index, OldModes[index], 0); + TDFXAdjustFrame(pScrn->pScreen->myNum, 0, 0, 0); + pTDFX->DGAactive = FALSE; } } else { - /* save the old ScreenParameters */ - if (!pTDFX->DGAactive) { - OldModes[index] = pScrn->currentMode; - pTDFX->DGAactive = TRUE; + if (!pTDFX->DGAactive) { /* save the old parameters */ + OldModes[index] = pScrn->currentMode; + pTDFX->DGAactive = TRUE; } - pScrn->displayWidth = pMode->bytesPerScanline / pTDFX->cpp; TDFXSwitchMode(index, pMode->mode, 0); } @@ -164,10 +141,11 @@ TDFX_SetViewport(ScrnInfoPtr pScrn, int x, int y, int flags) TDFXAdjustFrame(pScrn->pScreen->myNum, x, y, flags); - while (hwp->readST01(hwp) & 0x08); - while (!(hwp->readST01(hwp) & 0x08)); + /* fixme */ + while(hwp->readST01(hwp) & 0x08); + while(!(hwp->readST01(hwp) & 0x08)); - pTDFX->DGAViewportStatus = 0; + pTDFX->DGAViewportStatus = 0; } static void @@ -223,9 +201,9 @@ TDFX_OpenFramebuffer( TDFXPtr pTDFX = TDFXPTR(pScrn); *name = NULL; /* no special device */ - *mem = (unsigned char*)pTDFX->LinearAddr[0]; + *mem = (unsigned char*)pTDFX->LinearAddr[0] + pTDFX->fbOffset; *size = pTDFX->FbMapSize; - *offset = 0; + *offset = /* pTDFX->fbOffset */ 0 ; /* DGA is broken */ *flags = DGA_NEED_ROOT; return TRUE; |