xf86-video-intel: src/i830_accel.c src/i830_batchbuffer.c src/i830_driver.c src/i830.h src/i830_render.c src/i830_uxa.c src/i915_video.c src/i965_render.c src/i965_video.c

Chris Wilson ickle at kemper.freedesktop.org
Wed Oct 14 03:54:42 PDT 2009


 src/i830.h             |   16 +++++++++-------
 src/i830_accel.c       |    9 +++------
 src/i830_batchbuffer.c |   14 ++++++++++++++
 src/i830_driver.c      |   23 +++++++++++++++++++++++
 src/i830_render.c      |    4 ----
 src/i830_uxa.c         |    6 +++---
 src/i915_video.c       |    2 ++
 src/i965_render.c      |    2 --
 src/i965_video.c       |    2 ++
 9 files changed, 56 insertions(+), 22 deletions(-)

New commits:
commit 3c0815abf28744e215bea286e71d935cd486955a
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Oct 14 11:29:21 2009 +0100

    conf: Add debugging flush options
    
    Make the following options available via xorg.conf:
      Section "Driver"
        Option "DebugFlushBatches" "1" # Flush the batch buffer after every
                                       # single operation;
    
        Option "DebugFlushCaches" "1" # Include a MI_FLUSH at the end of every
                                      # batch buffer to force data to be
                                      # flushed out of cache and into memory
                                      # before the completion of the batch.
    
        Option "DebugWait" "1" # Wait for the completion of every batch buffer
                               # before continuing, i.e. perform synchronous
                               # rendering.
      EndSection
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/i830.h b/src/i830.h
index 2d7fc5b..3143e5d 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -295,8 +295,16 @@ typedef struct intel_screen_private {
 	 * User option to print acceleration fallback info to the server log.
 	 */
 	Bool fallback_debug;
+	unsigned debug_flush;
 } intel_screen_private;
 
+enum {
+	DEBUG_FLUSH_BATCHES = 0x1,
+	DEBUG_FLUSH_CACHES = 0x2,
+	DEBUG_FLUSH_WAIT = 0x4,
+};
+
+
 static inline intel_screen_private *
 intel_get_screen_private(ScrnInfoPtr scrn)
 {
@@ -493,13 +501,7 @@ enum {
 	INTEL_CREATE_PIXMAP_TILING_Y,
 };
 
-#if (ALWAYS_FLUSH | ALWAYS_SYNC)
-void i830_debug_sync(ScrnInfoPtr scrn);
-#else
-static inline void i830_debug_sync(ScrnInfoPtr scrn)
-{
-}
-#endif
+void i830_debug_flush(ScrnInfoPtr scrn);
 
 static inline PixmapPtr get_drawable_pixmap(DrawablePtr drawable)
 {
diff --git a/src/i830_accel.c b/src/i830_accel.c
index 90e5e16..e1aae6c 100644
--- a/src/i830_accel.c
+++ b/src/i830_accel.c
@@ -84,15 +84,12 @@ void I830EmitFlush(ScrnInfoPtr scrn)
 	}
 }
 
-#if (ALWAYS_SYNC || ALWAYS_FLUSH)
-void i830_debug_sync(ScrnInfoPtr scrn)
+void i830_debug_flush(ScrnInfoPtr scrn)
 {
-	if (ALWAYS_SYNC)
-		I830Sync(scrn);
-	else
+	intel_screen_private *intel = intel_get_screen_private(scrn);
+	if (intel->debug_flush & DEBUG_FLUSH_BATCHES)
 		intel_batch_flush(scrn, FALSE);
 }
-#endif
 
 /* The following function sets up the supported acceleration. Call it
  * from the FbInit() function in the SVGA driver, or before ScreenInit
diff --git a/src/i830_batchbuffer.c b/src/i830_batchbuffer.c
index f662dfc..62466b7 100644
--- a/src/i830_batchbuffer.c
+++ b/src/i830_batchbuffer.c
@@ -98,6 +98,17 @@ void intel_batch_flush(ScrnInfoPtr scrn, Bool flushed)
 	if (intel->batch_used == 0)
 		return;
 
+	if (intel->debug_flush & DEBUG_FLUSH_CACHES) {
+		int flags = MI_WRITE_DIRTY_STATE | MI_INVALIDATE_MAP_CACHE;
+
+		if (IS_I965G(intel))
+			flags = 0;
+
+		*(uint32_t *) (intel->batch_ptr + intel->batch_used) =
+			MI_FLUSH | flags;
+		intel->batch_used += 4;
+	}
+
 	/* Emit a padding dword if we aren't going to be quad-word aligned. */
 	if ((intel->batch_used & 4) == 0) {
 		*(uint32_t *) (intel->batch_ptr + intel->batch_used) = MI_NOOP;
@@ -134,6 +145,9 @@ void intel_batch_flush(ScrnInfoPtr scrn, Bool flushed)
 	 */
 	intel->need_mi_flush = TRUE;
 
+	if (intel->debug_flush & DEBUG_FLUSH_WAIT)
+		intel_batch_wait_last(scrn);
+
 	if (intel->batch_flush_notify)
 		intel->batch_flush_notify(scrn);
 }
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 8b5e946..ede4344 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -171,6 +171,9 @@ typedef enum {
    OPTION_XVMC,
 #endif
    OPTION_PREFER_OVERLAY,
+   OPTION_DEBUG_FLUSH_BATCHES,
+   OPTION_DEBUG_FLUSH_CACHES,
+   OPTION_DEBUG_WAIT,
 } I830Opts;
 
 static OptionInfoRec I830Options[] = {
@@ -184,6 +187,9 @@ static OptionInfoRec I830Options[] = {
    {OPTION_XVMC,	"XvMC",		OPTV_BOOLEAN,	{0},	TRUE},
 #endif
    {OPTION_PREFER_OVERLAY, "XvPreferOverlay", OPTV_BOOLEAN, {0}, FALSE},
+   {OPTION_DEBUG_FLUSH_BATCHES, "DebugFlushBatches", OPTV_BOOLEAN, {0}, FALSE},
+   {OPTION_DEBUG_FLUSH_CACHES, "DebugFlushCaches", OPTV_BOOLEAN, {0}, FALSE},
+   {OPTION_DEBUG_WAIT, "DebugWait", OPTV_BOOLEAN, {0}, FALSE},
    {-1,			NULL,		OPTV_NONE,	{0},	FALSE}
 };
 /* *INDENT-ON* */
@@ -665,6 +671,23 @@ static Bool I830GetEarlyOptions(ScrnInfoPtr scrn)
 						     OPTION_FALLBACKDEBUG,
 						     FALSE);
 
+	intel->debug_flush = 0;
+
+	if (xf86ReturnOptValBool(intel->Options,
+				 OPTION_DEBUG_FLUSH_BATCHES,
+				 FALSE))
+		intel->debug_flush |= DEBUG_FLUSH_BATCHES;
+
+	if (xf86ReturnOptValBool(intel->Options,
+				 OPTION_DEBUG_FLUSH_CACHES,
+				 FALSE))
+		intel->debug_flush |= DEBUG_FLUSH_CACHES;
+
+	if (xf86ReturnOptValBool(intel->Options,
+				 OPTION_DEBUG_WAIT,
+				 FALSE))
+		intel->debug_flush |= DEBUG_FLUSH_WAIT;
+
 	return TRUE;
 }
 
diff --git a/src/i830_render.c b/src/i830_render.c
index a7fac17..b141ba4 100644
--- a/src/i830_render.c
+++ b/src/i830_render.c
@@ -527,8 +527,6 @@ i830_prepare_composite(int op, PicturePtr source_picture,
 		intel->s8_blendctl = blendctl;
 	}
 
-	i830_debug_sync(scrn);
-
 	intel->needs_render_state_emit = TRUE;
 
 	return TRUE;
@@ -819,8 +817,6 @@ i830_composite(PixmapPtr dest, int srcX, int srcY, int maskX, int maskY,
 				      dstY, w, h);
 
 	intel_batch_end_atomic(scrn);
-
-	i830_debug_sync(scrn);
 }
 
 void i830_batch_flush_notify(ScrnInfoPtr scrn)
diff --git a/src/i830_uxa.c b/src/i830_uxa.c
index f4743d0..8c26d09 100644
--- a/src/i830_uxa.c
+++ b/src/i830_uxa.c
@@ -228,7 +228,7 @@ static void i830_uxa_done_solid(PixmapPtr pixmap)
 {
 	ScrnInfoPtr scrn = xf86Screens[pixmap->drawable.pScreen->myNum];
 
-	i830_debug_sync(scrn);
+	i830_debug_flush(scrn);
 }
 
 /**
@@ -336,7 +336,7 @@ static void i830_uxa_done_copy(PixmapPtr dest)
 {
 	ScrnInfoPtr scrn = xf86Screens[dest->drawable.pScreen->myNum];
 
-	i830_debug_sync(scrn);
+	i830_debug_flush(scrn);
 }
 
 /**
@@ -348,7 +348,7 @@ void i830_done_composite(PixmapPtr dest)
 {
 	ScrnInfoPtr scrn = xf86Screens[dest->drawable.pScreen->myNum];
 
-	i830_debug_sync(scrn);
+	i830_debug_flush(scrn);
 }
 
 #define xFixedToFloat(val) \
diff --git a/src/i915_video.c b/src/i915_video.c
index 34ad8f9..e54bd9b 100644
--- a/src/i915_video.c
+++ b/src/i915_video.c
@@ -460,4 +460,6 @@ I915DisplayVideoTextured(ScrnInfoPtr scrn,
 
 		intel_batch_end_atomic(scrn);
 	}
+
+	i830_debug_flush(scrn);
 }
diff --git a/src/i965_render.c b/src/i965_render.c
index f0aaa3d..ce9b235 100644
--- a/src/i965_render.c
+++ b/src/i965_render.c
@@ -1796,8 +1796,6 @@ i965_composite(PixmapPtr dest, int srcX, int srcY, int maskX, int maskY,
 	drm_intel_bo_unreference(vb_bo);
 
 	intel_batch_end_atomic(scrn);
-
-	i830_debug_sync(scrn);
 }
 
 void i965_batch_flush_notify(ScrnInfoPtr scrn)
diff --git a/src/i965_video.c b/src/i965_video.c
index 0fc10a7..89d5eef 100644
--- a/src/i965_video.c
+++ b/src/i965_video.c
@@ -1259,6 +1259,8 @@ I965DisplayVideoTextured(ScrnInfoPtr scrn,
 #if WATCH_STATS
 	/* i830_dump_error_state(scrn); */
 #endif
+
+	i830_debug_flush(scrn);
 }
 
 void i965_free_video(ScrnInfoPtr scrn)


More information about the xorg-commit mailing list