freedreno/a6xx: drop a few more per-draw registers
authorRob Clark <robdclark@chromium.org>
Thu, 16 Jan 2020 20:42:45 +0000 (12:42 -0800)
committerRob Clark <robdclark@chromium.org>
Fri, 17 Jan 2020 23:43:51 +0000 (15:43 -0800)
Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3435>

src/gallium/drivers/freedreno/a6xx/fd6_draw.c
src/gallium/drivers/freedreno/freedreno_context.h

index 320cca64cec507c92f842c1b9a54e9a859c5e152..013efb3fa6534fe2e0d9465e6c93f7fbd82dab0c 100644 (file)
@@ -273,17 +273,29 @@ fd6_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info,
                }
        }
 
-       fixup_draw_state(ctx, &emit);
+       uint32_t index_start = info->index_size ? info->index_bias : info->start;
+       if (ctx->last.dirty || (ctx->last.index_start != index_start)) {
+               OUT_PKT4(ring, REG_A6XX_VFD_INDEX_OFFSET, 1);
+               OUT_RING(ring, index_start); /* VFD_INDEX_OFFSET */
+               ctx->last.index_start = index_start;
+       }
 
-       fd6_emit_state(ring, &emit);
+       if (ctx->last.dirty || (ctx->last.instance_start != info->start_instance)) {
+               OUT_PKT4(ring, REG_A6XX_VFD_INSTANCE_START_OFFSET, 1);
+               OUT_RING(ring, info->start_instance); /* VFD_INSTANCE_START_OFFSET */
+               ctx->last.instance_start = info->start_instance;
+       }
 
-       OUT_PKT4(ring, REG_A6XX_VFD_INDEX_OFFSET, 2);
-       OUT_RING(ring, info->index_size ? info->index_bias : info->start); /* VFD_INDEX_OFFSET */
-       OUT_RING(ring, info->start_instance);   /* VFD_INSTANCE_START_OFFSET */
+       uint32_t restart_index = info->primitive_restart ? info->restart_index : 0xffffffff;
+       if (ctx->last.dirty || (ctx->last.restart_index != restart_index)) {
+               OUT_PKT4(ring, REG_A6XX_PC_RESTART_INDEX, 1);
+               OUT_RING(ring, restart_index); /* PC_RESTART_INDEX */
+               ctx->last.restart_index = restart_index;
+       }
+
+       fixup_draw_state(ctx, &emit);
 
-       OUT_PKT4(ring, REG_A6XX_PC_RESTART_INDEX, 1);
-       OUT_RING(ring, info->primitive_restart ? /* PC_RESTART_INDEX */
-                       info->restart_index : 0xffffffff);
+       fd6_emit_state(ring, &emit);
 
        /* for debug after a lock up, write a unique counter value
         * to scratch7 for each draw, to make it easier to match up
index 846a442d315238426e2b7b6b7c5ebd675607a934..e9200e81256471a6e514755f5caf3599c1c5ae28 100644 (file)
@@ -373,6 +373,9 @@ struct fd_context {
        struct {
                bool dirty;               /* last draw state unknown */
                bool primitive_restart;
+               uint32_t index_start;
+               uint32_t instance_start;
+               uint32_t restart_index;
        } last;
 };