From 21dd7574a8f8e102c69b37cd245560af6ce2af53 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 5 Nov 2019 11:19:20 -0500 Subject: [PATCH] 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 --- 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 -- 2.30.2