panfrost: Ignore BO start addr when adjusting src_offset
authorBoris Brezillon <boris.brezillon@collabora.com>
Thu, 5 Mar 2020 18:26:03 +0000 (19:26 +0100)
committerBoris Brezillon <boris.brezillon@collabora.com>
Tue, 10 Mar 2020 11:47:34 +0000 (12:47 +0100)
BOs are guaranteed to be aligned on 4K which inherently guarantees the
64 byte alignment.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>

src/gallium/drivers/panfrost/pan_context.c

index 0a010b99fc4e59064530607cc4e387dec0b322f2..fda7b3fcb3d9f605ae8a97657c5e1e6bab77c9e7 100644 (file)
@@ -225,15 +225,15 @@ panfrost_stage_attributes(struct panfrost_context *ctx)
         for (unsigned i = 0; i < so->num_elements; ++i) {
                 unsigned vbi = so->pipe[i].vertex_buffer_index;
                 struct pipe_vertex_buffer *buf = &ctx->vertex_buffers[vbi];
-                struct panfrost_resource *rsrc = (struct panfrost_resource *) (buf->buffer.resource);
-                mali_ptr addr = rsrc->bo->gpu + buf->buffer_offset;
 
                 /* Adjust by the masked off bits of the offset. Make sure we
                  * read src_offset from so->hw (which is not GPU visible)
                  * rather than target (which is) due to caching effects */
 
                 unsigned src_offset = so->pipe[i].src_offset;
-                src_offset += (addr & 63);
+
+                /* BOs aligned to 4k so guaranteed aligned to 64 */
+                src_offset += (buf->buffer_offset & 63);
 
                 /* Also, somewhat obscurely per-instance data needs to be
                  * offset in response to a delayed start in an indexed draw */