diff options
author | Alyssa Rosenzweig <[email protected]> | 2019-02-08 02:28:12 +0000 |
---|---|---|
committer | Alyssa Rosenzweig <[email protected]> | 2019-02-11 03:23:00 +0000 |
commit | 85e2bb58cafde2238797b98eec5f105b3a0a3c73 (patch) | |
tree | 52c9fee3255004d9f45cceb4d0db159bfce32b10 /src | |
parent | 90c6880df77c49dfadd97d8a4c4cde86fdd82670 (diff) |
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 <[email protected]>
Reviewed-by: Robert Foss <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/panfrost/pan_context.c | 20 | ||||
-rw-r--r-- | src/gallium/drivers/panfrost/pan_context.h | 3 |
2 files changed, 11 insertions, 12 deletions
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index f08461b03a6..565e6541b6c 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -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); diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h index bda8155aac6..89f821318e1 100644 --- a/src/gallium/drivers/panfrost/pan_context.h +++ b/src/gallium/drivers/panfrost/pan_context.h @@ -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 |