Mesa (staging/20.2): etnaviv: simplify linear stride implementation
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Sep 30 16:31:18 UTC 2020
Module: Mesa
Branch: staging/20.2
Commit: fbbd66dcad05cec8548b9d77edc2e2eab09bc675
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fbbd66dcad05cec8548b9d77edc2e2eab09bc675
Author: Christian Gmeiner <christian.gmeiner at gmail.com>
Date: Sat Jan 4 07:13:47 2020 +0100
etnaviv: simplify linear stride implementation
As documented in the galcore kernel driver "only LOD0 is valid
for this register". This makes sense, as NTE's LINEAR_STRIDE is
only capable to store one linear stride value per sampler.
This fixes linear textures in sampler slot != 0.
Fixes: 34458c1cf6c ("etnaviv: add linear sampling support")
CC: <mesa-stable at lists.freedesktop.org>
Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
Reviewed-by: Michael Tretter <m.tretter at pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3285>
(cherry picked from commit a7e3cc7a0eafc1076a2f7775f754e74584fc3537)
---
.pick_status.json | 2 +-
src/gallium/drivers/etnaviv/etnaviv_texture_state.c | 20 +++++++++-----------
2 files changed, 10 insertions(+), 12 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index c3ae3fdc138..52518971660 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1453,7 +1453,7 @@
"description": "etnaviv: simplify linear stride implementation",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": "34458c1cf6caf1718e111096143e74aabc7985a7"
},
diff --git a/src/gallium/drivers/etnaviv/etnaviv_texture_state.c b/src/gallium/drivers/etnaviv/etnaviv_texture_state.c
index 4c11b114ac0..8684275ebd9 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_texture_state.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_texture_state.c
@@ -68,7 +68,7 @@ struct etna_sampler_view {
uint32_t TE_SAMPLER_SIZE;
uint32_t TE_SAMPLER_LOG_SIZE;
uint32_t TE_SAMPLER_ASTC0;
- uint32_t TE_SAMPLER_LINEAR_STRIDE[VIVS_TE_SAMPLER_LINEAR_STRIDE__LEN];
+ uint32_t TE_SAMPLER_LINEAR_STRIDE; /* only LOD0 */
struct etna_reloc TE_SAMPLER_LOD_ADDR[VIVS_TE_SAMPLER_LOD_ADDR__LEN];
unsigned min_lod, max_lod; /* 5.5 fixp */
@@ -211,12 +211,11 @@ etna_create_sampler_view_state(struct pipe_context *pctx, struct pipe_resource *
if (res->layout == ETNA_LAYOUT_LINEAR && !util_format_is_compressed(so->format)) {
sv->TE_SAMPLER_CONFIG0 |= VIVS_TE_SAMPLER_CONFIG0_ADDRESSING_MODE(TEXTURE_ADDRESSING_MODE_LINEAR);
- for (int lod = 0; lod <= res->base.last_level; ++lod)
- sv->TE_SAMPLER_LINEAR_STRIDE[lod] = res->levels[lod].stride;
-
+ assert(res->base.last_level == 0);
+ sv->TE_SAMPLER_LINEAR_STRIDE = res->levels[0].stride;
} else {
sv->TE_SAMPLER_CONFIG0 |= VIVS_TE_SAMPLER_CONFIG0_ADDRESSING_MODE(TEXTURE_ADDRESSING_MODE_TILED);
- memset(&sv->TE_SAMPLER_LINEAR_STRIDE, 0, sizeof(sv->TE_SAMPLER_LINEAR_STRIDE));
+ sv->TE_SAMPLER_LINEAR_STRIDE = 0;
}
sv->TE_SAMPLER_CONFIG1 |= COND(ext, VIVS_TE_SAMPLER_CONFIG1_FORMAT_EXT(format)) |
@@ -406,12 +405,11 @@ etna_emit_texture_state(struct etna_context *ctx)
}
}
if (unlikely(dirty & (ETNA_DIRTY_SAMPLER_VIEWS))) {
- for (int y = 0; y < VIVS_TE_SAMPLER_LINEAR_STRIDE__LEN; ++y) {
- for (int x = 0; x < VIVS_TE_SAMPLER__LEN; ++x) {
- if ((1 << x) & active_samplers) {
- struct etna_sampler_view *sv = etna_sampler_view(ctx->sampler_view[x]);
- /*02C00*/ EMIT_STATE(TE_SAMPLER_LINEAR_STRIDE(x, y), sv->TE_SAMPLER_LINEAR_STRIDE[y]);
- }
+ /* only LOD0 is valid for this register */
+ for (int x = 0; x < VIVS_TE_SAMPLER__LEN; ++x) {
+ if ((1 << x) & active_samplers) {
+ struct etna_sampler_view *sv = etna_sampler_view(ctx->sampler_view[x]);
+ /*02C00*/ EMIT_STATE(TE_SAMPLER_LINEAR_STRIDE(0, x), sv->TE_SAMPLER_LINEAR_STRIDE);
}
}
}
More information about the mesa-commit
mailing list