From 9d1f8805b02bd15bc596de77f56837d83144689f Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Sat, 18 Nov 2017 10:44:37 +0100 Subject: [PATCH] etnaviv: GC7000: Track dirty sampler views Need this to efficiently emit texture descriptor invalidations. Signed-off-by: Wladimir J. van der Laan Reviewed-by: Christian Gmeiner --- 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 7d54192dfcb..3038d210e10 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 2903e0963d5..1ed38ce48c1 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 f63ec774864..dcad467f58a 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_emit.c +++ b/src/gallium/drivers/etnaviv/etnaviv_emit.c @@ -851,4 +851,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 6a33f787a1b..295f7eb676c 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_texture.c +++ b/src/gallium/drivers/etnaviv/etnaviv_texture.c @@ -345,12 +345,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; } @@ -358,6 +360,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.30.2