1
0
forked from rpms/mesa
mesa/mesa-7.1.2-etnaviv-fixes.patch
2017-06-14 15:24:57 +01:00

123 lines
5.4 KiB
Diff

From patchwork Thu Jun 8 16:25:34 2017
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: [Mesa-dev,1/2] etnaviv: fix varying interpolation
From: Lucas Stach <l.stach@pengutronix.de>
X-Patchwork-Id: 160584
Message-Id: <20170608162535.2198-1-l.stach@pengutronix.de>
To: mesa-dev@lists.freedesktop.org
Cc: graphics@pengutronix.de, etnaviv@lists.freedesktop.org,
patchwork-lst@pengutronix.de
Date: Thu, 8 Jun 2017 18:25:34 +0200
It seems that newer cores don't use the PA_ATTRIBUTES to decide if the
varying should bypass the flat shading, but derive this from the component
use. This fixes flat shading on GC880+.
VARYING_COMPONENT_USE_POINTCOORD is a bit of a misnomer now, as it isn't
only used for pointcoords, but missing a better name I left it as-is.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
src/gallium/drivers/etnaviv/etnaviv_compiler.c | 24 ++++++++++--------------
1 file changed, 10 insertions(+), 14 deletions(-)
diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler.c b/src/gallium/drivers/etnaviv/etnaviv_compiler.c
index eafb511bb813..2605924613c7 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_compiler.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_compiler.c
@@ -2552,6 +2552,7 @@ etna_link_shader(struct etna_shader_link_info *info,
const struct etna_shader_inout *fsio = &fs->infile.reg[idx];
const struct etna_shader_inout *vsio = etna_shader_vs_lookup(vs, fsio);
struct etna_varying *varying;
+ bool interpolate = fsio->semantic.Name != TGSI_SEMANTIC_COLOR;
assert(fsio->reg > 0 && fsio->reg <= ARRAY_SIZE(info->varyings));
@@ -2561,28 +2562,23 @@ etna_link_shader(struct etna_shader_link_info *info,
varying = &info->varyings[fsio->reg - 1];
varying->num_components = fsio->num_components;
- if (fsio->semantic.Name == TGSI_SEMANTIC_COLOR) /* colors affected by flat shading */
+ if (!interpolate) /* colors affected by flat shading */
varying->pa_attributes = 0x200;
else /* texture coord or other bypasses flat shading */
varying->pa_attributes = 0x2f1;
- if (fsio->semantic.Name == TGSI_SEMANTIC_PCOORD) {
- varying->use[0] = VARYING_COMPONENT_USE_POINTCOORD_X;
- varying->use[1] = VARYING_COMPONENT_USE_POINTCOORD_Y;
- varying->use[2] = VARYING_COMPONENT_USE_USED;
- varying->use[3] = VARYING_COMPONENT_USE_USED;
- varying->reg = 0; /* replaced by point coord -- doesn't matter */
+ varying->use[0] = interpolate ? VARYING_COMPONENT_USE_POINTCOORD_X : VARYING_COMPONENT_USE_USED;
+ varying->use[1] = interpolate ? VARYING_COMPONENT_USE_POINTCOORD_Y : VARYING_COMPONENT_USE_USED;
+ varying->use[2] = VARYING_COMPONENT_USE_USED;
+ varying->use[3] = VARYING_COMPONENT_USE_USED;
+ varying->reg = vsio->reg; /* replaced by point coord -- doesn't matter */
+
+
+ if (fsio->semantic.Name == TGSI_SEMANTIC_PCOORD)
continue;
- }
if (vsio == NULL)
return true; /* not found -- link error */
-
- varying->use[0] = VARYING_COMPONENT_USE_USED;
- varying->use[1] = VARYING_COMPONENT_USE_USED;
- varying->use[2] = VARYING_COMPONENT_USE_USED;
- varying->use[3] = VARYING_COMPONENT_USE_USED;
- varying->reg = vsio->reg;
}
assert(info->num_varyings == fs->infile.num_reg);
From patchwork Thu Jun 8 16:25:35 2017
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: [Mesa-dev,2/2] etnaviv: remove flat shading workaround
From: Lucas Stach <l.stach@pengutronix.de>
X-Patchwork-Id: 160585
Message-Id: <20170608162535.2198-2-l.stach@pengutronix.de>
To: mesa-dev@lists.freedesktop.org
Cc: graphics@pengutronix.de, etnaviv@lists.freedesktop.org,
patchwork-lst@pengutronix.de
Date: Thu, 8 Jun 2017 18:25:35 +0200
It turned out not to be a hardware bug, but the shader compiler
emitting wrong varying component use information. With that fixed
we can turn flat shading back on.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
---
src/gallium/drivers/etnaviv/etnaviv_rasterizer.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/src/gallium/drivers/etnaviv/etnaviv_rasterizer.c b/src/gallium/drivers/etnaviv/etnaviv_rasterizer.c
index 4990fd180257..56f2735e8a18 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_rasterizer.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_rasterizer.c
@@ -38,10 +38,6 @@ etna_rasterizer_state_create(struct pipe_context *pctx,
struct etna_rasterizer_state *cs;
struct etna_context *ctx = etna_context(pctx);
- /* Disregard flatshading on GC880+, as a HW bug there seem to disable all
- * varying interpolation if it's enabled */
- bool flatshade = ctx->screen->model < 880 ? so->flatshade : false;
-
if (so->fill_front != so->fill_back)
DBG("Different front and back fill mode not supported");
@@ -51,7 +47,7 @@ etna_rasterizer_state_create(struct pipe_context *pctx,
cs->base = *so;
- cs->PA_CONFIG = (flatshade ? VIVS_PA_CONFIG_SHADE_MODEL_FLAT : VIVS_PA_CONFIG_SHADE_MODEL_SMOOTH) |
+ cs->PA_CONFIG = (so->flatshade ? VIVS_PA_CONFIG_SHADE_MODEL_FLAT : VIVS_PA_CONFIG_SHADE_MODEL_SMOOTH) |
translate_cull_face(so->cull_face, so->front_ccw) |
translate_polygon_mode(so->fill_front) |
COND(so->point_quad_rasterization, VIVS_PA_CONFIG_POINT_SPRITE_ENABLE) |