}
}
- 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