[Mesa-dev] [PATCH 4/4] radeonsi: add a workaround for inexact SNORM8 blitting again
Nicolai Hähnle
nhaehnle at gmail.com
Mon Jun 19 12:56:06 UTC 2017
On 17.06.2017 15:44, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> GFX9 is affected.
> ---
> src/gallium/drivers/radeonsi/si_blit.c | 36 ++++++++++++++++++++++++++++++++++
> 1 file changed, 36 insertions(+)
>
> diff --git a/src/gallium/drivers/radeonsi/si_blit.c b/src/gallium/drivers/radeonsi/si_blit.c
> index 1159594..b78fddf 100644
> --- a/src/gallium/drivers/radeonsi/si_blit.c
> +++ b/src/gallium/drivers/radeonsi/si_blit.c
> @@ -1133,20 +1133,56 @@ void si_resource_copy_region(struct pipe_context *ctx,
> src_templ.format = PIPE_FORMAT_R32G32B32A32_UINT;
> break;
> default:
> fprintf(stderr, "Unhandled format %s with blocksize %u\n",
> util_format_short_name(src->format), blocksize);
> assert(0);
> }
> }
> }
>
> + /* SNORM8 blitting has precision issues on some chips. Use the SINT
> + * equivalent instead, which doesn't force DCC decompression.
> + * Note that some chips avoid this issue by using SDMA.
> + */
> + if (util_format_is_snorm8(dst_templ.format)) {
> + switch (dst_templ.format) {
> + case PIPE_FORMAT_R8_SNORM:
> + dst_templ.format = src_templ.format = PIPE_FORMAT_R8_SINT;
> + break;
> + case PIPE_FORMAT_R8G8_SNORM:
> + dst_templ.format = src_templ.format = PIPE_FORMAT_R8G8_SINT;
> + break;
> + case PIPE_FORMAT_R8G8B8X8_SNORM:
> + dst_templ.format = src_templ.format = PIPE_FORMAT_R8G8B8X8_SINT;
> + break;
> + case PIPE_FORMAT_R8G8B8A8_SNORM:
> + case PIPE_FORMAT_A8B8G8R8_SNORM: /* also swizzle */
> + case PIPE_FORMAT_X8B8G8R8_SNORM: /* also swizzle */
> + dst_templ.format = src_templ.format = PIPE_FORMAT_R8G8B8A8_SINT;
Why does R8G8B8X8 need a separate case but not X8B8G8R8?
Do we have a test for this?
Cheers,
Nicolai
> + break;
> + case PIPE_FORMAT_A8_SNORM:
> + dst_templ.format = src_templ.format = PIPE_FORMAT_A8_SINT;
> + break;
> + case PIPE_FORMAT_L8_SNORM:
> + dst_templ.format = src_templ.format = PIPE_FORMAT_L8_SINT;
> + break;
> + case PIPE_FORMAT_L8A8_SNORM:
> + dst_templ.format = src_templ.format = PIPE_FORMAT_L8A8_SINT;
> + break;
> + case PIPE_FORMAT_I8_SNORM:
> + dst_templ.format = src_templ.format = PIPE_FORMAT_I8_SINT;
> + break;
> + default:; /* fall through */
> + }
> + }
> +
> vi_disable_dcc_if_incompatible_format(&sctx->b, dst, dst_level,
> dst_templ.format);
> vi_disable_dcc_if_incompatible_format(&sctx->b, src, src_level,
> src_templ.format);
>
> /* Initialize the surface. */
> dst_view = r600_create_surface_custom(ctx, dst, &dst_templ,
> dst_width0, dst_height0,
> dst_width, dst_height);
>
>
--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
More information about the mesa-dev
mailing list