[Mesa-dev] [PATCH 14/17] radeonsi: emit shader pointers before cache flushes & waits

Samuel Pitoiset samuel.pitoiset at gmail.com
Thu Apr 5 08:18:25 UTC 2018


Patches 13-14 are:

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

On 04/04/2018 03:59 AM, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
> 
> This code was written with the constant engine in mind.
> We can simplify it now.
> ---
>   src/gallium/drivers/radeonsi/si_state_draw.c | 20 +++++++-------------
>   1 file changed, 7 insertions(+), 13 deletions(-)
> 
> diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c
> index ad470fd9aec..1e79ccca054 100644
> --- a/src/gallium/drivers/radeonsi/si_state_draw.c
> +++ b/src/gallium/drivers/radeonsi/si_state_draw.c
> @@ -1423,42 +1423,36 @@ void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
>   		si_emit_cache_flush(sctx);
>   	}
>   
>   	/* Use optimal packet order based on whether we need to sync the pipeline. */
>   	if (unlikely(sctx->b.flags & (SI_CONTEXT_FLUSH_AND_INV_CB |
>   				      SI_CONTEXT_FLUSH_AND_INV_DB |
>   				      SI_CONTEXT_PS_PARTIAL_FLUSH |
>   				      SI_CONTEXT_CS_PARTIAL_FLUSH))) {
>   		/* If we have to wait for idle, set all states first, so that all
>   		 * SET packets are processed in parallel with previous draw calls.
> -		 * Then upload descriptors, set shader pointers, and draw, and
> -		 * prefetch at the end. This ensures that the time the CUs
> -		 * are idle is very short. (there are only SET_SH packets between
> -		 * the wait and the draw)
> +		 * Then draw and prefetch at the end. This ensures that the time
> +		 * the CUs are idle is very short.
>   		 */
> -		struct r600_atom *shader_pointers = &sctx->shader_pointers.atom;
> -		unsigned masked_atoms = 1u << shader_pointers->id;
> +		unsigned masked_atoms = 0;
>   
>   		if (unlikely(sctx->b.flags & SI_CONTEXT_FLUSH_FOR_RENDER_COND))
>   			masked_atoms |= 1u << sctx->b.render_cond_atom.id;
>   
> -		/* Emit all states except shader pointers and render condition. */
> +		if (!si_upload_graphics_shader_descriptors(sctx))
> +			return;
> +
> +		/* Emit all states except possibly render condition. */
>   		si_emit_all_states(sctx, info, masked_atoms);
>   		si_emit_cache_flush(sctx);
> -
>   		/* <-- CUs are idle here. */
> -		if (!si_upload_graphics_shader_descriptors(sctx))
> -			return;
>   
> -		/* Set shader pointers after descriptors are uploaded. */
> -		if (si_is_atom_dirty(sctx, shader_pointers))
> -			shader_pointers->emit(&sctx->b, NULL);
>   		if (si_is_atom_dirty(sctx, &sctx->b.render_cond_atom))
>   			sctx->b.render_cond_atom.emit(&sctx->b, NULL);
>   		sctx->dirty_atoms = 0;
>   
>   		si_emit_draw_packets(sctx, info, indexbuf, index_size, index_offset);
>   		/* <-- CUs are busy here. */
>   
>   		/* Start prefetches after the draw has been started. Both will run
>   		 * in parallel, but starting the draw first is more important.
>   		 */
> 


More information about the mesa-dev mailing list