From 54a78b4d252ba06dd520c5d43ad55b31323408ec Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Thu, 7 Oct 2004 03:40:46 +0000 Subject: Require tiled mode for 3D --- src/savage_accel.c | 15 +------- src/savage_dri.c | 103 +++++++++++++++++++++------------------------------- src/savage_driver.c | 9 +++-- src/savage_driver.h | 2 - 4 files changed, 49 insertions(+), 80 deletions(-) diff --git a/src/savage_accel.c b/src/savage_accel.c index c449a55..29f1747 100644 --- a/src/savage_accel.c +++ b/src/savage_accel.c @@ -403,20 +403,10 @@ SavageSetGBD(ScrnInfoPtr pScrn) psav->lDelta = ((psav->lDelta + 31) >> 5) << 5; psav->ulAperturePitch = psav->lDelta; } - - /* if you are using linear mode for 2D, 3D still needs to be tiled, linear AperturePitch/Delta - seem to be wrong for savagespan */ - if (psav->Chipset == S3_SAVAGE_MX || psav->Chipset == S3_SAVAGE3D) - psav->ul3DAperturePitch = 0x2000; - else - psav->ul3DAperturePitch = GetTileAperturePitch(pScrn->virtualX,pScrn->bitsPerPixel); - - psav->l3DDelta = (((pScrn->virtualX * (pScrn->bitsPerPixel >> 3)) + 127) >> 7) << 7; psav->Bpp = pScrn->bitsPerPixel >> 3; psav->cxMemory = psav->lDelta / (psav->Bpp); psav->cyMemory = psav->endfb / psav->lDelta - 1; - /*psav->cyMemory = (psav->CursorKByte << 10) / (pScrn->displayWidth * (pScrn->bitsPerPixel / 8));*/ /* ??????????? */ if (psav->cyMemory > 2048) psav->cyMemory = 2048; @@ -1364,16 +1354,13 @@ SavageInitAccel(ScreenPtr pScreen) SAVAGEDRIServerPrivatePtr pSAVAGEDRIServer = psav->DRIServerInfo; BoxRec MemBox; int cpp = pScrn->bitsPerPixel / 8; - /*int widthBytes = pScrn->displayWidth * cpp;*/ int widthBytes = psav->lDelta; - /*int widthBytes = psav->l3DDelta;*/ int bufferSize = ((pScrn->virtualY * widthBytes + SAVAGE_BUFFER_ALIGN) & ~SAVAGE_BUFFER_ALIGN); int tiledwidthBytes,tiledBufferSize; pSAVAGEDRIServer->frontbufferSize = bufferSize; - /*tiledwidthBytes = psav->lDelta;*/ - tiledwidthBytes = psav->l3DDelta; + tiledwidthBytes = psav->lDelta; if (cpp == 2) { tiledBufferSize = ((pScrn->virtualX+63)/64)*((pScrn->virtualY+15)/16) diff --git a/src/savage_dri.c b/src/savage_dri.c index 9d539d9..7c569cc 100644 --- a/src/savage_dri.c +++ b/src/savage_dri.c @@ -697,8 +697,7 @@ static Bool SAVAGEDRIAgpInit(ScreenPtr pScreen) int size,numbuffer,i; savageAgpBufferPtr agpbuffer; - /* FIXME: Make these configurable... - */ + /*pSAVAGEDRIServer->agp.size = 16 * 1024 * 1024;*/ pSAVAGEDRIServer->agp.size = psav->agpSize * 1024 * 1024; pSAVAGEDRIServer->agp.offset = pSAVAGEDRIServer->agp.size; @@ -1295,7 +1294,7 @@ Bool SAVAGEDRIFinishScreenInit( ScreenPtr pScreen ) pSAVAGEDRI->frontbuffer = psav->FrameBufferBase + pSAVAGEDRI->frontOffset; pSAVAGEDRI->frontPitch = pSAVAGEDRIServer->frontPitch; - pSAVAGEDRI->IsfrontTiled = psav->bTiled; /* AGD: was 0 */ + pSAVAGEDRI->IsfrontTiled = psav->bTiled; if(pSAVAGEDRI->cpp==2) TileStride = (pSAVAGEDRI->width+63)&(~63); @@ -1307,62 +1306,45 @@ Bool SAVAGEDRIFinishScreenInit( ScreenPtr pScreen ) else zTileStride = (pSAVAGEDRI->width+31)&(~31); - if(pSAVAGEDRI->IsfrontTiled) - { - if ((psav->Chipset == S3_TWISTER) - || (psav->Chipset == S3_PROSAVAGE) - || (psav->Chipset == S3_PROSAVAGEDDR) - || (psav->Chipset == S3_SUPERSAVAGE)) - { - pSAVAGEDRI->frontBitmapDesc = BCI_BD_BW_DISABLE | /* block write disabled */ - (1<<24) | /* destination tile format */ - (pScrn->bitsPerPixel<<16) | /* bpp */ - TileStride; /* stride */ - pSAVAGEDRI->frontPitch = TileStride; - } else { - pSAVAGEDRI->frontBitmapDesc = BCI_BD_BW_DISABLE | /* block write disabled */ - ((pSAVAGEDRI->cpp==2)? - BCI_BD_TILE_16:BCI_BD_TILE_32) | /*16/32 bpp tile format */ - (pScrn->bitsPerPixel<<16) | /* bpp */ - TileStride; /* stride */ - pSAVAGEDRI->frontPitch = TileStride; - } - } - else - { - pSAVAGEDRI->frontBitmapDesc = BCI_BD_BW_DISABLE | /* AGD: block write should be disabled: was 0x00000000 */ - pScrn->bitsPerPixel<<16 | - pSAVAGEDRI->width; - } - - { - if ((psav->Chipset == S3_TWISTER) - || (psav->Chipset == S3_PROSAVAGE) - || (psav->Chipset == S3_PROSAVAGEDDR) - || (psav->Chipset == S3_SUPERSAVAGE)) - { - pSAVAGEDRI->backBitmapDesc = BCI_BD_BW_DISABLE | - (1<<24) | - (pScrn->bitsPerPixel<<16) | - TileStride; - pSAVAGEDRI->depthBitmapDesc = BCI_BD_BW_DISABLE | - (1<<24) | - (pScrn->bitsPerPixel<<16) | - zTileStride; - } else { - pSAVAGEDRI->backBitmapDesc = BCI_BD_BW_DISABLE | - ((pSAVAGEDRI->cpp==2)? - BCI_BD_TILE_16:BCI_BD_TILE_32) | - (pScrn->bitsPerPixel<<16) | - TileStride; - pSAVAGEDRI->depthBitmapDesc = BCI_BD_BW_DISABLE | - ((pSAVAGEDRI->zpp==2)? - BCI_BD_TILE_16:BCI_BD_TILE_32) | - (pScrn->bitsPerPixel<<16) | - zTileStride; - } + if ((psav->Chipset == S3_TWISTER) + || (psav->Chipset == S3_PROSAVAGE) + || (psav->Chipset == S3_PROSAVAGEDDR) + || (psav->Chipset == S3_SUPERSAVAGE)) { + pSAVAGEDRI->frontBitmapDesc = BCI_BD_BW_DISABLE | /* block write disabled */ + (1<<24) | /* destination tile format */ + (pScrn->bitsPerPixel<<16) | /* bpp */ + TileStride; /* stride */ + + pSAVAGEDRI->backBitmapDesc = BCI_BD_BW_DISABLE | + (1<<24) | + (pScrn->bitsPerPixel<<16) | + TileStride; + + pSAVAGEDRI->depthBitmapDesc = BCI_BD_BW_DISABLE | + (1<<24) | + (pScrn->bitsPerPixel<<16) | + zTileStride; + } else { + pSAVAGEDRI->frontBitmapDesc = BCI_BD_BW_DISABLE | /* block write disabled */ + ((pSAVAGEDRI->cpp==2)? + BCI_BD_TILE_16:BCI_BD_TILE_32) | /*16/32 bpp tile format */ + (pScrn->bitsPerPixel<<16) | /* bpp */ + TileStride; /* stride */ + + pSAVAGEDRI->backBitmapDesc = BCI_BD_BW_DISABLE | + ((pSAVAGEDRI->cpp==2)? + BCI_BD_TILE_16:BCI_BD_TILE_32) | + (pScrn->bitsPerPixel<<16) | + TileStride; + + pSAVAGEDRI->depthBitmapDesc = BCI_BD_BW_DISABLE | + ((pSAVAGEDRI->zpp==2)? + BCI_BD_TILE_16:BCI_BD_TILE_32) | + (pScrn->bitsPerPixel<<16) | + zTileStride; } + pSAVAGEDRI->frontPitch = TileStride; pSAVAGEDRI->backOffset = pSAVAGEDRIServer->backOffset; pSAVAGEDRI->backbufferSize = pSAVAGEDRIServer->backbufferSize; pSAVAGEDRI->backbuffer = psav->FrameBufferBase + @@ -1409,8 +1391,7 @@ Bool SAVAGEDRIFinishScreenInit( ScreenPtr pScreen ) if(pSAVAGEDRI->width > 1024) shift = 1; - /* pSAVAGEDRI->aperturePitch = psav->ulAperturePitch; */ - pSAVAGEDRI->aperturePitch = psav->ul3DAperturePitch; + pSAVAGEDRI->aperturePitch = psav->ulAperturePitch; } { @@ -1427,10 +1408,10 @@ Bool SAVAGEDRIFinishScreenInit( ScreenPtr pScreen ) || (psav->Chipset == S3_SAVAGE3D)) { if(pSAVAGEDRI->cpp == 2) { - value |= ((psav->l3DDelta / 4) >> 5) << 24; + value |= ((psav->lDelta / 4) >> 5) << 24; value |= 2<<30; } else { - value |= ((psav->l3DDelta / 4) >> 5) << 24; + value |= ((psav->lDelta / 4) >> 5) << 24; value |= 3<<30; } diff --git a/src/savage_driver.c b/src/savage_driver.c index 0d4c1f2..d99b16a 100644 --- a/src/savage_driver.c +++ b/src/savage_driver.c @@ -2752,12 +2752,11 @@ static Bool SavageCheckAvailableRamFor3D(ScrnInfoPtr pScrn) int cpp = pScrn->bitsPerPixel / 8; /*int widthBytes = pScrn->displayWidth * cpp;*/ int widthBytes = psav->lDelta; - /*int widthBytes = psav->l3DDelta;*/ int bufferSize = ((pScrn->virtualY * widthBytes + SAVAGE_BUFFER_ALIGN) & ~SAVAGE_BUFFER_ALIGN); int tiledwidthBytes, tiledBufferSize, RamNeededFor3D; - /*tiledwidthBytes = psav->lDelta;*/ - tiledwidthBytes = psav->l3DDelta; + + tiledwidthBytes = psav->lDelta; if (cpp == 2) { tiledBufferSize = ((pScrn->virtualX+63)/64)*((pScrn->virtualY+15)/16) * 2048; @@ -2862,6 +2861,10 @@ static Bool SavageScreenInit(int scrnIndex, ScreenPtr pScreen, "Direct Rendering Disabled -- " "Dual-head configuration is not working with " "DRI at present.\n"); + } else if (!psav->bTiled) { + xf86DrvMsg(scrnIndex, X_WARNING, + "Direct Rendering requires a tiled framebuffer -- " + "Set Option \"DisableTile\" \"false\"\n"); } else if (((psav->Chipset == S3_TWISTER) || (psav->Chipset == S3_PROSAVAGE) || (psav->Chipset == S3_SAVAGE4) diff --git a/src/savage_driver.h b/src/savage_driver.h index 867bcdb..223d02b 100644 --- a/src/savage_driver.h +++ b/src/savage_driver.h @@ -350,8 +350,6 @@ typedef struct _Savage { int lDelta; int ulAperturePitch; /* aperture pitch */ - int l3DDelta; - int ul3DAperturePitch; /* pitch for 3D */ /* * cxMemory is number of pixels across screen width * cyMemory is number of scanlines in available adapter memory. -- cgit v1.2.3