From d2fd6469c37f01a5e1f05394098915fde03aa108 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Thu, 16 Jan 2020 12:42:45 -0800 Subject: [PATCH] freedreno/a6xx: drop a few more per-draw registers Signed-off-by: Rob Clark Reviewed-by: Kristian H. Kristensen Part-of: --- src/gallium/drivers/freedreno/a6xx/fd6_draw.c | 28 +++++++++++++------ .../drivers/freedreno/freedreno_context.h | 3 ++ 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_draw.c b/src/gallium/drivers/freedreno/a6xx/fd6_draw.c index 320cca64cec..013efb3fa65 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_draw.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_draw.c @@ -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 diff --git a/src/gallium/drivers/freedreno/freedreno_context.h b/src/gallium/drivers/freedreno/freedreno_context.h index 846a442d315..e9200e81256 100644 --- a/src/gallium/drivers/freedreno/freedreno_context.h +++ b/src/gallium/drivers/freedreno/freedreno_context.h @@ -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; }; -- 2.30.2