A simple helper to check whether the last batch buffer submitted to the hardware is still busy. Extract it now to reduce churn later.
Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk> --- src/mesa/drivers/dri/i965/brw_batch.h | 5 +++++ src/mesa/drivers/dri/i965/brw_cs.cpp | 5 ++--- src/mesa/drivers/dri/i965/brw_fs.cpp | 5 ++--- src/mesa/drivers/dri/i965/brw_vec4.cpp | 5 ++--- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_batch.h b/src/mesa/drivers/dri/i965/brw_batch.h index b9e67dd..ac64f2f 100644 --- a/src/mesa/drivers/dri/i965/brw_batch.h +++ b/src/mesa/drivers/dri/i965/brw_batch.h @@ -102,6 +102,11 @@ inline static uint32_t brw_bo_flink(brw_bo *bo) void brw_batch_clear_dirty(brw_batch *batch); void brw_bo_mark_dirty(brw_batch *batch, brw_bo *bo); +inline static bool brw_batch_busy(brw_batch *batch) +{ + return batch->last_bo && drm_intel_bo_busy(batch->last_bo); +} + #ifdef __cplusplus } #endif diff --git a/src/mesa/drivers/dri/i965/brw_cs.cpp b/src/mesa/drivers/dri/i965/brw_cs.cpp index b0c0272..bf1c073 100644 --- a/src/mesa/drivers/dri/i965/brw_cs.cpp +++ b/src/mesa/drivers/dri/i965/brw_cs.cpp @@ -67,8 +67,7 @@ brw_cs_emit(struct brw_context *brw, double start_time = 0; if (unlikely(brw->perf_debug)) { - start_busy = (brw->batch.last_bo && - drm_intel_bo_busy(brw->batch.last_bo)); + start_busy = brw_batch_busy(&brw->batch); start_time = get_time(); } @@ -151,7 +150,7 @@ brw_cs_emit(struct brw_context *brw, } shader->compiled_once = true; - if (start_busy && !drm_intel_bo_busy(brw->batch.last_bo)) { + if (start_busy && !brw_batch_busy(&brw->batch)) { perf_debug("CS compile took %.03f ms and stalled the GPU\n", (get_time() - start_time) * 1000); } diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index ce1edc3..ddd5452 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -5150,8 +5150,7 @@ brw_wm_fs_emit(struct brw_context *brw, double start_time = 0; if (unlikely(brw->perf_debug)) { - start_busy = (brw->batch.last_bo && - drm_intel_bo_busy(brw->batch.last_bo)); + start_busy = brw_batch_busy(&brw->batch); start_time = get_time(); } @@ -5237,7 +5236,7 @@ brw_wm_fs_emit(struct brw_context *brw, brw_wm_debug_recompile(brw, prog, key); shader->compiled_once = true; - if (start_busy && !drm_intel_bo_busy(brw->batch.last_bo)) { + if (start_busy && !brw_batch_busy(&brw->batch)) { perf_debug("FS compile took %.03f ms and stalled the GPU\n", (get_time() - start_time) * 1000); } diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp index f18915a..33eeedb 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp @@ -1903,8 +1903,7 @@ brw_vs_emit(struct brw_context *brw, const unsigned *assembly = NULL; if (unlikely(brw->perf_debug)) { - start_busy = (brw->batch.last_bo && - drm_intel_bo_busy(brw->batch.last_bo)); + start_busy = brw_batch_busy(&brw->batch); start_time = get_time(); } @@ -2000,7 +1999,7 @@ brw_vs_emit(struct brw_context *brw, if (shader->compiled_once) { brw_vs_debug_recompile(brw, prog, key); } - if (start_busy && !drm_intel_bo_busy(brw->batch.last_bo)) { + if (start_busy && !brw_batch_busy(&brw->batch)) { perf_debug("VS compile took %.03f ms and stalled the GPU\n", (get_time() - start_time) * 1000); } -- 2.5.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev