etnaviv: GC7000: Track dirty sampler views

Need this to efficiently emit texture descriptor invalidations.

Signed-off-by: Wladimir J. van der Laan <laanwj@gmail.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
This commit is contained in:
Wladimir J. van der Laan 2017-11-18 10:44:37 +01:00 committed by Christian Gmeiner
parent 5cc36f9f21
commit 9d1f8805b0
4 changed files with 10 additions and 2 deletions

View File

@ -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)

View File

@ -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;

View File

@ -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;
}

View File

@ -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