[Mesa-dev] [PATCH 3/6] radeonsi: clear PIPE_IMAGE_ACCESS_WRITE when it's invalid to be on the safe side

Nicolai Hähnle nhaehnle at gmail.com
Wed Nov 29 09:59:35 UTC 2017


On 28.11.2017 22:17, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
> 
> ---
>   src/gallium/drivers/radeonsi/si_descriptors.c | 8 ++++++++
>   1 file changed, 8 insertions(+)
> 
> diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c
> index 69371ea..471c93a 100644
> --- a/src/gallium/drivers/radeonsi/si_descriptors.c
> +++ b/src/gallium/drivers/radeonsi/si_descriptors.c
> @@ -681,20 +681,28 @@ static void si_set_shader_image_desc(struct si_context *ctx,
>   					  view->format,
>   					  view->u.buf.offset,
>   					  view->u.buf.size, desc);
>   		si_set_buf_desc_address(res, view->u.buf.offset, desc + 4);
>   	} else {
>   		static const unsigned char swizzle[4] = { 0, 1, 2, 3 };
>   		struct r600_texture *tex = (struct r600_texture *)res;
>   		unsigned level = view->u.tex.level;
>   		unsigned width, height, depth, hw_level;
>   		bool uses_dcc = vi_dcc_enabled(tex, level);
> +		unsigned access = view->access;
> +
> +		/* Clear the write flag when writes can't occur.
> +		 * Note that DCC_DECOMPRESS for MSAA doesn't work in some cases,
> +		 * so we don't wanna trigger it.
> +		 */
> +		if (tex->is_depth || tex->resource.b.b.nr_samples >= 2)
> +			access &= ~PIPE_IMAGE_ACCESS_WRITE;

Shouldn't this rather be an assert()? Just removing the bit here won't 
stop the application from attempting to write to it from a shader anyway.

We shouldn't be hitting that assert anyway, since we don't currently 
support MSAA images.

Cheers,
Nicolai


>   
>   		assert(!tex->is_depth);
>   		assert(tex->fmask.size == 0);
>   
>   		if (uses_dcc && !skip_decompress &&
>   		    (view->access & PIPE_IMAGE_ACCESS_WRITE ||
>   		     !vi_dcc_formats_compatible(res->b.b.format, view->format))) {
>   			/* If DCC can't be disabled, at least decompress it.
>   			 * The decompression is relatively cheap if the surface
>   			 * has been decompressed already.
> 


-- 
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.


More information about the mesa-dev mailing list