[Mesa-dev] [PATCH 1/5] i965: Only flush the batchbuffer if we need to zero the SO offsets
Chris Wilson
chris at chris-wilson.co.uk
Wed Jul 8 06:48:38 PDT 2015
If we don't have pipelined register access (e.g. Haswell before kernel
v4.2), then we can only implement EXT_transform_feedback by reseting the
SO offsets *between* batches. However, if we do have pipelined access to
the SO registers on gen7, we can simply emit an inline reset of the SO
registers without a full batch flush.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Kenneth Graunke <kenneth at whitecape.org>
---
src/mesa/drivers/dri/i965/brw_context.h | 1 +
src/mesa/drivers/dri/i965/gen7_sol_state.c | 12 +++++++++++-
src/mesa/drivers/dri/i965/intel_extensions.c | 3 ++-
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 65f34c3..7f73b10 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -1125,6 +1125,7 @@ struct brw_context
bool must_use_separate_stencil;
bool has_llc;
bool has_swizzling;
+ bool has_pipelined_so;
bool has_surface_tile_offset;
bool has_compr4;
bool has_negative_rhw_bug;
diff --git a/src/mesa/drivers/dri/i965/gen7_sol_state.c b/src/mesa/drivers/dri/i965/gen7_sol_state.c
index 41573a8..140752c 100644
--- a/src/mesa/drivers/dri/i965/gen7_sol_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_sol_state.c
@@ -446,7 +446,7 @@ gen7_begin_transform_feedback(struct gl_context *ctx, GLenum mode,
/* Reset the SO buffer offsets to 0. */
if (brw->gen >= 8) {
brw_obj->zero_offsets = true;
- } else {
+ } else if (!brw->has_pipelined_so) {
intel_batchbuffer_flush(brw);
brw->batch.needs_sol_reset = true;
}
@@ -462,6 +462,16 @@ gen7_begin_transform_feedback(struct gl_context *ctx, GLenum mode,
brw_obj->prims_generated[i] = 0;
}
+ if (brw->gen == 7 && brw->has_pipelined_so) {
+ for (int i = 0; i < 4; i++) {
+ BEGIN_BATCH(3);
+ OUT_BATCH(MI_LOAD_REGISTER_IMM | (3 - 2));
+ OUT_BATCH(GEN7_SO_WRITE_OFFSET(i));
+ OUT_BATCH(0);
+ ADVANCE_BATCH();
+ }
+ }
+
/* Store the starting value of the SO_NUM_PRIMS_WRITTEN counters. */
gen7_save_primitives_written_counters(brw, brw_obj);
diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c b/src/mesa/drivers/dri/i965/intel_extensions.c
index 6b3bd12..489a00f 100644
--- a/src/mesa/drivers/dri/i965/intel_extensions.c
+++ b/src/mesa/drivers/dri/i965/intel_extensions.c
@@ -327,7 +327,8 @@ intelInitExtensions(struct gl_context *ctx)
ctx->Extensions.ARB_texture_compression_bptc = true;
ctx->Extensions.ARB_texture_view = true;
- if (can_do_pipelined_register_writes(brw)) {
+ brw->has_pipelined_so = can_do_pipelined_register_writes(brw);
+ if (brw->has_pipelined_so) {
ctx->Extensions.ARB_draw_indirect = true;
ctx->Extensions.ARB_transform_feedback2 = true;
ctx->Extensions.ARB_transform_feedback3 = true;
--
2.1.4
More information about the mesa-dev
mailing list