[PATCH 2/4] savage: New SAVAGEDRIResume function

Tormod Volden lists.tormod at gmail.com
Wed Apr 20 13:09:50 PDT 2011


From: Tormod Volden <debian.tormod at gmail.com>

Move DRI stuff from savage_driver.c to savage_dri.c

Signed-off-by: Tormod Volden <debian.tormod at gmail.com>
---

This one should not change any behavior, but prepares for the next
patch. It is very much modeled after the function structure of the
radeon driver, which the savage driver once was based on.


 src/savage_dri.c    |   14 +++++++++++++-
 src/savage_driver.c |    9 ++-------
 src/savage_driver.h |    2 +-
 3 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/src/savage_dri.c b/src/savage_dri.c
index e0b9f86..b1555e4 100644
--- a/src/savage_dri.c
+++ b/src/savage_dri.c
@@ -1078,7 +1078,7 @@ Bool SAVAGEDRIScreenInit( ScreenPtr pScreen )
    return TRUE;
 }
 
-void SAVAGEDRISetupTiledSurfaceRegs( SavagePtr psav )
+static void SAVAGEDRISetupTiledSurfaceRegs( SavagePtr psav )
 {
       SAVAGEDRIPtr pSAVAGEDRI = (SAVAGEDRIPtr)psav->pDRIInfo->devPrivate;
       unsigned int value = 0;
@@ -1287,6 +1287,18 @@ Bool SAVAGEDRIFinishScreenInit( ScreenPtr pScreen )
    return TRUE;
 }
 
+void SAVAGEDRIResume(ScreenPtr pScreen)
+{
+   ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+   SavagePtr psav = SAVPTR(pScrn);
+   SAVAGESAREAPrivPtr pSAREAPriv = 
+			(SAVAGESAREAPrivPtr)DRIGetSAREAPrivate(pScreen);
+
+   SAVAGEDRISetupTiledSurfaceRegs(psav);
+   /* Assume that 3D state was clobbered, invalidate it by
+    * changing ctxOwner in the sarea. */
+   pSAREAPriv->ctxOwner = DRIGetContext(pScreen);
+}
 
 void SAVAGEDRICloseScreen( ScreenPtr pScreen )
 {
diff --git a/src/savage_driver.c b/src/savage_driver.c
index 3098731..2edd844 100644
--- a/src/savage_driver.c
+++ b/src/savage_driver.c
@@ -2200,9 +2200,8 @@ static Bool SavageEnterVT(int scrnIndex, int flags)
 {
     ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
 #ifdef XF86DRI
-    SavagePtr psav= SAVPTR(pScrn);
+    SavagePtr psav = SAVPTR(pScrn);
     ScreenPtr pScreen;
-    SAVAGESAREAPrivPtr pSAREAPriv;
 #endif
 
     TRACE(("SavageEnterVT(%d)\n", flags));
@@ -2213,13 +2212,9 @@ static Bool SavageEnterVT(int scrnIndex, int flags)
 #ifdef XF86DRI
     if (psav->directRenderingEnabled) {
         pScreen = screenInfo.screens[scrnIndex];
-	pSAREAPriv = (SAVAGESAREAPrivPtr)DRIGetSAREAPrivate(pScreen);
-	/* Assume that 3D state was clobbered, invalidate it by
-	 * changing ctxOwner in the sarea. */
-	pSAREAPriv->ctxOwner = DRIGetContext(pScreen);
+        SAVAGEDRIResume(pScreen);
         DRIUnlock(pScreen);
         psav->LockHeld = 0;
-        SAVAGEDRISetupTiledSurfaceRegs ( psav );
     }
 #endif
     if (!SAVPTR(pScrn)->IsSecondary)
diff --git a/src/savage_driver.h b/src/savage_driver.h
index 64587fc..fde47ff 100644
--- a/src/savage_driver.h
+++ b/src/savage_driver.h
@@ -559,7 +559,7 @@ Bool SAVAGEDRIScreenInit( ScreenPtr pScreen );
 Bool SAVAGEInitMC(ScreenPtr pScreen);
 void SAVAGEDRICloseScreen( ScreenPtr pScreen );
 Bool SAVAGEDRIFinishScreenInit( ScreenPtr pScreen );
-void SAVAGEDRISetupTiledSurfaceRegs ( SavagePtr psav );
+void SAVAGEDRIResume( ScreenPtr pScreen );
 
 Bool SAVAGELockUpdate( ScrnInfoPtr pScrn, drmLockFlags flags );
 
-- 
1.7.0.4



More information about the xorg-devel mailing list