freedreno: Use the resource size rather than BO size for VFD_FETCH[].SIZE.
authorEmma Anholt <emma@anholt.net>
Mon, 28 Feb 2022 22:39:59 +0000 (14:39 -0800)
committerMarge Bot <emma+marge@anholt.net>
Wed, 2 Mar 2022 17:31:49 +0000 (17:31 +0000)
We should be using the API size to clamp, rather than what we allocated
the BO into.

Fixes: #13
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15198>

src/gallium/drivers/freedreno/a4xx/fd4_emit.c
src/gallium/drivers/freedreno/a5xx/fd5_emit.c
src/gallium/drivers/freedreno/a6xx/fd6_emit.c

index c0963c8..7fc96ea 100644 (file)
@@ -428,7 +428,7 @@ fd4_emit_vertex_bufs(struct fd_ringbuffer *ring, struct fd4_emit *emit)
          bool isint = util_format_is_pure_integer(pfmt);
          uint32_t fs = util_format_get_blocksize(pfmt);
          uint32_t off = vb->buffer_offset + elem->src_offset;
-         uint32_t size = fd_bo_size(rsc->bo) - off;
+         uint32_t size = vb->buffer.resource->width0 - off;
          debug_assert(fmt != VFMT4_NONE);
 
 #ifdef DEBUG
index b5120b5..3cb1f97 100644 (file)
@@ -487,7 +487,7 @@ fd5_emit_vertex_bufs(struct fd_ringbuffer *ring, struct fd5_emit *emit)
          enum a5xx_vtx_fmt fmt = fd5_pipe2vtx(pfmt);
          bool isint = util_format_is_pure_integer(pfmt);
          uint32_t off = vb->buffer_offset + elem->src_offset;
-         uint32_t size = fd_bo_size(rsc->bo) - off;
+         uint32_t size = vb->buffer.resource->width0 - off;
          debug_assert(fmt != VFMT5_NONE);
 
 #ifdef DEBUG
index 21ef07d..fc2d8bb 100644 (file)
@@ -567,7 +567,7 @@ build_vbo_state(struct fd6_emit *emit) assert_dt
          OUT_RING(ring, 0);
       } else {
          uint32_t off = vb->buffer_offset;
-         uint32_t size = fd_bo_size(rsc->bo) - off;
+         uint32_t size = vb->buffer.resource->width0 - off;
 
          OUT_RELOC(ring, rsc->bo, off, 0, 0);
          OUT_RING(ring, size);       /* VFD_FETCH[j].SIZE */