panfrost: Rip out primconvert code
authorAlyssa Rosenzweig <alyssa@collabora.com>
Mon, 23 Aug 2021 16:10:53 +0000 (12:10 -0400)
committerMarge Bot <eric+marge@anholt.net>
Tue, 24 Aug 2021 00:53:38 +0000 (00:53 +0000)
This is handled in common Gallium code if we set the appropriate CAP.

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

src/gallium/drivers/panfrost/pan_cmdstream.c
src/gallium/drivers/panfrost/pan_context.c
src/gallium/drivers/panfrost/pan_context.h
src/gallium/drivers/panfrost/pan_screen.c

index 4b5bcf93447fd549a0a277b224079ca762731a9d..affc681fe36de2bd1f8d7e539f83afbdd78cd9c0 100644 (file)
@@ -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;
index 68320f35a23c15688ef5a68f433500a2b1fdd8c7..b7ff1ae04a0e9b5c2d1ee4e4cc282a89eaea4f7d 100644 (file)
@@ -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);
index 8ed66966b9c23ed48d15d8418d2fea56c1635975..7e49c2c4faf2ed02e41c6a5c5ffa04097ef7b17f 100644 (file)
@@ -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;
index 340f74041b6891d5868918d075c02787098a0e00..eaa2b7e5b33e8cab31c1eb7304f8fae7456be73b 100644 (file)
@@ -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);
         }