panfrost: Specify supported draw modes per-context

Midgard has native support for QUADS and POLYGONS; Bifrost seemingly
does not. Thus, Midgard generally skips prim_convert whereas Bifrost
needs the pass; this patch allows the setting of allowed primitives to
occur on a per-context basis (for runtime hardware selection).

v2: Use (POLYGONS + 1) instead of LINES_ADJACENCY.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Robert Foss <robert.foss@collabora.com>
This commit is contained in:
Alyssa Rosenzweig
2019-02-08 02:28:12 +00:00
parent 90c6880df7
commit 85e2bb58ca
2 changed files with 11 additions and 12 deletions
+8 -12
View File
@@ -1589,14 +1589,10 @@ panfrost_draw_vbo(
int mode = info->mode;
#if 0
/* Fallback for non-ES draw modes */
/* Primconvert not needed on Midgard anymore due to native
* QUADS/POLYGONS. Bifrost/desktop-GL may need it though so not
* removing */
/* Fallback for unsupported modes */
if (info->mode >= PIPE_PRIM_QUADS) {
if (info->mode == PIPE_PRIM_QUADS && info->count == 4 && ctx->rasterizer && !ctx->rasterizer->base.flatshade) {
if (!(ctx->draw_modes & mode)) {
if (mode == PIPE_PRIM_QUADS && info->count == 4 && ctx->rasterizer && !ctx->rasterizer->base.flatshade) {
mode = PIPE_PRIM_TRIANGLE_FAN;
} else {
if (info->count < 4) {
@@ -1609,7 +1605,6 @@ panfrost_draw_vbo(
return;
}
}
#endif
ctx->payload_tiler.prefix.draw_mode = g2m_draw_mode(mode);
@@ -1623,7 +1618,7 @@ panfrost_draw_vbo(
* rendering artefacts. It's not clear what these values mean yet. */
ctx->payload_tiler.prefix.unknown_draw &= ~(0x3000 | 0x18000);
ctx->payload_tiler.prefix.unknown_draw |= (info->mode == PIPE_PRIM_POINTS || ctx->vertex_count > 65535) ? 0x3000 : 0x18000;
ctx->payload_tiler.prefix.unknown_draw |= (mode == PIPE_PRIM_POINTS || ctx->vertex_count > 65535) ? 0x3000 : 0x18000;
if (info->index_size) {
/* Calculate the min/max index used so we can figure out how
@@ -2665,9 +2660,10 @@ panfrost_create_context(struct pipe_screen *screen, void *priv, unsigned flags)
gallium->const_uploader = gallium->stream_uploader;
assert(gallium->stream_uploader);
ctx->primconvert = util_primconvert_create(gallium,
(1 << PIPE_PRIM_QUADS) - 1);
assert(ctx->primconvert);
/* Midgard supports ES modes, plus QUADS/QUAD_STRIPS/POLYGON */
ctx->draw_modes = (1 << (PIPE_PRIM_POLYGON + 1)) - 1;
ctx->primconvert = util_primconvert_create(gallium, ctx->draw_modes);
ctx->blitter = util_blitter_create(gallium);
assert(ctx->blitter);
@@ -106,6 +106,9 @@ struct panfrost_context {
/* Gallium context */
struct pipe_context base;
/* Bit mask for supported PIPE_DRAW for this hardware */
unsigned draw_modes;
struct pipe_framebuffer_state pipe_framebuffer;
/* The number of concurrent FBOs allowed depends on the number of pools