Mesa (master): freedreno/a6xx: avoid unnecessary clearing VS DP state

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 30 20:21:11 UTC 2020


Module: Mesa
Branch: master
Commit: 89dbdb806faaf1a4b3da0ce0ab597f9ced40d549
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=89dbdb806faaf1a4b3da0ce0ab597f9ced40d549

Author: Rob Clark <robdclark at chromium.org>
Date:   Thu Apr 16 10:18:29 2020 -0700

freedreno/a6xx: avoid unnecessary clearing VS DP state

If there is no (potentially unflushed) VS driver-param state, we don't
need to emit a DISABLE on each frame.  So avoid that to reduce CP
overhead.

Signed-off-by: Rob Clark <robdclark at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4813>

---

 src/gallium/drivers/freedreno/a6xx/fd6_context.h | 3 +++
 src/gallium/drivers/freedreno/a6xx/fd6_emit.c    | 5 ++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_context.h b/src/gallium/drivers/freedreno/a6xx/fd6_context.h
index 92afa3bf6aa..876017e2570 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_context.h
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_context.h
@@ -78,6 +78,9 @@ struct fd6_context {
 	 */
 	struct ir3_shader_key last_key;
 
+	/* Is there current VS driver-param state set? */
+	bool has_dp_state;
+
 	/* number of active samples-passed queries: */
 	int samples_passed_queries;
 
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c
index 9295175404d..32ac478dfda 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c
@@ -915,6 +915,7 @@ void
 fd6_emit_state(struct fd_ringbuffer *ring, struct fd6_emit *emit)
 {
 	struct fd_context *ctx = emit->ctx;
+	struct fd6_context *fd6_ctx = fd6_context(ctx);
 	struct pipe_framebuffer_state *pfb = &ctx->batch->framebuffer;
 	const struct fd6_program_state *prog = fd6_emit_get_prog(emit);
 	const struct ir3_shader_variant *vs = emit->vs;
@@ -1067,8 +1068,10 @@ fd6_emit_state(struct fd_ringbuffer *ring, struct fd6_emit *emit)
 				ctx->batch->submit, IR3_DP_VS_COUNT * 4, FD_RINGBUFFER_STREAMING);
 		ir3_emit_vs_driver_params(vs, dpconstobj, ctx, emit->info);
 		fd6_emit_take_group(emit, dpconstobj, FD6_GROUP_VS_DRIVER_PARAMS, ENABLE_ALL);
-	} else {
+		fd6_ctx->has_dp_state = true;
+	} else if (fd6_ctx->has_dp_state) {
 		fd6_emit_take_group(emit, NULL, FD6_GROUP_VS_DRIVER_PARAMS, ENABLE_ALL);
+		fd6_ctx->has_dp_state = false;
 	}
 
 	struct ir3_stream_output_info *info = &fd6_last_shader(prog)->shader->stream_output;



More information about the mesa-commit mailing list