summaryrefslogtreecommitdiff
path: root/src/i830_dri.c
diff options
context:
space:
mode:
authorMichel Dänzer <michel@tungstengraphics.com>2007-03-12 18:55:27 +0100
committerMichel Dänzer <michel@tungstengraphics.com>2007-03-12 18:55:27 +0100
commit7c561956a28e90667fef140bc3cfa0edca464f15 (patch)
tree2a76cbe5bf54d651b56c4af465571323b6f2ae66 /src/i830_dri.c
parentfe59ab9f562fd10118563d80eb3351a4d3b48b3f (diff)
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.
Diffstat (limited to 'src/i830_dri.c')
-rw-r--r--src/i830_dri.c60
1 files changed, 32 insertions, 28 deletions
diff --git a/src/i830_dri.c b/src/i830_dri.c
index 5a3aec0f..96061bd2 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -1167,6 +1167,8 @@ I830DRISwapContext(ScreenPtr pScreen, DRISyncType syncType,
} 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, DRISyncType syncType,
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 pfMask)
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