panfrost: Don't clobber indirect dispatch fields
authorAlyssa Rosenzweig <alyssa@collabora.com>
Wed, 9 Jun 2021 17:09:44 +0000 (13:09 -0400)
committerMarge Bot <eric+marge@anholt.net>
Thu, 10 Jun 2021 18:06:11 +0000 (18:06 +0000)
These should be kept as zero so they can be packed correctly. Fixes a
number of KHR-GLES31 fails.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11123>

src/gallium/drivers/panfrost/pan_compute.c
src/gallium/drivers/panfrost/pan_context.c
src/panfrost/lib/pan_blitter.c
src/panfrost/lib/pan_encoder.h
src/panfrost/lib/pan_indirect_dispatch.c
src/panfrost/lib/pan_indirect_draw.c
src/panfrost/lib/pan_invocation.c

index 841548f..2c9cdf7 100644 (file)
@@ -160,7 +160,7 @@ panfrost_launch_grid(struct pipe_context *pipe,
                                           num_wg[0], num_wg[1], num_wg[2],
                                           info->block[0], info->block[1],
                                           info->block[2],
-                                          false);
+                                          false, info->indirect != NULL);
 
         pan_section_pack(t.cpu, COMPUTE_JOB, PARAMETERS, cfg) {
                 cfg.job_task_split =
index 831ba1d..33993cb 100644 (file)
@@ -528,7 +528,7 @@ panfrost_direct_draw(struct panfrost_batch *batch,
         if (info->instance_count > 1) {
                 panfrost_pack_work_groups_compute(&invocation,
                                                   1, vertex_count, info->instance_count,
-                                                  1, 1, 1, true);
+                                                  1, 1, 1, true, false);
         } else {
                 pan_pack(&invocation, INVOCATION, cfg) {
                         cfg.invocations = MALI_POSITIVE(vertex_count);
index 3f5e3cd..61ffb50 100644 (file)
@@ -1145,7 +1145,7 @@ pan_preload_emit_midgard_tiler_job(struct pan_pool *desc_pool,
                                       MIDGARD_TILER_JOB,
                                       INVOCATION);
         panfrost_pack_work_groups_compute(invoc, 1, 4,
-                                          1, 1, 1, 1, true);
+                                          1, 1, 1, 1, true, false);
 
         panfrost_add_job(desc_pool, scoreboard, MALI_JOB_TYPE_TILER,
                          false, false, 0, 0, &job, true);
@@ -1180,7 +1180,7 @@ pan_blit_emit_midgard_tiler_job(struct pan_pool *desc_pool,
                                       MIDGARD_TILER_JOB,
                                       INVOCATION);
         panfrost_pack_work_groups_compute(invoc, 1, 4,
-                                          1, 1, 1, 1, true);
+                                          1, 1, 1, 1, true, false);
 
         panfrost_add_job(desc_pool, scoreboard, MALI_JOB_TYPE_TILER,
                          false, false, 0, 0, &job, false);
@@ -1216,7 +1216,7 @@ pan_blit_emit_bifrost_tiler_job(struct pan_pool *desc_pool,
                                       BIFROST_TILER_JOB,
                                       INVOCATION);
         panfrost_pack_work_groups_compute(invoc, 1, 4,
-                                          1, 1, 1, 1, true);
+                                          1, 1, 1, 1, true, false);
 
         pan_section_pack(job.cpu, BIFROST_TILER_JOB, PADDING, cfg);
         pan_section_pack(job.cpu, BIFROST_TILER_JOB, TILER, cfg) {
index 680808e..ecc09ca 100644 (file)
@@ -66,7 +66,8 @@ panfrost_pack_work_groups_compute(
         unsigned size_x,
         unsigned size_y,
         unsigned size_z,
-        bool quirk_graphics);
+        bool quirk_graphics,
+        bool indirect_dispatch);
 
 /* Tiler structure size computation */
 
index 3bcc42a..82c8ed1 100644 (file)
@@ -133,7 +133,7 @@ pan_indirect_dispatch_emit(struct pan_pool *pool,
 
         panfrost_pack_work_groups_compute(invocation,
                                           1, 1, 1, 1, 1, 1,
-                                          false);
+                                          false, false);
 
         pan_section_pack(job.cpu, COMPUTE_JOB, PARAMETERS, cfg) {
                 cfg.job_task_split = 2;
index 8008764..05251a9 100644 (file)
@@ -1245,7 +1245,7 @@ panfrost_emit_index_min_max_search(struct pan_pool *pool,
                 pan_section_ptr(job.cpu, COMPUTE_JOB, INVOCATION);
         panfrost_pack_work_groups_compute(invocation,
                                           1, 1, 1, MIN_MAX_JOBS, 1, 1,
-                                          false);
+                                          false, false);
 
         pan_section_pack(job.cpu, COMPUTE_JOB, PARAMETERS, cfg) {
                 cfg.job_task_split = 7;
@@ -1337,7 +1337,7 @@ panfrost_emit_indirect_draw(struct pan_pool *pool,
                 pan_section_ptr(job.cpu, COMPUTE_JOB, INVOCATION);
         panfrost_pack_work_groups_compute(invocation,
                                           1, 1, 1, 1, 1, 1,
-                                          false);
+                                          false, false);
 
         pan_section_pack(job.cpu, COMPUTE_JOB, PARAMETERS, cfg) {
                 cfg.job_task_split = 2;
index 6c0843e..02f7169 100644 (file)
@@ -48,7 +48,8 @@ panfrost_pack_work_groups_compute(
         unsigned size_x,
         unsigned size_y,
         unsigned size_z,
-        bool quirk_graphics)
+        bool quirk_graphics,
+        bool indirect_dispatch)
 {
         uint32_t packed = 0;
 
@@ -88,8 +89,12 @@ panfrost_pack_work_groups_compute(
                 cfg.size_y_shift = shifts[1];
                 cfg.size_z_shift = shifts[2];
                 cfg.workgroups_x_shift = shifts[3];
-                cfg.workgroups_y_shift = shifts[4];
-                cfg.workgroups_z_shift = shifts[5];
+
+                if (!indirect_dispatch) {
+                        /* Leave zero for the dispatch shader */
+                        cfg.workgroups_y_shift = shifts[4];
+                        cfg.workgroups_z_shift = shifts[5];
+                }
 
                 /* Quirk: for non-instanced graphics, the blob sets
                  * workgroups_z_shift = 32. This doesn't appear to matter to