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.c | 5 ++--- src/mesa/drivers/dri/i965/brw_gs.c | 4 ++-- src/mesa/drivers/dri/i965/brw_tcs.c | 4 ++-- src/mesa/drivers/dri/i965/brw_tes.c | 4 ++-- src/mesa/drivers/dri/i965/brw_vs.c | 5 ++--- src/mesa/drivers/dri/i965/brw_wm.c | 5 ++--- 7 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_batch.h b/src/mesa/drivers/dri/i965/brw_batch.h index 0f7c97aedf..09065cf972 100644 --- a/src/mesa/drivers/dri/i965/brw_batch.h +++ b/src/mesa/drivers/dri/i965/brw_batch.h @@ -103,6 +103,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.c b/src/mesa/drivers/dri/i965/brw_cs.c index d19c93065a..d4b5779746 100644 --- a/src/mesa/drivers/dri/i965/brw_cs.c +++ b/src/mesa/drivers/dri/i965/brw_cs.c @@ -104,8 +104,7 @@ brw_codegen_cs_prog(struct brw_context *brw, true); 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(); } @@ -132,7 +131,7 @@ brw_codegen_cs_prog(struct brw_context *brw, } cp->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_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c index b7fb9f9c1e..74496bad89 100644 --- a/src/mesa/drivers/dri/i965/brw_gs.c +++ b/src/mesa/drivers/dri/i965/brw_gs.c @@ -137,7 +137,7 @@ brw_codegen_gs_prog(struct brw_context *brw, st_index = brw_get_shader_time_index(brw, &gp->program, ST_GS, true); 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(); } @@ -160,7 +160,7 @@ brw_codegen_gs_prog(struct brw_context *brw, if (gp->compiled_once) { brw_gs_debug_recompile(brw, &gp->program, key); } - if (start_busy && !drm_intel_bo_busy(brw->batch.last_bo)) { + if (start_busy && !brw_batch_busy(&brw->batch)) { perf_debug("GS compile took %.03f ms and stalled the GPU\n", (get_time() - start_time) * 1000); } diff --git a/src/mesa/drivers/dri/i965/brw_tcs.c b/src/mesa/drivers/dri/i965/brw_tcs.c index 9e9d9eb00d..9e1b9fc70e 100644 --- a/src/mesa/drivers/dri/i965/brw_tcs.c +++ b/src/mesa/drivers/dri/i965/brw_tcs.c @@ -250,7 +250,7 @@ brw_codegen_tcs_prog(struct brw_context *brw, struct brw_program *tcp, st_index = brw_get_shader_time_index(brw, &tep->program, ST_TCS, true); 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(); } @@ -280,7 +280,7 @@ brw_codegen_tcs_prog(struct brw_context *brw, struct brw_program *tcp, tcp->compiled_once = true; } - if (start_busy && !drm_intel_bo_busy(brw->batch.last_bo)) { + if (start_busy && !brw_batch_busy(&brw->batch)) { perf_debug("TCS compile took %.03f ms and stalled the GPU\n", (get_time() - start_time) * 1000); } diff --git a/src/mesa/drivers/dri/i965/brw_tes.c b/src/mesa/drivers/dri/i965/brw_tes.c index 57dcda7140..eaedc06105 100644 --- a/src/mesa/drivers/dri/i965/brw_tes.c +++ b/src/mesa/drivers/dri/i965/brw_tes.c @@ -121,7 +121,7 @@ brw_codegen_tes_prog(struct brw_context *brw, st_index = brw_get_shader_time_index(brw, &tep->program, ST_TES, true); 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(); } @@ -150,7 +150,7 @@ brw_codegen_tes_prog(struct brw_context *brw, if (tep->compiled_once) { brw_tes_debug_recompile(brw, &tep->program, key); } - if (start_busy && !drm_intel_bo_busy(brw->batch.last_bo)) { + if (start_busy && !brw_batch_busy(&brw->batch)) { perf_debug("TES compile took %.03f ms and stalled the GPU\n", (get_time() - start_time) * 1000); } diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c index afb1f20330..3dbac599cd 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.c +++ b/src/mesa/drivers/dri/i965/brw_vs.c @@ -212,8 +212,7 @@ brw_codegen_vs_prog(struct brw_context *brw, } 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(); } @@ -252,7 +251,7 @@ brw_codegen_vs_prog(struct brw_context *brw, if (vp->compiled_once) { brw_vs_debug_recompile(brw, &vp->program, 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); } diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 56b60b87ff..2917bc65f2 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -184,8 +184,7 @@ brw_codegen_wm_prog(struct brw_context *brw, } 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(); } @@ -221,7 +220,7 @@ brw_codegen_wm_prog(struct brw_context *brw, brw_wm_debug_recompile(brw, &fp->program, key); fp->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); } -- 2.11.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev