Mesa (main): panfrost: Rip out primconvert code

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Aug 24 01:06:27 UTC 2021


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

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Mon Aug 23 12:10:53 2021 -0400

panfrost: Rip out primconvert code

This is handled in common Gallium code if we set the appropriate CAP.

Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Suggested-by: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12509>

---

 src/gallium/drivers/panfrost/pan_cmdstream.c | 14 --------------
 src/gallium/drivers/panfrost/pan_context.c   | 15 ---------------
 src/gallium/drivers/panfrost/pan_context.h   |  4 ----
 src/gallium/drivers/panfrost/pan_screen.c    | 13 +++++++++++++
 4 files changed, 13 insertions(+), 33 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c
index 4b5bcf93447..affc681fe36 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -31,7 +31,6 @@
 #include "util/u_memory.h"
 #include "pipe/p_defines.h"
 #include "pipe/p_state.h"
-#include "indices/u_primconvert.h"
 #include "gallium/auxiliary/util/u_blend.h"
 
 #include "panfrost-quirks.h"
@@ -2751,18 +2750,6 @@ panfrost_direct_draw(struct panfrost_batch *batch,
 
         struct panfrost_context *ctx = batch->ctx;
 
-        /* Fallback for unsupported modes */
-        if (!(ctx->draw_modes & BITFIELD_BIT(info->mode))) {
-                if (draw->count < 4) {
-                        /* Degenerate case? */
-                        return;
-                }
-
-                util_primconvert_save_rasterizer_state(ctx->primconvert, &ctx->rasterizer->base);
-                util_primconvert_draw_vbo(ctx->primconvert, info, drawid_offset, NULL, draw, 1);
-                return;
-        }
-
         /* Take into account a negative bias */
         ctx->indirect_draw = false;
         ctx->vertex_count = draw->count + (info->index_size ? abs(draw->index_bias) : 0);
@@ -2864,7 +2851,6 @@ panfrost_indirect_draw(struct panfrost_batch *batch,
         /* TODO: Increment transform feedback offsets */
         assert(ctx->streamout.num_targets == 0);
 
-        assert(ctx->draw_modes & (1 << info->mode));
         ctx->active_prim = info->mode;
         ctx->drawid = drawid_offset;
         ctx->indirect_draw = true;
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index 68320f35a23..b7ff1ae04a0 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -44,7 +44,6 @@
 #include "util/format/u_format.h"
 #include "util/u_prim.h"
 #include "util/u_prim_restart.h"
-#include "indices/u_primconvert.h"
 #include "tgsi/tgsi_parse.h"
 #include "tgsi/tgsi_from_mesa.h"
 #include "util/u_math.h"
@@ -802,8 +801,6 @@ panfrost_destroy(struct pipe_context *pipe)
         panfrost_pool_cleanup(&panfrost->descs);
         panfrost_pool_cleanup(&panfrost->shaders);
 
-        util_primconvert_destroy(panfrost->primconvert);
-
         ralloc_free(pipe);
 }
 
@@ -1116,18 +1113,6 @@ panfrost_create_context(struct pipe_screen *screen, void *priv, unsigned flags)
         panfrost_pool_init(&ctx->shaders, ctx, dev,
                         PAN_BO_EXECUTE, 4096, "Shaders", true, false);
 
-        /* All of our GPUs support ES mode. Midgard supports additionally
-         * QUADS/QUAD_STRIPS/POLYGON. Bifrost supports just QUADS. */
-
-        ctx->draw_modes = (1 << (PIPE_PRIM_QUADS + 1)) - 1;
-
-        if (!pan_is_bifrost(dev)) {
-                ctx->draw_modes |= (1 << PIPE_PRIM_QUAD_STRIP);
-                ctx->draw_modes |= (1 << PIPE_PRIM_POLYGON);
-        }
-
-        ctx->primconvert = util_primconvert_create(gallium, ctx->draw_modes);
-
         ctx->blitter = util_blitter_create(gallium);
 
         assert(ctx->blitter);
diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h
index 8ed66966b9c..7e49c2c4faf 100644
--- a/src/gallium/drivers/panfrost/pan_context.h
+++ b/src/gallium/drivers/panfrost/pan_context.h
@@ -148,9 +148,6 @@ struct panfrost_context {
         /* Within a launch_grid call.. */
         const struct pipe_grid_info *compute_grid;
 
-        /* Bit mask for supported PIPE_DRAW for this hardware */
-        unsigned draw_modes;
-
         struct pipe_framebuffer_state pipe_framebuffer;
         struct panfrost_streamout streamout;
 
@@ -198,7 +195,6 @@ struct panfrost_context {
         struct panfrost_sampler_view *sampler_views[PIPE_SHADER_TYPES][PIPE_MAX_SHADER_SAMPLER_VIEWS];
         unsigned sampler_view_count[PIPE_SHADER_TYPES];
 
-        struct primconvert_context *primconvert;
         struct blitter_context *blitter;
 
         struct panfrost_blend_state *blend;
diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c
index 340f74041b6..eaa2b7e5b33 100644
--- a/src/gallium/drivers/panfrost/pan_screen.c
+++ b/src/gallium/drivers/panfrost/pan_screen.c
@@ -309,6 +309,19 @@ panfrost_get_param(struct pipe_screen *screen, enum pipe_cap param)
         case PIPE_CAP_DRAW_PARAMETERS:
                 return pan_is_bifrost(dev);
 
+        case PIPE_CAP_SUPPORTED_PRIM_MODES:
+        case PIPE_CAP_SUPPORTED_PRIM_MODES_WITH_RESTART: {
+                /* Mali supports GLES and QUADS. Midgard supports more */
+                uint32_t modes = BITFIELD_MASK(PIPE_PRIM_QUADS + 1);
+
+                if (dev->arch <= 5) {
+                        modes |= BITFIELD_BIT(PIPE_PRIM_QUAD_STRIP);
+                        modes |= BITFIELD_BIT(PIPE_PRIM_POLYGON);
+                }
+
+                return modes;
+        }
+
         default:
                 return u_pipe_screen_get_param_defaults(screen, param);
         }



More information about the mesa-commit mailing list