Module: Mesa
Branch: main
Commit: 1bb68d95322d6dfa9ee53584d129ada4bf6bf1e2
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1bb68d95322d6dfa9ee53584d129ada4bf6bf1e2

Author: Alyssa Rosenzweig <[email protected]>
Date:   Fri Oct 21 16:01:56 2022 -0400

panfrost: Zero polygon list for fragment-only

Even with hierarchical tiling. Otherwise if there's garbage leftover (due to BO
caching), a fragment-only batch can raise DATA_INVALID_FAULT. Fixes many tests
in KHR-GLES31.core.compute_shader.* on Mali-T860, including

   KHR-GLES31.core.compute_shader.build-separable

Signed-off-by: Alyssa Rosenzweig <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19238>

---

 src/gallium/drivers/panfrost/pan_cmdstream.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c 
b/src/gallium/drivers/panfrost/pan_cmdstream.c
index f34520ddec3..5a7347f408d 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -4851,10 +4851,11 @@ batch_get_polygon_list(struct panfrost_batch *batch)
                                                              has_draws);
                 size = util_next_power_of_two(size);
 
-                /* Create the BO as invisible if we can. In the 
non-hierarchical tiler case,
-                 * we need to write the polygon list manually because there's 
not WRITE_VALUE
-                 * job in the chain (maybe we should add one...). */
-                bool init_polygon_list = !has_draws && 
dev->model->quirks.no_hierarchical_tiling;
+                /* Create the BO as invisible if we can. If there are no draws,
+                 * we need to write the polygon list manually because there's
+                 * no WRITE_VALUE job in the chain
+                 */
+                bool init_polygon_list = !has_draws;
                 batch->tiler_ctx.midgard.polygon_list =
                         panfrost_batch_create_bo(batch, size,
                                                  init_polygon_list ? 0 : 
PAN_BO_INVISIBLE,
@@ -4863,7 +4864,7 @@ batch_get_polygon_list(struct panfrost_batch *batch)
                 panfrost_batch_add_bo(batch, 
batch->tiler_ctx.midgard.polygon_list,
                                 PIPE_SHADER_FRAGMENT);
 
-                if (init_polygon_list) {
+                if (init_polygon_list && 
dev->model->quirks.no_hierarchical_tiling) {
                         assert(batch->tiler_ctx.midgard.polygon_list->ptr.cpu);
                         uint32_t *polygon_list_body =
                                 batch->tiler_ctx.midgard.polygon_list->ptr.cpu 
+
@@ -4871,6 +4872,11 @@ batch_get_polygon_list(struct panfrost_batch *batch)
 
                         /* Magic for Mali T720 */
                         polygon_list_body[0] = 0xa0000000;
+                } else if (init_polygon_list) {
+                        assert(batch->tiler_ctx.midgard.polygon_list->ptr.cpu);
+                        uint32_t *header =
+                                batch->tiler_ctx.midgard.polygon_list->ptr.cpu;
+                        memset(header, 0, size);
                 }
 
                 batch->tiler_ctx.midgard.disable = !has_draws;

Reply via email to