summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTormod Volden <debian.tormod@gmail.com>2011-01-23 20:23:48 +0100
committerAlex Deucher <alexdeucher@gmail.com>2011-01-25 13:27:42 -0500
commitf3cd2946d0f38e89643aa6624e6bf35472828995 (patch)
treeb5cbe034311310373723ceca003c50c334fb6b74
parent055ca25faeb9decee091e8c59134c8f537bb7bc3 (diff)
savage: Factor out a SAVAGEDRISetupTiledSurfaceRegs function
The tiled surface registers were only setup in SAVAGEDRIScreenInit, however, after suspend/resume these registers must be set up again. So factor it out in a new function so it can be reused.
-rw-r--r--src/savage_dri.c86
1 files changed, 44 insertions, 42 deletions
diff --git a/src/savage_dri.c b/src/savage_dri.c
index 088c4b2..2c7a077 100644
--- a/src/savage_dri.c
+++ b/src/savage_dri.c
@@ -1078,6 +1078,49 @@ Bool SAVAGEDRIScreenInit( ScreenPtr pScreen )
return TRUE;
}
+void SAVAGEDRISetupTiledSurfaceRegs( SavagePtr psav )
+{
+ SAVAGEDRIPtr pSAVAGEDRI = (SAVAGEDRIPtr)psav->pDRIInfo->devPrivate;
+ unsigned int value = 0;
+
+ OUTREG(0x850C,(INREG(0x850C) | 0x00008000)); /* AGD: I don't think this does anything on 3D/MX/IX */
+ /* maybe savage4 too... */
+ /* we don't use Y range flag,so comment it */
+ /*
+ if(pSAVAGEDRI->width <= 1024)
+ value |= (1<<29);
+ */
+ if ((psav->Chipset == S3_SAVAGE_MX) /* 3D/MX/IX seem to set up the tile stride differently */
+ || (psav->Chipset == S3_SAVAGE3D)) {
+ if(pSAVAGEDRI->cpp == 2)
+ {
+ value |= ((psav->lDelta / 4) >> 5) << 24;
+ value |= 2<<30;
+ } else {
+ value |= ((psav->lDelta / 4) >> 5) << 24;
+ value |= 3<<30;
+ }
+
+ OUTREG(TILED_SURFACE_REGISTER_0, value|(pSAVAGEDRI->frontOffset) ); /* front */
+ OUTREG(TILED_SURFACE_REGISTER_1, value|(pSAVAGEDRI->backOffset) ); /* back */
+ OUTREG(TILED_SURFACE_REGISTER_2, value|(pSAVAGEDRI->depthOffset) ); /* depth */
+ } else {
+ int offset_shift = 5;
+ if(pSAVAGEDRI->cpp == 2)
+ {
+ value |= (((pSAVAGEDRI->width + 0x3F) & 0xFFC0) >> 6) << 20;
+ value |= 2<<30;
+ } else {
+ value |= (((pSAVAGEDRI->width + 0x1F) & 0xFFE0) >> 5) << 20;
+ value |= 3<<30;
+ }
+ if (psav->Chipset == S3_SUPERSAVAGE) /* supersavages have a different shift */
+ offset_shift = 6;
+ OUTREG(TILED_SURFACE_REGISTER_0, value|(pSAVAGEDRI->frontOffset >> offset_shift) ); /* front */
+ OUTREG(TILED_SURFACE_REGISTER_1, value|(pSAVAGEDRI->backOffset >> offset_shift) ); /* back */
+ OUTREG(TILED_SURFACE_REGISTER_2, value|(pSAVAGEDRI->depthOffset >> offset_shift) ); /* depth */
+ }
+}
Bool SAVAGEDRIFinishScreenInit( ScreenPtr pScreen )
{
@@ -1149,48 +1192,6 @@ Bool SAVAGEDRIFinishScreenInit( ScreenPtr pScreen )
pSAVAGEDRI->apertureHandle = pSAVAGEDRIServer->aperture.handle;
pSAVAGEDRI->apertureSize = pSAVAGEDRIServer->aperture.size;
pSAVAGEDRI->aperturePitch = psav->ulAperturePitch;
-
- {
- unsigned int value = 0;
-
- OUTREG(0x850C,(INREG(0x850C) | 0x00008000)); /* AGD: I don't think this does anything on 3D/MX/IX */
- /* maybe savage4 too... */
- /* we don't use Y range flag,so comment it */
- /*
- if(pSAVAGEDRI->width <= 1024)
- value |= (1<<29);
- */
- if ((psav->Chipset == S3_SAVAGE_MX) /* 3D/MX/IX seem to set up the tile stride differently */
- || (psav->Chipset == S3_SAVAGE3D)) {
- if(pSAVAGEDRI->cpp == 2)
- {
- value |= ((psav->lDelta / 4) >> 5) << 24;
- value |= 2<<30;
- } else {
- value |= ((psav->lDelta / 4) >> 5) << 24;
- value |= 3<<30;
- }
-
- OUTREG(TILED_SURFACE_REGISTER_0, value|(pSAVAGEDRI->frontOffset) ); /* front */
- OUTREG(TILED_SURFACE_REGISTER_1, value|(pSAVAGEDRI->backOffset) ); /* back */
- OUTREG(TILED_SURFACE_REGISTER_2, value|(pSAVAGEDRI->depthOffset) ); /* depth */
- } else {
- int offset_shift = 5;
- if(pSAVAGEDRI->cpp == 2)
- {
- value |= (((pSAVAGEDRI->width + 0x3F) & 0xFFC0) >> 6) << 20;
- value |= 2<<30;
- } else {
- value |= (((pSAVAGEDRI->width + 0x1F) & 0xFFE0) >> 5) << 20;
- value |= 3<<30;
- }
- if (psav->Chipset == S3_SUPERSAVAGE) /* supersavages have a different shift */
- offset_shift = 6;
- OUTREG(TILED_SURFACE_REGISTER_0, value|(pSAVAGEDRI->frontOffset >> offset_shift) ); /* front */
- OUTREG(TILED_SURFACE_REGISTER_1, value|(pSAVAGEDRI->backOffset >> offset_shift) ); /* back */
- OUTREG(TILED_SURFACE_REGISTER_2, value|(pSAVAGEDRI->depthOffset >> offset_shift) ); /* depth */
- }
- }
pSAVAGEDRI->statusHandle = pSAVAGEDRIServer->status.handle;
pSAVAGEDRI->statusSize = pSAVAGEDRIServer->status.size;
@@ -1282,6 +1283,7 @@ Bool SAVAGEDRIFinishScreenInit( ScreenPtr pScreen )
xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] sarea_priv_offset:0x%08x\n",pSAVAGEDRI->sarea_priv_offset);
+ SAVAGEDRISetupTiledSurfaceRegs( psav );
return TRUE;
}