From dc6c42dc77e4bf0cb07037e038c4a50afa5a8143 Mon Sep 17 00:00:00 2001 From: Lucas Stach Date: Thu, 6 Feb 2020 17:11:03 +0100 Subject: [PATCH] etnaviv: generalize FE stall before loading shader and sampler states It seems that some of the new shader and sampler states added with Halti0 are not self-synchronizing anymore. Make sure to stall the FE before loading those new states to avoid corruption of the in-flight draw state. Signed-off-by: Lucas Stach Reviewed-by: Jonathan Marek Part-of: --- src/gallium/drivers/etnaviv/etnaviv_emit.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/gallium/drivers/etnaviv/etnaviv_emit.c b/src/gallium/drivers/etnaviv/etnaviv_emit.c index cb55b2eb497..de36aeb7f9b 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_emit.c +++ b/src/gallium/drivers/etnaviv/etnaviv_emit.c @@ -534,18 +534,18 @@ etna_emit_state(struct etna_context *ctx) else emit_pre_halti5_state(ctx); - ctx->emit_texture_state(ctx); - - /* Insert a FE/PE stall as changing the shader instructions (and maybe - * the uniforms) can corrupt the previous in-progress draw operation. - * Observed with amoeba on GC2000 during the right-to-left rendering - * of PI, and can cause GPU hangs immediately after. - * I summise that this is because the "new" locations at 0xc000 are not - * properly protected against updates as other states seem to be. Hence, - * we detect the "new" vertex shader instruction offset to apply this. */ - if (ctx->dirty & (ETNA_DIRTY_SHADER | ETNA_DIRTY_CONSTBUF) && screen->specs.vs_offset > 0x4000) + /* Beginning from Halti0 some of the new shader and sampler states are not + * self-synchronizing anymore. Thus we need to stall the FE on PE completion + * before loading the new states to avoid corrupting the state of the + * in-flight draw. + */ + if (screen->specs.halti >= 0 && + (ctx->dirty & (ETNA_DIRTY_SHADER | ETNA_DIRTY_CONSTBUF | + ETNA_DIRTY_SAMPLERS | ETNA_DIRTY_SAMPLER_VIEWS))) etna_stall(ctx->stream, SYNC_RECIPIENT_FE, SYNC_RECIPIENT_PE); + ctx->emit_texture_state(ctx); + /* We need to update the uniform cache only if one of the following bits are * set in ctx->dirty: * - ETNA_DIRTY_SHADER -- 2.30.2