freedreno/a6xx: avoid unnecessary clearing VS DP state
authorRob Clark <robdclark@chromium.org>
Thu, 16 Apr 2020 17:18:29 +0000 (10:18 -0700)
committerMarge Bot <eric+marge@anholt.net>
Thu, 30 Apr 2020 20:03:17 +0000 (20:03 +0000)
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@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4813>

src/gallium/drivers/freedreno/a6xx/fd6_context.h
src/gallium/drivers/freedreno/a6xx/fd6_emit.c

index 92afa3bf6aa9d6ac0fe2d3a50e650803143b444e..876017e25704eb80f2f2d082093b19481b2d32fe 100644 (file)
@@ -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;
 
index 9295175404dfdabc69653c702cfbbef480cc42c9..32ac478dfda9bf09465453c0e07752e23b84d679 100644 (file)
@@ -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;