panfrost: Stop using panfrost_emit_for_draw() for compute jobs
authorBoris Brezillon <boris.brezillon@collabora.com>
Thu, 5 Mar 2020 10:18:37 +0000 (11:18 +0100)
committerBoris Brezillon <boris.brezillon@collabora.com>
Tue, 10 Mar 2020 11:47:34 +0000 (12:47 +0100)
We actually need a small subset of what's done in
panfrost_emit_for_draw() when emitting compute jobs, so let's copy
what we need directly in panfrost_launch_grid() instead of re-using
this function whose initial purpose was to generate vertex/tiler jobs
for draw operations.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>

src/gallium/drivers/panfrost/pan_compute.c
src/gallium/drivers/panfrost/pan_context.c
src/gallium/drivers/panfrost/pan_context.h

index d344d862243a2f8f1dc4296f53399a186cb9b73f..d05016e9359fa2e7444100620f546c7090f21612 100644 (file)
@@ -121,7 +121,9 @@ panfrost_launch_grid(struct pipe_context *pipe,
         if (info->input)
                 pipe->set_constant_buffer(pipe, PIPE_SHADER_COMPUTE, 0, &ubuf);
 
-        panfrost_emit_for_draw(ctx, false);
+        panfrost_patch_shader_state(ctx, PIPE_SHADER_COMPUTE);
+        panfrost_emit_shader_meta(batch, PIPE_SHADER_COMPUTE, payload);
+        panfrost_emit_const_buf(batch, PIPE_SHADER_COMPUTE, payload);
         panfrost_emit_shared_memory(batch, info, payload);
 
         /* Invoke according to the grid info */
index 41eda89d8fb56e441496662b2c9745ca42381cca..0f2d8b5a72870ca994f7f2f16a8a649dd867d137 100644 (file)
@@ -505,7 +505,7 @@ panfrost_ubo_count(struct panfrost_context *ctx, enum pipe_shader_type stage)
 
 /* Fixes up a shader state with current state */
 
-static void
+void
 panfrost_patch_shader_state(struct panfrost_context *ctx,
                             enum pipe_shader_type stage)
 {
index 2bb81203f150f82b99fb4003b6844de4714f3aa5..70a2dc3cbbc5c66b1a47aea6b480f8fcc49d5a16 100644 (file)
@@ -293,6 +293,10 @@ panfrost_invalidate_frame(struct panfrost_context *ctx);
 bool
 panfrost_writes_point_size(struct panfrost_context *ctx);
 
+void
+panfrost_patch_shader_state(struct panfrost_context *ctx,
+                            enum pipe_shader_type stage);
+
 void
 panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data);