aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno/a4xx/fd4_draw.h
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2017-11-19 16:32:12 -0500
committerIlia Mirkin <[email protected]>2017-11-25 17:20:17 -0500
commit4f748d12e8828aab6e2824a3c80f01c7ac44226c (patch)
tree330a33ad1b52c896398c4923901a5a42712204fc /src/gallium/drivers/freedreno/a4xx/fd4_draw.h
parentc3c8d487252a3689cf7d4a01381c8b32ccb7f9fb (diff)
freedreno/a4xx: add indirect draw support
This is a copy of the a5xx logic. Fails a few tests, but basic functionality is there. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/a4xx/fd4_draw.h')
-rw-r--r--src/gallium/drivers/freedreno/a4xx/fd4_draw.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_draw.h b/src/gallium/drivers/freedreno/a4xx/fd4_draw.h
index 842a952719b..f7a7d92453b 100644
--- a/src/gallium/drivers/freedreno/a4xx/fd4_draw.h
+++ b/src/gallium/drivers/freedreno/a4xx/fd4_draw.h
@@ -112,6 +112,35 @@ fd4_draw_emit(struct fd_batch *batch, struct fd_ringbuffer *ring,
enum pc_di_src_sel src_sel;
uint32_t idx_size, idx_offset;
+ if (info->indirect) {
+ struct fd_resource *ind = fd_resource(info->indirect->buffer);
+
+ emit_marker(ring, 7);
+
+ if (info->index_size) {
+ struct pipe_resource *idx = info->index.resource;
+
+ OUT_PKT3(ring, CP_DRAW_INDX_INDIRECT, 4);
+ OUT_RINGP(ring, DRAW4(primtype, DI_SRC_SEL_DMA,
+ fd4_size2indextype(info->index_size), 0),
+ &batch->draw_patches);
+ OUT_RELOC(ring, fd_resource(idx)->bo, index_offset, 0, 0);
+ OUT_RING(ring, A4XX_CP_DRAW_INDX_INDIRECT_2_INDX_SIZE(
+ idx->width0 - index_offset));
+ OUT_RELOC(ring, ind->bo, info->indirect->offset, 0, 0);
+ } else {
+ OUT_PKT3(ring, CP_DRAW_INDIRECT, 2);
+ OUT_RINGP(ring, DRAW4(primtype, DI_SRC_SEL_AUTO_INDEX, 0, 0),
+ &batch->draw_patches);
+ OUT_RELOC(ring, ind->bo, info->indirect->offset, 0, 0);
+ }
+
+ emit_marker(ring, 7);
+ fd_reset_wfi(batch);
+
+ return;
+ }
+
if (info->index_size) {
assert(!info->has_user_indices);