xf86-video-intel: src/i830_dri.c

Michel Daenzer daenzer at kemper.freedesktop.org
Mon Mar 12 19:55:45 EET 2007


 src/i830_dri.c |   60 ++++++++++++++++++++++++++++++---------------------------
 1 files changed, 32 insertions(+), 28 deletions(-)

New commits:
diff-tree 7c561956a28e90667fef140bc3cfa0edca464f15 (from fe59ab9f562fd10118563d80eb3351a4d3b48b3f)
Author: Michel Dänzer <michel at tungstengraphics.com>
Date:   Mon Mar 12 18:55:27 2007 +0100

    Defer flipping pages back to normal until the end of the DRI block handler.
    
    Doing it earlier can result in the wrong page being visible, giving the
    appearance of a frozen X server.

diff --git a/src/i830_dri.c b/src/i830_dri.c
index 5a3aec0..96061bd 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -1167,6 +1167,8 @@ I830DRISwapContext(ScreenPtr pScreen, DR
    } else if (syncType == DRI_2D_SYNC &&
 	      oldContextType == DRI_NO_CONTEXT &&
 	      newContextType == DRI_2D_CONTEXT) {
+      drmI830Sarea *sPriv = (drmI830Sarea *) DRIGetSAREAPrivate(pScreen);
+
       if (I810_DEBUG & DEBUG_VERBOSE_DRI)
 	 ErrorF("i830DRISwapContext (out)\n");
 
@@ -1194,6 +1196,33 @@ I830DRISwapContext(ScreenPtr pScreen, DR
 
       I830EmitFlush(pScrn);
 
+#ifdef DAMAGE
+      /* Try flipping back to the front page if necessary */
+      if (sPriv && !sPriv->pf_enabled && sPriv->pf_current_page != 0) {
+	 drm_i915_flip_t flip = { .pipes = 0 };
+
+	 if (sPriv->pf_current_page & (0x3 << 2)) {
+	    sPriv->pf_current_page = sPriv->pf_current_page & 0x3;
+	    sPriv->pf_current_page |= (sPriv->third_handle ? 2 : 1) << 2;
+
+	    flip.pipes |= 0x2;
+	 }
+
+	 if (sPriv->pf_current_page & 0x3) {
+	    sPriv->pf_current_page = sPriv->pf_current_page & (0x3 << 2);
+	    sPriv->pf_current_page |= sPriv->third_handle ? 2 : 1;
+
+	    flip.pipes |= 0x1;
+	 }
+
+	 drmCommandWrite(pI830->drmSubFD, DRM_I915_FLIP, &flip, sizeof(flip));
+
+	 if (sPriv->pf_current_page != 0)
+	    xf86DrvMsg(pScreen->myNum, X_WARNING,
+		       "[dri] %s: kernel failed to unflip buffers.\n", __func__);
+      }
+#endif
+
       pI830->LockHeld = 0;
    } else if (I810_DEBUG & DEBUG_VERBOSE_DRI)
       ErrorF("i830DRISwapContext (other)\n");
@@ -1448,7 +1477,7 @@ I830DRISetPfMask(ScreenPtr pScreen, int 
       pSAREAPriv->pf_enabled = pI830->allowPageFlip;
       pSAREAPriv->pf_active = pfMask;
    } else
-      pSAREAPriv->pf_enabled = pSAREAPriv->pf_active = 0;
+      pSAREAPriv->pf_active = 0;
 }
 
 static void
@@ -1501,36 +1530,11 @@ typedef struct drm_i915_flip {
 static void
 I830DRITransitionTo2d(ScreenPtr pScreen)
 {
-   ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-   I830Ptr pI830 = I830PTR(pScrn);
    drmI830Sarea *sPriv = (drmI830Sarea *) DRIGetSAREAPrivate(pScreen);
 
-   /* Try flipping back to the front page if necessary */
-   if (sPriv->pf_current_page != 0) {
-      drm_i915_flip_t flip = { .pipes = 0 };
-
-      if (sPriv->pf_current_page & (0x3 << 2)) {
-	 sPriv->pf_current_page = sPriv->pf_current_page & 0x3;
-	 sPriv->pf_current_page |= (sPriv->third_handle ? 2 : 1) << 2;
-
-	 flip.pipes |= 0x2;
-      }
-
-      if (sPriv->pf_current_page & 0x3) {
-	 sPriv->pf_current_page = sPriv->pf_current_page & (0x3 << 2);
-	 sPriv->pf_current_page |= sPriv->third_handle ? 2 : 1;
-
-	 flip.pipes |= 0x1;
-      }
-
-      drmCommandWrite(pI830->drmSubFD, DRM_I915_FLIP, &flip, sizeof(flip));
-   }
-
-   if (sPriv->pf_current_page != 0)
-      xf86DrvMsg(pScreen->myNum, X_WARNING,
-		 "[dri] %s: kernel failed to unflip buffers.\n", __func__);
-
    I830DRISetPfMask(pScreen, 0);
+
+   sPriv->pf_enabled = 0;
 }
 
 static void



More information about the xorg-commit mailing list