summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Gmeiner <christian.gmeiner@gmail.com>2020-04-28 16:24:38 +0200
committerEric Engestrom <eric@engestrom.ch>2020-05-05 18:56:46 +0200
commit33a086f44ec995c6219522cbc505629b9e8bd8fe (patch)
tree3ceb0333115746ab43496f6ceb10413c83df79e1
parent00001525f5fa85d5f212d91321d1c353a4fb3aaf (diff)
etnaviv: do not use int filter when anisotropic filtering is used
The blob does not use this combination. This change moves the decision if int filter gets used to state emit time. Fixes: 7aaa0e59086 ("etnaviv: add anisotropic filter support") Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com> Reviewed-by: Lucas Stach <l.stach@pengutronix.de> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4872> (cherry picked from commit 89a41dae7702731bee298288f3acbcbd56096b30)
-rw-r--r--.pick_status.json2
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_format.c17
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_format.h4
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_texture_desc.c7
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_texture_state.c9
5 files changed, 26 insertions, 13 deletions
diff --git a/.pick_status.json b/.pick_status.json
index 00201b701f6..7ca87624dda 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -436,7 +436,7 @@
"description": "etnaviv: do not use int filter when anisotropic filtering is used",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": "7aaa0e59086fa2bf9c5fa7db2774cb2aa32f95b9"
},
diff --git a/src/gallium/drivers/etnaviv/etnaviv_format.c b/src/gallium/drivers/etnaviv/etnaviv_format.c
index c6611971d2d..97df90e065d 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_format.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_format.c
@@ -268,9 +268,11 @@ translate_texture_format(enum pipe_format fmt)
}
bool
-texture_use_int_filter(const struct pipe_sampler_view *so, bool tex_desc)
+texture_use_int_filter(const struct pipe_sampler_view *sv,
+ const struct pipe_sampler_state *ss,
+ bool tex_desc)
{
- switch (so->target) {
+ switch (sv->target) {
case PIPE_TEXTURE_1D_ARRAY:
case PIPE_TEXTURE_2D_ARRAY:
if (tex_desc)
@@ -282,16 +284,19 @@ texture_use_int_filter(const struct pipe_sampler_view *so, bool tex_desc)
}
/* only unorm formats can use int filter */
- if (!util_format_is_unorm(so->format))
+ if (!util_format_is_unorm(sv->format))
return false;
- if (util_format_is_srgb(so->format))
+ if (util_format_is_srgb(sv->format))
return false;
- if (util_format_description(so->format)->layout == UTIL_FORMAT_LAYOUT_ASTC)
+ if (util_format_description(sv->format)->layout == UTIL_FORMAT_LAYOUT_ASTC)
return false;
- switch (so->format) {
+ if (ss->max_anisotropy > 1)
+ return false;
+
+ switch (sv->format) {
/* apparently D16 can't use int filter but D24 can */
case PIPE_FORMAT_Z16_UNORM:
case PIPE_FORMAT_R10G10B10A2_UNORM:
diff --git a/src/gallium/drivers/etnaviv/etnaviv_format.h b/src/gallium/drivers/etnaviv/etnaviv_format.h
index ecc9f8e439c..0aaa4ad6e5e 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_format.h
+++ b/src/gallium/drivers/etnaviv/etnaviv_format.h
@@ -39,7 +39,9 @@ uint32_t
translate_texture_format(enum pipe_format fmt);
bool
-texture_use_int_filter(const struct pipe_sampler_view *so, bool tex_desc);
+texture_use_int_filter(const struct pipe_sampler_view *sv,
+ const struct pipe_sampler_state *ss,
+ bool tex_desc);
bool
texture_format_needs_swiz(enum pipe_format fmt);
diff --git a/src/gallium/drivers/etnaviv/etnaviv_texture_desc.c b/src/gallium/drivers/etnaviv/etnaviv_texture_desc.c
index bca73d65c14..25efcd3dee3 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_texture_desc.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_texture_desc.c
@@ -161,9 +161,6 @@ etna_create_sampler_view_desc(struct pipe_context *pctx, struct pipe_resource *p
if (util_format_is_srgb(so->format))
sv->SAMP_CTRL1 |= VIVS_NTE_DESCRIPTOR_SAMP_CTRL1_SRGB;
- if (texture_use_int_filter(so, true))
- sv->SAMP_CTRL0 |= VIVS_NTE_DESCRIPTOR_SAMP_CTRL0_INT_FILTER;
-
/* Create texture descriptor */
sv->bo = etna_bo_new(ctx->screen->dev, 0x100, DRM_ETNA_GEM_CACHE_WC);
if (!sv->bo)
@@ -293,6 +290,10 @@ etna_emit_texture_desc(struct etna_context *ctx)
if ((1 << x) & active_samplers) {
struct etna_sampler_state_desc *ss = etna_sampler_state_desc(ctx->sampler[x]);
struct etna_sampler_view_desc *sv = etna_sampler_view_desc(ctx->sampler_view[x]);
+
+ if (texture_use_int_filter(&sv->base, &ss->base, true))
+ sv->SAMP_CTRL0 |= VIVS_NTE_DESCRIPTOR_SAMP_CTRL0_INT_FILTER;
+
etna_set_state(stream, VIVS_NTE_DESCRIPTOR_TX_CTRL(x),
COND(sv->ts.enable, VIVS_NTE_DESCRIPTOR_TX_CTRL_TS_ENABLE) |
VIVS_NTE_DESCRIPTOR_TX_CTRL_TS_MODE(sv->ts.mode) |
diff --git a/src/gallium/drivers/etnaviv/etnaviv_texture_state.c b/src/gallium/drivers/etnaviv/etnaviv_texture_state.c
index f64d4b39783..c66bfcee9a8 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_texture_state.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_texture_state.c
@@ -232,8 +232,7 @@ etna_create_sampler_view_state(struct pipe_context *pctx, struct pipe_resource *
VIVS_TE_SAMPLER_LOG_SIZE_WIDTH(etna_log2_fixp55(res->base.width0)) |
VIVS_TE_SAMPLER_LOG_SIZE_HEIGHT(etna_log2_fixp55(base_height)) |
COND(util_format_is_srgb(so->format) && !astc, VIVS_TE_SAMPLER_LOG_SIZE_SRGB) |
- COND(astc, VIVS_TE_SAMPLER_LOG_SIZE_ASTC) |
- COND(texture_use_int_filter(so, false), VIVS_TE_SAMPLER_LOG_SIZE_INT_FILTER);
+ COND(astc, VIVS_TE_SAMPLER_LOG_SIZE_ASTC);
sv->TE_SAMPLER_3D_CONFIG =
VIVS_TE_SAMPLER_3D_CONFIG_DEPTH(base_depth) |
VIVS_TE_SAMPLER_3D_CONFIG_LOG_DEPTH(etna_log2_fixp55(base_depth));
@@ -335,6 +334,7 @@ etna_emit_texture_state(struct etna_context *ctx)
}
}
if (unlikely(dirty & (ETNA_DIRTY_SAMPLER_VIEWS))) {
+ struct etna_sampler_state *ss;
struct etna_sampler_view *sv;
for (int x = 0; x < VIVS_TE_SAMPLER__LEN; ++x) {
@@ -345,7 +345,12 @@ etna_emit_texture_state(struct etna_context *ctx)
}
for (int x = 0; x < VIVS_TE_SAMPLER__LEN; ++x) {
if ((1 << x) & active_samplers) {
+ ss = etna_sampler_state(ctx->sampler[x]);
sv = etna_sampler_view(ctx->sampler_view[x]);
+
+ if (texture_use_int_filter(&sv->base, &ss->base, false))
+ sv->TE_SAMPLER_LOG_SIZE |= VIVS_TE_SAMPLER_LOG_SIZE_INT_FILTER;
+
/*02080*/ EMIT_STATE(TE_SAMPLER_LOG_SIZE(x), sv->TE_SAMPLER_LOG_SIZE);
}
}