panfrost: Flesh out launch_grid stub
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 31 Jul 2019 21:08:59 +0000 (14:08 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 1 Aug 2019 23:23:02 +0000 (16:23 -0700)
It's still incomplette, but we're able to hook into launch_grid to
create a stub COMPUTE job.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/gallium/drivers/panfrost/pan_compute.c

index 5ef26f3e35d6ad588001bffead2aa4a282fdd27b..61b3085cac04abb6b6ea5848413d49d69e3e4612 100644 (file)
@@ -51,15 +51,34 @@ panfrost_delete_compute_state(struct pipe_context *pipe, void *cso)
         free(cso);
 }
 
+/* Launch grid is the compute equivalent of draw_vbo, so in this routine, we
+ * construct the COMPUTE job and some of its payload.
+ */
+
 static void
 panfrost_launch_grid(struct pipe_context *pipe,
                 const struct pipe_grid_info *info)
 {
-        printf("Launch grid %dx%dx%d ... %dx%dx%d\n",
-                        info->block[0], info->block[1], info->block[2],
-                        info->grid[0], info->grid[1], info->grid[2]);
+        struct panfrost_context *ctx = pan_context(pipe);
 
-        /* Stub */
+        struct mali_job_descriptor_header job = {
+                .job_type = JOB_TYPE_COMPUTE,
+                .job_descriptor_size = 1,
+                .job_barrier = 1
+        };
+
+        /* TODO: Stub */
+        struct midgard_payload_vertex_tiler *payload = &ctx->payloads[PIPE_SHADER_COMPUTE];
+
+        struct panfrost_transfer transfer = panfrost_allocate_transient(ctx, sizeof(job) + sizeof(*payload));
+        memcpy(transfer.cpu, &job, sizeof(job));
+        memcpy(transfer.cpu + sizeof(job), payload, sizeof(*payload));
+
+        /* TODO: Do we want a special compute-only batch? */
+        struct panfrost_job *batch = panfrost_get_job_for_fbo(ctx);
+
+        /* Queue the job */
+        panfrost_scoreboard_queue_compute_job(batch, transfer);
 }
 
 void