Mesa (master): panfrost: Handle explicit primitive restart

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jan 13 16:13:06 UTC 2021


Module: Mesa
Branch: master
Commit: 7a6a5f3fe1532414ece15f227e89b0c39ba5a626
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7a6a5f3fe1532414ece15f227e89b0c39ba5a626

Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date:   Tue Jan 12 11:32:45 2021 -0500

panfrost: Handle explicit primitive restart

Don't fall back. Passes piglit ./bin/primitive-restart on Bifrost.

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

---

 src/gallium/drivers/panfrost/pan_context.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index 2df59a8230d..03988f05d3f 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -330,6 +330,14 @@ panfrost_emit_primitive_size(struct panfrost_context *ctx,
         }
 }
 
+static bool
+panfrost_is_implicit_prim_restart(const struct pipe_draw_info *info)
+{
+        unsigned implicit_index = (1 << (info->index_size * 8)) - 1;
+        bool implicit = info->restart_index == implicit_index;
+        return info->primitive_restart && implicit;
+}
+
 static void
 panfrost_draw_emit_tiler(struct panfrost_batch *batch,
                          const struct pipe_draw_info *info,
@@ -369,8 +377,13 @@ panfrost_draw_emit_tiler(struct panfrost_batch *batch,
                 else
                         cfg.first_provoking_vertex = rast->flatshade_first;
 
-                if (info->primitive_restart)
+                if (panfrost_is_implicit_prim_restart(info)) {
                         cfg.primitive_restart = MALI_PRIMITIVE_RESTART_IMPLICIT;
+                } else if (info->primitive_restart) {
+                        cfg.primitive_restart = MALI_PRIMITIVE_RESTART_EXPLICIT;
+                        cfg.primitive_restart_index = info->restart_index;
+                }
+
                 cfg.job_task_split = 6;
 
                 if (info->index_size) {
@@ -486,15 +499,6 @@ panfrost_draw_vbo(
 
         int mode = info->mode;
 
-        /* Fallback unsupported restart index */
-        unsigned primitive_index = (1 << (info->index_size * 8)) - 1;
-
-        if (info->primitive_restart && info->index_size
-            && info->restart_index != primitive_index) {
-                util_draw_vbo_without_prim_restart(pipe, info, indirect, &draws[0]);
-                return;
-        }
-
         /* Fallback for unsupported modes */
 
         assert(ctx->rasterizer != NULL);



More information about the mesa-commit mailing list