xf86-video-intel: src/i830_accel.c src/i830_dri.c src/i830_driver.c src/i830.h

Jesse Barnes jbarnes at kemper.freedesktop.org
Wed Nov 14 11:30:24 PST 2007


 src/i830.h        |    2 -
 src/i830_accel.c  |   19 --------------
 src/i830_dri.c    |    4 +-
 src/i830_driver.c |   73 +++++++++++++++++++++++++++++-------------------------
 4 files changed, 43 insertions(+), 55 deletions(-)

New commits:
commit a2a0821e74a61f53cc7f0c41ce629644ad712114
Author: Jesse Barnes <jbarnes at hobbes.virtuousgeek.org>
Date:   Wed Nov 14 11:30:20 2007 -0800

    Don't stop ring before restoring hw state
    
    Some of the hw state restoration callbacks may want to use the ring for various
    things like stopping video playback, so leave the ring enabled until we get
    back from RestoreHWState.  Also rename the functions so that their purpose is
    clearer and remove a couple of redundant lines.

diff --git a/src/i830.h b/src/i830.h
index 3abc800..2c1ac86 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -664,7 +664,7 @@ i830_crtc_hide_cursor (xf86CrtcPtr crtc);
 void
 i830_crtc_set_cursor_colors (xf86CrtcPtr crtc, int bg, int fg);
 
-extern void I830RefreshRing(ScrnInfoPtr pScrn);
+extern void i830_refresh_ring(ScrnInfoPtr pScrn);
 extern void I830EmitFlush(ScrnInfoPtr pScrn);
 
 #ifdef I830_XV
diff --git a/src/i830_accel.c b/src/i830_accel.c
index 4d9ea79..7501c2b 100644
--- a/src/i830_accel.c
+++ b/src/i830_accel.c
@@ -249,25 +249,6 @@ I830SelectBuffer(ScrnInfoPtr pScrn, int buffer)
 	     buffer, pI830->bufferOffset);
 }
 
-void
-I830RefreshRing(ScrnInfoPtr pScrn)
-{
-   I830Ptr pI830 = I830PTR(pScrn);
-
-   /* If we're reaching RefreshRing as a result of grabbing the DRI lock
-    * before we've set up the ringbuffer, don't bother.
-    */
-   if (pI830->LpRing->mem == NULL)
-       return;
-
-   pI830->LpRing->head = INREG(LP_RING + RING_HEAD) & I830_HEAD_MASK;
-   pI830->LpRing->tail = INREG(LP_RING + RING_TAIL);
-   pI830->LpRing->space = pI830->LpRing->head - (pI830->LpRing->tail + 8);
-   if (pI830->LpRing->space < 0)
-      pI830->LpRing->space += pI830->LpRing->mem->size;
-   i830MarkSync(pScrn);
-}
-
 /* The following function sets up the supported acceleration. Call it
  * from the FbInit() function in the SVGA driver, or before ScreenInit
  * in a monolithic server.
diff --git a/src/i830_dri.c b/src/i830_dri.c
index 4928808..b223b02 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -1093,7 +1093,7 @@ I830DRISwapContext(ScreenPtr pScreen, DRISyncType syncType,
       if (!pScrn->vtSema)
      	 return;
       pI830->LockHeld = 1;
-      I830RefreshRing(pScrn);
+      i830_refresh_ring(pScrn);
 
       I830EmitFlush(pScrn);
 
@@ -1777,7 +1777,7 @@ I830DRILock(ScrnInfoPtr pScrn)
    if (pI830->directRenderingEnabled && !pI830->LockHeld) {
       DRILock(screenInfo.screens[pScrn->scrnIndex], 0);
       pI830->LockHeld = 1;
-      I830RefreshRing(pScrn);
+      i830_refresh_ring(pScrn);
       return TRUE;
    }
    else
diff --git a/src/i830_driver.c b/src/i830_driver.c
index e000d92..abe6932 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -1730,7 +1730,7 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
  * whoever gets control next should do.
  */
 static void
-ResetState(ScrnInfoPtr pScrn, Bool flush)
+i830_stop_ring(ScrnInfoPtr pScrn, Bool flush)
 {
    I830Ptr pI830 = I830PTR(pScrn);
    unsigned long temp;
@@ -1743,34 +1743,23 @@ ResetState(ScrnInfoPtr pScrn, Bool flush)
       pI830->entityPrivate->RingRunning = 0;
 
    /* Flush the ring buffer (if enabled), then disable it. */
-   /* God this is ugly */
-#define flush_ring() do { \
-      temp = INREG(LP_RING + RING_LEN); \
-      if (temp & RING_VALID) { \
-	 I830RefreshRing(pScrn); \
-	 I830Sync(pScrn); \
-	 DO_RING_IDLE(); \
-      } \
-   } while(0)
-#ifdef I830_USE_XAA
-   if (!pI830->useEXA && flush && pI830->AccelInfoRec)
-       flush_ring();
-#endif
-#ifdef I830_USE_EXA
-   if (pI830->useEXA && flush && pI830->EXADriverPtr)
-       flush_ring();
-#endif
-
-   OUTREG(LP_RING + RING_LEN, 0);
-   OUTREG(LP_RING + RING_HEAD, 0);
-   OUTREG(LP_RING + RING_TAIL, 0);
-   OUTREG(LP_RING + RING_START, 0);
+   if (!pI830->noAccel) {
+      temp = INREG(LP_RING + RING_LEN);
+      if (temp & RING_VALID) {
+	 i830_refresh_ring(pScrn);
+	 I830Sync(pScrn);
+	 DO_RING_IDLE();
+      }
 
-   xf86_hide_cursors (pScrn);
+      OUTREG(LP_RING + RING_LEN, 0);
+      OUTREG(LP_RING + RING_HEAD, 0);
+      OUTREG(LP_RING + RING_TAIL, 0);
+      OUTREG(LP_RING + RING_START, 0);
+   }
 }
 
 static void
-SetRingRegs(ScrnInfoPtr pScrn)
+i830_start_ring(ScrnInfoPtr pScrn)
 {
    I830Ptr pI830 = I830PTR(pScrn);
    unsigned int itemp;
@@ -1807,7 +1796,26 @@ SetRingRegs(ScrnInfoPtr pScrn)
    itemp = (pI830->LpRing->mem->size - 4096) & I830_RING_NR_PAGES;
    itemp |= (RING_NO_REPORT | RING_VALID);
    OUTREG(LP_RING + RING_LEN, itemp);
-   I830RefreshRing(pScrn);
+   i830_refresh_ring(pScrn);
+}
+
+void
+i830_refresh_ring(ScrnInfoPtr pScrn)
+{
+   I830Ptr pI830 = I830PTR(pScrn);
+
+   /* If we're reaching RefreshRing as a result of grabbing the DRI lock
+    * before we've set up the ringbuffer, don't bother.
+    */
+   if (pI830->LpRing->mem == NULL)
+       return;
+
+   pI830->LpRing->head = INREG(LP_RING + RING_HEAD) & I830_HEAD_MASK;
+   pI830->LpRing->tail = INREG(LP_RING + RING_TAIL);
+   pI830->LpRing->space = pI830->LpRing->head - (pI830->LpRing->tail + 8);
+   if (pI830->LpRing->space < 0)
+      pI830->LpRing->space += pI830->LpRing->mem->size;
+   i830MarkSync(pScrn);
 }
 
 /*
@@ -1834,8 +1842,7 @@ SetHWOperatingState(ScrnInfoPtr pScrn)
       OUTREG(DSPCLK_GATE_D, OVRUNIT_CLOCK_GATE_DISABLE);
    }
 
-   if (!pI830->noAccel)
-      SetRingRegs(pScrn);
+   i830_start_ring(pScrn);
    if (!pI830->SWCursor)
       I830InitHWCursor(pScrn);
 }
@@ -3002,10 +3009,10 @@ I830LeaveVT(int scrnIndex, int flags)
 
    xf86_hide_cursors (pScrn);
 
-   ResetState(pScrn, TRUE);
-
    RestoreHWState(pScrn);
 
+   i830_stop_ring(pScrn, TRUE);
+
    if (pI830->debug_modes) {
       i830CompareRegsToSnapshot(pScrn, "After LeaveVT");
       i830DumpRegs (pScrn);
@@ -3078,7 +3085,7 @@ I830EnterVT(int scrnIndex, int flags)
 		 "Existing errors found in hardware state.\n");
    }
 
-   ResetState(pScrn, FALSE);
+   i830_stop_ring(pScrn, FALSE);
    SetHWOperatingState(pScrn);
 
    /* Clear the framebuffer */
@@ -3099,7 +3106,7 @@ I830EnterVT(int scrnIndex, int flags)
    }
    i830DescribeOutputConfiguration(pScrn);
 
-   ResetState(pScrn, TRUE);
+   i830_stop_ring(pScrn, TRUE);
    SetHWOperatingState(pScrn);
 
 #ifdef XF86DRI
@@ -3119,7 +3126,7 @@ I830EnterVT(int scrnIndex, int flags)
 
 	 I830DRIResume(screenInfo.screens[scrnIndex]);
       
-	 I830RefreshRing(pScrn);
+	 i830_refresh_ring(pScrn);
 	 I830Sync(pScrn);
 	 DO_RING_IDLE();
 


More information about the xorg-commit mailing list