From 6e94affcc2240e668bcf1aa41f3c8b19929d144b Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 6 Jun 2008 14:01:05 -0700 Subject: [PATCH] Avoid needless flush emits in the blockhandler. The EmitFlush in i830_dri.c was added as a pageflipping workaround, and was noted to not even be sufficient then. There's no reason for it to be there, so it's removed. After that, we just have to not emit an MI_FLUSH if we already had, and cursor movement no longer bashes memory manager. --- src/i830.h | 2 ++ src/i830_batchbuffer.c | 8 ++++++++ src/i830_dri.c | 4 ---- src/i830_driver.c | 8 ++++---- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/i830.h b/src/i830.h index ccf91a04..403cd63d 100644 --- a/src/i830.h +++ b/src/i830.h @@ -463,6 +463,8 @@ typedef struct _I830Rec { #endif #endif + Bool need_mi_flush; + Bool NeedRingBufferLow; Bool allowPageFlip; Bool TripleBuffer; diff --git a/src/i830_batchbuffer.c b/src/i830_batchbuffer.c index 19d642d5..82758a2d 100644 --- a/src/i830_batchbuffer.c +++ b/src/i830_batchbuffer.c @@ -32,10 +32,12 @@ #include #include +#include #include "xf86.h" #include "i830.h" #include "i830_ring.h" +#include "i915_drm.h" static void intel_next_batch(ScrnInfoPtr pScrn) @@ -116,4 +118,10 @@ intel_batch_flush(ScrnInfoPtr pScrn) dri_bo_unreference(pI830->batch_bo); intel_next_batch(pScrn); + + /* Mark that we need to flush whatever potential rendering we've done in the + * blockhandler. We could set this less often, but it's probably not worth + * the work. + */ + pI830->need_mi_flush = TRUE; } diff --git a/src/i830_dri.c b/src/i830_dri.c index 95e1e724..8ec51fcc 100644 --- a/src/i830_dri.c +++ b/src/i830_dri.c @@ -1067,8 +1067,6 @@ I830DRISwapContext(ScreenPtr pScreen, DRISyncType syncType, pI830->LockHeld = 1; i830_refresh_ring(pScrn); - I830EmitFlush(pScrn); - #ifdef DAMAGE if (!pI830->pDamage && pI830->allowPageFlip) { PixmapPtr pPix = pScreen->GetScreenPixmap(pScreen); @@ -1122,8 +1120,6 @@ I830DRISwapContext(ScreenPtr pScreen, DRISyncType syncType, } #endif - I830EmitFlush(pScrn); - #ifdef DAMAGE /* Try flipping back to the front page if necessary */ if (sPriv && !sPriv->pf_enabled && sPriv->pf_current_page != 0) { diff --git a/src/i830_driver.c b/src/i830_driver.c index 3a9d4252..cb9644ee 100644 --- a/src/i830_driver.c +++ b/src/i830_driver.c @@ -2496,17 +2496,17 @@ I830BlockHandler(int i, if (pScrn->vtSema && !pI830->noAccel) { /* Emit a flush of the rendering cache, or on the 965 and beyond * rendering results may not hit the framebuffer until significantly - * later. In the direct rendering case this is already done just - * after the page flipping updates, so there's no need to duplicate - * the effort here. + * later. */ - if (!pI830->noAccel && !pI830->directRenderingEnabled) + if (!pI830->noAccel && pI830->need_mi_flush) I830EmitFlush(pScrn); /* Flush the batch, so that any rendering is executed in a timely * fashion. */ intel_batch_flush(pScrn); + + pI830->need_mi_flush = FALSE; } /*