freedreno/a6xx: fix MAX_INDICES
authorRob Clark <robdclark@chromium.org>
Tue, 11 Jun 2019 12:16:21 +0000 (05:16 -0700)
committerRob Clark <robdclark@chromium.org>
Thu, 13 Jun 2019 15:56:27 +0000 (08:56 -0700)
Signed-off-by: Rob Clark <robdclark@chromium.org>
src/gallium/drivers/freedreno/a6xx/fd6_draw.c

index edf4925a3394e2992d45d6591c0c31af61f9f6fa..ff9e4bb036c9e4d9cb6f673cbba6793937d349b5 100644 (file)
@@ -50,13 +50,12 @@ draw_emit_indirect(struct fd_batch *batch, struct fd_ringbuffer *ring,
 
        if (info->index_size) {
                struct pipe_resource *idx = info->index.resource;
-               unsigned max_indicies = idx->width0 / info->index_size;
+               unsigned max_indicies = (idx->width0 - index_offset) / info->index_size;
 
                OUT_PKT7(ring, CP_DRAW_INDX_INDIRECT, 6);
                OUT_RINGP(ring, draw0, &batch->draw_patches);
                OUT_RELOC(ring, fd_resource(idx)->bo,
                                  index_offset, 0, 0);
-               // XXX: Check A5xx vs A6xx
                OUT_RING(ring, A5XX_CP_DRAW_INDX_INDIRECT_3_MAX_INDICES(max_indicies));
                OUT_RELOC(ring, ind->bo, info->indirect->offset, 0, 0);
        } else {