From 7a6a5f3fe1532414ece15f227e89b0c39ba5a626 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 12 Jan 2021 11:32:45 -0500 Subject: [PATCH] panfrost: Handle explicit primitive restart Don't fall back. Passes piglit ./bin/primitive-restart on Bifrost. Signed-off-by: Alyssa Rosenzweig Reviewed-by: Boris Brezillon Part-of: --- 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 2df59a8..03988f0 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); -- 2.7.4