Mesa (master): panfrost: Implement panfrost_set_global_binding

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Mar 29 23:31:49 UTC 2021


Module: Mesa
Branch: master
Commit: 80b90a0f2b83291da69f7eef38395e61e919ab97
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=80b90a0f2b83291da69f7eef38395e61e919ab97

Author: Icecream95 <ixn at disroot.org>
Date:   Tue Dec 22 23:16:34 2020 +1300

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 <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9380>

---

 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



More information about the mesa-commit mailing list