From 80b90a0f2b83291da69f7eef38395e61e919ab97 Mon Sep 17 00:00:00 2001 From: Icecream95 Date: Tue, 22 Dec 2020 23:16:34 +1300 Subject: [PATCH] panfrost: Implement panfrost_set_global_binding This is enough OpenCL support to pass the Piglit test cl-custom-run-simple-kernel with PAN_MESA_DEBUG=deqp. Reviewed-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/panfrost/pan_compute.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/panfrost/pan_compute.c b/src/gallium/drivers/panfrost/pan_compute.c index fd437377786..9569c695fe1 100644 --- a/src/gallium/drivers/panfrost/pan_compute.c +++ b/src/gallium/drivers/panfrost/pan_compute.c @@ -176,7 +176,21 @@ panfrost_set_global_binding(struct pipe_context *pctx, struct pipe_resource **resources, uint32_t **handles) { - /* TODO */ + if (!resources) + return; + + struct panfrost_context *ctx = pan_context(pctx); + struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx); + + for (unsigned i = first; i < first + count; ++i) { + struct panfrost_resource *rsrc = pan_resource(resources[i]); + + panfrost_batch_add_bo(batch, rsrc->bo, + PAN_BO_ACCESS_SHARED | PAN_BO_ACCESS_RW); + + /* The handle points to uint32_t, but space is allocated for 64 bits */ + memcpy(handles[i], &rsrc->bo->ptr.gpu, sizeof(mali_ptr)); + } } static void