diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2009-10-14 11:29:21 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2009-10-14 11:53:20 +0100 |
commit | 3c0815abf28744e215bea286e71d935cd486955a (patch) | |
tree | 14df4b6a111ff77e3b7af815a0883cafb00d8178 | |
parent | 2f134b84445d2d0bfe3d81276bc7f6648df062ee (diff) |
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@chris-wilson.co.uk>
-rw-r--r-- | src/i830.h | 16 | ||||
-rw-r--r-- | src/i830_accel.c | 9 | ||||
-rw-r--r-- | src/i830_batchbuffer.c | 14 | ||||
-rw-r--r-- | src/i830_driver.c | 23 | ||||
-rw-r--r-- | src/i830_render.c | 4 | ||||
-rw-r--r-- | src/i830_uxa.c | 6 | ||||
-rw-r--r-- | src/i915_video.c | 2 | ||||
-rw-r--r-- | src/i965_render.c | 2 | ||||
-rw-r--r-- | src/i965_video.c | 2 |
9 files changed, 56 insertions, 22 deletions
@@ -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 90e5e161..e1aae6ca 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 f662dfcd..62466b78 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 8b5e946f..ede4344c 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 a7fac173..b141ba4d 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 f4743d09..8c26d09a 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 34ad8f97..e54bd9b4 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 f0aaa3dc..ce9b2357 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 0fc10a70..89d5eef8 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) |