From 19378dfe3c2a27ab2f9ed737d5553306233faf30 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Fri, 9 Apr 2021 13:58:40 +0200 Subject: [PATCH] ac/surface: use blocksizebits instead of blocksize MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit util_format_get_blocksize asserts that the blocksize isn't zero. However the blocksize will be zero if the format's channel encoding is unspecified. The channel encoding is only meaningful for the plain u_format layout, so util_format_get_blocksize can't be used for formats with another layout. For example, YUV formats don't have the channel encoding specified. Use util_format_get_blocksizebits, which just returns zero without an assertion for formats which don't have a channel encoding. Signed-off-by: Simon Ser Reviewed-by: Marek Olšák Acked-by: Leo Liu Part-of: --- src/amd/common/ac_surface.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/amd/common/ac_surface.c b/src/amd/common/ac_surface.c index 5ef3a0d7e84..b4274c880a2 100644 --- a/src/amd/common/ac_surface.c +++ b/src/amd/common/ac_surface.c @@ -185,7 +185,7 @@ bool ac_is_modifier_supported(const struct radeon_info *info, if (util_format_is_compressed(format) || util_format_is_depth_or_stencil(format) || - util_format_get_blocksize(format) > 8) + util_format_get_blocksizebits(format) > 64) return false; if (info->chip_class < GFX9) @@ -276,7 +276,7 @@ bool ac_get_supported_modifiers(const struct radeon_info *info, common_dcc | AMD_FMT_MOD_SET(PIPE, pipes)) - if (util_format_get_blocksize(format) == 4) { + if (util_format_get_blocksizebits(format) == 32) { if (info->max_render_backends == 1) { ADD_MOD(AMD_FMT_MOD | AMD_FMT_MOD_SET(TILE, AMD_FMT_MOD_TILE_GFX9_64K_S_X) | @@ -365,7 +365,7 @@ bool ac_get_supported_modifiers(const struct radeon_info *info, AMD_FMT_MOD_SET(TILE, AMD_FMT_MOD_TILE_GFX9_64K_S_X) | AMD_FMT_MOD_SET(PIPE_XOR_BITS, pipe_xor_bits)) - if (util_format_get_blocksize(format) != 4) { + if (util_format_get_blocksizebits(format) != 32) { ADD_MOD(AMD_FMT_MOD | AMD_FMT_MOD_SET(TILE, AMD_FMT_MOD_TILE_GFX9_64K_D) | AMD_FMT_MOD_SET(TILE_VERSION, AMD_FMT_MOD_TILE_VER_GFX9));