panfrost: Respect buffer offset for OpenCL

This is so dumb. Panfrost port of d98b82a103 ("iris/cs: take buffer offsets
into account for CL")

Fixes buffer.sub_buffers_read_write

Fixes: 80b90a0f2b ("panfrost: Implement panfrost_set_global_binding")
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Suggested-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18560>
(cherry picked from commit b4dd1b8916)
This commit is contained in:
Alyssa Rosenzweig
2022-07-05 15:11:59 -04:00
committed by Dylan Baker
parent 4de1373cc4
commit 2c56768a2f
2 changed files with 12 additions and 3 deletions

View File

@@ -679,7 +679,7 @@
"description": "panfrost: Respect buffer offset for OpenCL",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "80b90a0f2b83291da69f7eef38395e61e919ab97"
},

View File

@@ -123,8 +123,17 @@ panfrost_set_global_binding(struct pipe_context *pctx,
util_range_add(&rsrc->base, &rsrc->valid_buffer_range,
0, rsrc->base.width0);
/* The handle points to uint32_t, but space is allocated for 64 bits */
memcpy(handles[i], &rsrc->image.data.bo->ptr.gpu, sizeof(mali_ptr));
/* The handle points to uint32_t, but space is allocated for 64
* bits. We need to respect the offset passed in. This interface
* is so bad.
*/
mali_ptr addr = 0;
static_assert(sizeof(addr) == 8, "size out of sync");
memcpy(&addr, handles[i], sizeof(addr));
addr += rsrc->image.data.bo->ptr.gpu;
memcpy(handles[i], &addr, sizeof(addr));
}
}