diff options
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/freedreno/a6xx/fd6_draw.cc | 33 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/freedreno_screen.c | 1 |
2 files changed, 33 insertions, 1 deletions
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_draw.cc b/src/gallium/drivers/freedreno/a6xx/fd6_draw.cc index 015cde6f3f2..aefd347d184 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_draw.cc +++ b/src/gallium/drivers/freedreno/a6xx/fd6_draw.cc @@ -83,7 +83,26 @@ draw_emit_indirect(struct fd_context *ctx, { struct fd_resource *ind = fd_resource(indirect->buffer); - if (info->index_size) { + if (indirect->indirect_draw_count && info->index_size) { + //On some firmwares CP_DRAW_INDIRECT_MULTI waits for WFIs before + //reading the draw parameters but after reading the count, so commands + //that use indirect draw count need a WFM anyway. + OUT_PKT7(ring, CP_WAIT_FOR_ME, 0); + OUT_PKT7(ring, CP_DRAW_INDIRECT_MULTI, 11); + OUT_RING(ring, pack_CP_DRAW_INDX_OFFSET_0(*draw0).value); + OUT_RING(ring, + (A6XX_CP_DRAW_INDIRECT_MULTI_1_OPCODE(INDIRECT_OP_INDIRECT_COUNT_INDEXED) + | A6XX_CP_DRAW_INDIRECT_MULTI_1_DST_OFF(driver_param))); + struct fd_resource *count_buf = fd_resource(indirect->indirect_draw_count); + struct pipe_resource *idx = info->index.resource; + unsigned max_indices = (idx->width0 - index_offset) / info->index_size; + OUT_RING(ring, indirect->draw_count); + OUT_RELOC(ring, fd_resource(idx)->bo, index_offset, 0, 0); + OUT_RING(ring, max_indices); + OUT_RELOC(ring, ind->bo, indirect->offset, 0, 0); + OUT_RELOC(ring, count_buf->bo, indirect->indirect_draw_count_offset, 0, 0); + OUT_RING(ring, indirect->stride); + } else if (info->index_size) { OUT_PKT7(ring, CP_DRAW_INDIRECT_MULTI, 9); OUT_RING(ring, pack_CP_DRAW_INDX_OFFSET_0(*draw0).value); OUT_RING(ring, @@ -98,6 +117,18 @@ draw_emit_indirect(struct fd_context *ctx, OUT_RING(ring, max_indices); OUT_RELOC(ring, ind->bo, indirect->offset, 0, 0); OUT_RING(ring, indirect->stride); + } else if(indirect->indirect_draw_count) { + OUT_PKT7(ring, CP_WAIT_FOR_ME, 0); + OUT_PKT7(ring, CP_DRAW_INDIRECT_MULTI, 8); + OUT_RING(ring, pack_CP_DRAW_INDX_OFFSET_0(*draw0).value); + OUT_RING(ring, + (A6XX_CP_DRAW_INDIRECT_MULTI_1_OPCODE(INDIRECT_OP_INDIRECT_COUNT) + | A6XX_CP_DRAW_INDIRECT_MULTI_1_DST_OFF(driver_param))); + struct fd_resource *count_buf = fd_resource(indirect->indirect_draw_count); + OUT_RING(ring, indirect->draw_count); + OUT_RELOC(ring, ind->bo, indirect->offset, 0, 0); + OUT_RELOC(ring, count_buf->bo, indirect->indirect_draw_count_offset, 0, 0); + OUT_RING(ring, indirect->stride); } else { OUT_PKT7(ring, CP_DRAW_INDIRECT_MULTI, 6); OUT_RING(ring, pack_CP_DRAW_INDX_OFFSET_0(*draw0).value); diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c index f5081a3c10a..bf2b37b5391 100644 --- a/src/gallium/drivers/freedreno/freedreno_screen.c +++ b/src/gallium/drivers/freedreno/freedreno_screen.c @@ -215,6 +215,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_CLEAR_TEXTURE: case PIPE_CAP_MULTI_DRAW_INDIRECT: case PIPE_CAP_DRAW_PARAMETERS: + case PIPE_CAP_MULTI_DRAW_INDIRECT_PARAMS: return is_a6xx(screen); case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY: |