mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 13:58:04 +02:00
etnaviv: only emit sampler config for changed samplers
Currently SAMPLER_CONFIG0 is always emitted to either update the active configuration or disable the sampler. With NTE this always emits 32 state dwords, while there are a lot of cases that only use a small number of samplers and never change the other samplers from their disabled state. Track the active samplers from the last emit, so we can skip the state emission when the sampler is already disabled. Only emit the full state after a context flush where we don't know the previous sampler state of the GPU. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23579>
This commit is contained in:
parent
8f56228ace
commit
30fb1bffd6
4 changed files with 31 additions and 19 deletions
|
|
@ -507,6 +507,7 @@ etna_reset_gpu_state(struct etna_context *ctx)
|
|||
|
||||
ctx->dirty = ~0L;
|
||||
ctx->dirty_sampler_views = ~0L;
|
||||
ctx->prev_active_samplers = ~0L;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -152,6 +152,7 @@ struct etna_context {
|
|||
struct pipe_blend_state *blend;
|
||||
unsigned num_fragment_samplers;
|
||||
uint32_t active_samplers;
|
||||
uint32_t prev_active_samplers;
|
||||
struct pipe_sampler_state *sampler[PIPE_MAX_SAMPLERS];
|
||||
struct pipe_rasterizer_state *rasterizer;
|
||||
struct pipe_depth_stencil_alpha_state *zsa;
|
||||
|
|
|
|||
|
|
@ -322,7 +322,7 @@ etna_emit_texture_desc(struct etna_context *ctx)
|
|||
struct etna_sampler_view_desc *sv = etna_sampler_view_desc(ctx->sampler_view[x]);
|
||||
etna_sampler_view_update_descriptor(ctx, stream, sv);
|
||||
etna_set_state_reloc(stream, VIVS_NTE_DESCRIPTOR_ADDR(x), &sv->DESC_ADDR);
|
||||
} else {
|
||||
} else if ((1 << x) & ctx->prev_active_samplers){
|
||||
/* dummy texture descriptors for unused samplers */
|
||||
etna_set_state_reloc(stream, VIVS_NTE_DESCRIPTOR_ADDR(x),
|
||||
&ctx->screen->dummy_desc_reloc);
|
||||
|
|
@ -342,6 +342,8 @@ etna_emit_texture_desc(struct etna_context *ctx)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
ctx->prev_active_samplers = active_samplers;
|
||||
}
|
||||
|
||||
static struct etna_sampler_ts*
|
||||
|
|
|
|||
|
|
@ -347,18 +347,20 @@ etna_emit_new_texture_state(struct etna_context *ctx)
|
|||
|
||||
if (unlikely(dirty & (ETNA_DIRTY_SAMPLER_VIEWS | ETNA_DIRTY_SAMPLERS))) {
|
||||
for (int x = 0; x < VIVS_NTE_SAMPLER__LEN; ++x) {
|
||||
uint32_t val = 0; /* 0 == sampler inactive */
|
||||
if ((1 << x) & (active_samplers | ctx->prev_active_samplers)) {
|
||||
uint32_t val = 0; /* 0 == sampler inactive */
|
||||
|
||||
/* set active samplers to their configuration value (determined by both
|
||||
* the sampler state and sampler view) */
|
||||
if ((1 << x) & active_samplers) {
|
||||
struct etna_sampler_state *ss = etna_sampler_state(ctx->sampler[x]);
|
||||
struct etna_sampler_view *sv = etna_sampler_view(ctx->sampler_view[x]);
|
||||
/* set active samplers to their configuration value (determined by
|
||||
* both the sampler state and sampler view) */
|
||||
if ((1 << x) & active_samplers) {
|
||||
struct etna_sampler_state *ss = etna_sampler_state(ctx->sampler[x]);
|
||||
struct etna_sampler_view *sv = etna_sampler_view(ctx->sampler_view[x]);
|
||||
|
||||
val = (ss->config0 & sv->config0_mask) | sv->config0;
|
||||
val = (ss->config0 & sv->config0_mask) | sv->config0;
|
||||
}
|
||||
|
||||
/*10000*/ EMIT_STATE(NTE_SAMPLER_CONFIG0(x), val);
|
||||
}
|
||||
|
||||
/*10000*/ EMIT_STATE(NTE_SAMPLER_CONFIG0(x), val);
|
||||
}
|
||||
}
|
||||
if (unlikely(dirty & (ETNA_DIRTY_SAMPLER_VIEWS))) {
|
||||
|
|
@ -461,6 +463,8 @@ etna_emit_new_texture_state(struct etna_context *ctx)
|
|||
}
|
||||
|
||||
etna_coalesce_end(stream, &coalesce);
|
||||
|
||||
ctx->prev_active_samplers = active_samplers;
|
||||
}
|
||||
|
||||
/* Emit plain (non-descriptor) texture state */
|
||||
|
|
@ -479,18 +483,20 @@ etna_emit_texture_state(struct etna_context *ctx)
|
|||
|
||||
if (unlikely(dirty & (ETNA_DIRTY_SAMPLER_VIEWS | ETNA_DIRTY_SAMPLERS))) {
|
||||
for (int x = 0; x < VIVS_TE_SAMPLER__LEN; ++x) {
|
||||
uint32_t val = 0; /* 0 == sampler inactive */
|
||||
if ((1 << x) & (active_samplers | ctx->prev_active_samplers)) {
|
||||
uint32_t val = 0; /* 0 == sampler inactive */
|
||||
|
||||
/* set active samplers to their configuration value (determined by both
|
||||
* the sampler state and sampler view) */
|
||||
if ((1 << x) & active_samplers) {
|
||||
struct etna_sampler_state *ss = etna_sampler_state(ctx->sampler[x]);
|
||||
struct etna_sampler_view *sv = etna_sampler_view(ctx->sampler_view[x]);
|
||||
/* set active samplers to their configuration value (determined by
|
||||
* both the sampler state and sampler view) */
|
||||
if ((1 << x) & active_samplers) {
|
||||
struct etna_sampler_state *ss = etna_sampler_state(ctx->sampler[x]);
|
||||
struct etna_sampler_view *sv = etna_sampler_view(ctx->sampler_view[x]);
|
||||
|
||||
val = (ss->config0 & sv->config0_mask) | sv->config0;
|
||||
val = (ss->config0 & sv->config0_mask) | sv->config0;
|
||||
}
|
||||
|
||||
/*02000*/ EMIT_STATE(TE_SAMPLER_CONFIG0(x), val);
|
||||
}
|
||||
|
||||
/*02000*/ EMIT_STATE(TE_SAMPLER_CONFIG0(x), val);
|
||||
}
|
||||
}
|
||||
if (unlikely(dirty & (ETNA_DIRTY_SAMPLER_VIEWS))) {
|
||||
|
|
@ -584,6 +590,8 @@ etna_emit_texture_state(struct etna_context *ctx)
|
|||
}
|
||||
|
||||
etna_coalesce_end(stream, &coalesce);
|
||||
|
||||
ctx->prev_active_samplers = active_samplers;
|
||||
}
|
||||
|
||||
#undef EMIT_STATE
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue