From 059f042fb1d24daf9138b3b0d7fbcd869dc4255a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Fri, 19 Mar 2021 19:05:13 -0400 Subject: [PATCH] radeonsi: allow trivial DCC clears for shared textures with DCC constant encode This relaxes the existing restriction. Acked-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/gallium/drivers/radeonsi/si_clear.c | 26 +++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_clear.c b/src/gallium/drivers/radeonsi/si_clear.c index 3d01b18f2ab..04eb4b8ff8d 100644 --- a/src/gallium/drivers/radeonsi/si_clear.c +++ b/src/gallium/drivers/radeonsi/si_clear.c @@ -481,14 +481,6 @@ static void si_do_fast_color_clear(struct si_context *sctx, unsigned *buffers, continue; } - /* shared textures can't use fast clear without an explicit flush, - * because there is no way to communicate the clear color among - * all clients - */ - if (tex->buffer.b.is_shared && - !(tex->buffer.external_usage & PIPE_HANDLE_USAGE_EXPLICIT_FLUSH)) - continue; - if (sctx->chip_class <= GFX8 && tex->surface.u.legacy.level[0].mode == RADEON_SURF_MODE_1D && !sctx->screen->info.htile_cmask_support_1d_tiling) continue; @@ -531,6 +523,17 @@ static void si_do_fast_color_clear(struct si_context *sctx, unsigned *buffers, &eliminate_needed)) continue; + /* Shared textures can't use fast clear without an explicit flush + * because the clear color is not exported. + * + * Chips without DCC constant encoding must set the clear color registers + * correctly even if the fast clear eliminate pass is not needed. + */ + if ((eliminate_needed || !sctx->screen->info.has_dcc_constant_encode) && + tex->buffer.b.is_shared && + !(tex->buffer.external_usage & PIPE_HANDLE_USAGE_EXPLICIT_FLUSH)) + continue; + if (eliminate_needed && too_small) continue; @@ -558,6 +561,13 @@ static void si_do_fast_color_clear(struct si_context *sctx, unsigned *buffers, fmask_decompress_needed = true; } } else { + /* Shared textures can't use fast clear without an explicit flush + * because the clear color is not exported. + */ + if (tex->buffer.b.is_shared && + !(tex->buffer.external_usage & PIPE_HANDLE_USAGE_EXPLICIT_FLUSH)) + continue; + if (too_small) continue;