[Mesa-dev] [PATCH 15/19] etnaviv: GC7000: Track dirty sampler views
Wladimir J. van der Laan
laanwj at gmail.com
Mon Oct 30 16:17:01 UTC 2017
Need this to efficiently emit texture descriptor invalidations.
Signed-off-by: Wladimir J. van der Laan <laanwj at gmail.com>
---
src/gallium/drivers/etnaviv/etnaviv_context.c | 1 +
src/gallium/drivers/etnaviv/etnaviv_context.h | 1 +
src/gallium/drivers/etnaviv/etnaviv_emit.c | 1 +
src/gallium/drivers/etnaviv/etnaviv_texture.c | 9 +++++++--
4 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.c b/src/gallium/drivers/etnaviv/etnaviv_context.c
index 7d54192..3038d21 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_context.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_context.c
@@ -382,6 +382,7 @@ etna_cmd_stream_reset_notify(struct etna_cmd_stream *stream, void *priv)
}
ctx->dirty = ~0L;
+ ctx->dirty_sampler_views = ~0L;
/* go through all the used resources and clear their status flag */
LIST_FOR_EACH_ENTRY_SAFE(rsc, rsc_tmp, &ctx->used_resources, list)
diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.h b/src/gallium/drivers/etnaviv/etnaviv_context.h
index 2903e09..1ed38ce 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_context.h
+++ b/src/gallium/drivers/etnaviv/etnaviv_context.h
@@ -156,6 +156,7 @@ struct etna_context {
struct compiled_viewport_state viewport;
unsigned num_fragment_sampler_views;
uint32_t active_sampler_views;
+ uint32_t dirty_sampler_views;
struct pipe_sampler_view *sampler_view[PIPE_MAX_SAMPLERS];
struct pipe_constant_buffer constant_buffer[PIPE_SHADER_TYPES];
struct etna_vertexbuf_state vertex_buffer;
diff --git a/src/gallium/drivers/etnaviv/etnaviv_emit.c b/src/gallium/drivers/etnaviv/etnaviv_emit.c
index 692275a..0990a37 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_emit.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_emit.c
@@ -970,4 +970,5 @@ etna_emit_state(struct etna_context *ctx)
#undef EMIT_STATE_FIXP
#undef EMIT_STATE_RELOC
ctx->dirty = 0;
+ ctx->dirty_sampler_views = 0;
}
diff --git a/src/gallium/drivers/etnaviv/etnaviv_texture.c b/src/gallium/drivers/etnaviv/etnaviv_texture.c
index 597390a..335a2df 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_texture.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_texture.c
@@ -276,12 +276,14 @@ set_sampler_views(struct etna_context *ctx, unsigned start, unsigned end,
{
unsigned i, j;
uint32_t mask = 1 << start;
+ uint32_t prev_active_sampler_views = ctx->active_sampler_views;
for (i = start, j = 0; j < nr; i++, j++, mask <<= 1) {
pipe_sampler_view_reference(&ctx->sampler_view[i], views[j]);
- if (views[j])
+ if (views[j]) {
ctx->active_sampler_views |= mask;
- else
+ ctx->dirty_sampler_views |= mask;
+ } else
ctx->active_sampler_views &= ~mask;
}
@@ -289,6 +291,9 @@ set_sampler_views(struct etna_context *ctx, unsigned start, unsigned end,
pipe_sampler_view_reference(&ctx->sampler_view[i], NULL);
ctx->active_sampler_views &= ~mask;
}
+
+ /* sampler views that changed state (even to inactive) are also dirty */
+ ctx->dirty_sampler_views |= ctx->active_sampler_views ^ prev_active_sampler_views;
}
static inline void
--
2.7.4
More information about the mesa-dev
mailing list