[Mesa-dev] [PATCH] radeonsi: update clip_regs if clip_disable changes to fix a hang

Samuel Pitoiset samuel.pitoiset at gmail.com
Tue Jan 3 10:20:07 UTC 2017


This fixes the hang, thanks!

Tested-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>

On 01/03/2017 11:07 AM, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> This seems to fix the GPU hangs caused by:
>
> commit ed3190b3f3a776fc8c75b1e6130a88079166d115
> Author: Marek Olšák <marek.olsak at amd.com>
> Date:   Sun Nov 13 18:41:43 2016 +0100
>
>     radeonsi: don't export ClipVertex and ClipDistance[] if clipping is disabled
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99219
> ---
>  src/gallium/drivers/radeonsi/si_state_shaders.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c
> index 56b6334..a360672 100644
> --- a/src/gallium/drivers/radeonsi/si_state_shaders.c
> +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
> @@ -2364,20 +2364,22 @@ static void si_update_so(struct si_context *sctx, struct si_shader_selector *sha
>  	for (i = 0; i < so->num_outputs; i++)
>  		enabled_stream_buffers_mask |= (1 << so->output[i].output_buffer) << (so->output[i].stream * 4);
>  	sctx->b.streamout.enabled_stream_buffers_mask = enabled_stream_buffers_mask;
>  	sctx->b.streamout.stride_in_dw = shader->so.stride;
>  }
>
>  bool si_update_shaders(struct si_context *sctx)
>  {
>  	struct pipe_context *ctx = (struct pipe_context*)sctx;
>  	struct si_state_rasterizer *rs = sctx->queued.named.rasterizer;
> +	struct si_shader *old_vs = si_get_vs_state(sctx);
> +	bool old_clip_disable = old_vs ? old_vs->key.opt.hw_vs.clip_disable : false;
>  	int r;
>
>  	/* Update stages before GS. */
>  	if (sctx->tes_shader.cso) {
>  		if (!sctx->tf_ring) {
>  			si_init_tess_factor_ring(sctx);
>  			if (!sctx->tf_ring)
>  				return false;
>  		}
>
> @@ -2444,20 +2446,23 @@ bool si_update_shaders(struct si_context *sctx)
>
>  		if (!si_update_gs_ring_buffers(sctx))
>  			return false;
>  	} else {
>  		si_pm4_bind_state(sctx, gs, NULL);
>  		si_pm4_bind_state(sctx, es, NULL);
>  	}
>
>  	si_update_vgt_shader_config(sctx);
>
> +	if (old_clip_disable != si_get_vs_state(sctx)->key.opt.hw_vs.clip_disable)
> +		si_mark_atom_dirty(sctx, &sctx->clip_regs);
> +
>  	if (sctx->ps_shader.cso) {
>  		unsigned db_shader_control;
>
>  		r = si_shader_select(ctx, &sctx->ps_shader);
>  		if (r)
>  			return false;
>  		si_pm4_bind_state(sctx, ps, sctx->ps_shader.current->pm4);
>
>  		db_shader_control =
>  			sctx->ps_shader.cso->db_shader_control |
>


More information about the mesa-dev mailing list