Mesa (master): panfrost: Pass kernel inputs as uniforms

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Nov 19 06:46:07 UTC 2019


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

Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date:   Tue Nov  5 11:19:20 2019 -0500

panfrost: Pass kernel inputs as uniforms

We can take the OpenCL kernel inputs and interpret them as uniforms by
simply reusing the Gallium callback.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>

---

 src/gallium/drivers/panfrost/pan_compute.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/gallium/drivers/panfrost/pan_compute.c b/src/gallium/drivers/panfrost/pan_compute.c
index 23e3791d1d5..905e6e234e0 100644
--- a/src/gallium/drivers/panfrost/pan_compute.c
+++ b/src/gallium/drivers/panfrost/pan_compute.c
@@ -110,6 +110,19 @@ panfrost_launch_grid(struct pipe_context *pipe,
         /* TODO: Stub */
         struct midgard_payload_vertex_tiler *payload = &ctx->payloads[PIPE_SHADER_COMPUTE];
 
+        /* We implement OpenCL inputs as uniforms (or a UBO -- same thing), so
+         * reuse the graphics path for this by lowering to Gallium */
+
+        struct pipe_constant_buffer ubuf = {
+                .buffer = NULL,
+                .buffer_offset = 0,
+                .buffer_size = ctx->shader[PIPE_SHADER_COMPUTE]->cbase.req_input_mem,
+                .user_buffer = info->input
+        };
+
+        if (info->input)
+                pipe->set_constant_buffer(pipe, PIPE_SHADER_COMPUTE, 0, &ubuf);
+
         panfrost_emit_for_draw(ctx, false);
 
         /* Compute jobs have a "compute FBD". It's not a real framebuffer




More information about the mesa-commit mailing list