[Mesa-dev] [PATCH 33/70] i965: Refactor the always_flush check
Chris Wilson
chris at chris-wilson.co.uk
Fri Aug 7 13:13:37 PDT 2015
Provide a common routine for doing conditional batch flushes.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
src/mesa/drivers/dri/i965/brw_batch.h | 6 ++++++
src/mesa/drivers/dri/i965/brw_blorp.cpp | 3 +--
src/mesa/drivers/dri/i965/brw_compute.c | 3 +--
src/mesa/drivers/dri/i965/brw_draw.c | 3 +--
4 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_batch.h b/src/mesa/drivers/dri/i965/brw_batch.h
index 782b853..3b6acf2 100644
--- a/src/mesa/drivers/dri/i965/brw_batch.h
+++ b/src/mesa/drivers/dri/i965/brw_batch.h
@@ -190,6 +190,12 @@ brw_batch_reloc(brw_batch *batch,
struct perf_debug;
int brw_batch_flush(struct brw_batch *batch, struct perf_debug *info);
+inline static void brw_batch_maybe_flush(struct brw_batch *batch)
+{
+ if (unlikely(batch->always_flush))
+ brw_batch_flush(batch, NULL);
+}
+
#ifdef __cplusplus
}
#endif
diff --git a/src/mesa/drivers/dri/i965/brw_blorp.cpp b/src/mesa/drivers/dri/i965/brw_blorp.cpp
index 2e06317..f04b966 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp.cpp
@@ -269,8 +269,7 @@ retry:
}
}
- if (unlikely(brw->batch.always_flush))
- brw_batch_flush(&brw->batch, NULL);
+ brw_batch_maybe_flush(&brw->batch);
/* We've smashed all state compared to what the normal 3D pipeline
* rendering tracks for GL.
diff --git a/src/mesa/drivers/dri/i965/brw_compute.c b/src/mesa/drivers/dri/i965/brw_compute.c
index c2c39e0..9077872 100644
--- a/src/mesa/drivers/dri/i965/brw_compute.c
+++ b/src/mesa/drivers/dri/i965/brw_compute.c
@@ -144,8 +144,7 @@ brw_dispatch_compute(struct gl_context *ctx, const GLuint *num_groups)
*/
brw_compute_state_finished(brw);
- if (brw->batch.always_flush)
- brw_batch_flush(&brw->batch, NULL);
+ brw_batch_maybe_flush(&brw->batch);
brw_state_cache_check_size(brw);
diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c
index b5c343a..52e6993 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -537,8 +537,7 @@ retry:
brw_render_state_finished(brw);
}
- if (brw->batch.always_flush)
- brw_batch_flush(&brw->batch, NULL);
+ brw_batch_maybe_flush(&brw->batch);
brw_state_cache_check_size(brw);
brw_postdraw_set_buffers_need_resolve(brw);
--
2.5.0
More information about the mesa-dev
mailing list