ac/surface: use blocksizebits instead of blocksize

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 <contact@emersion.fr>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10134>
This commit is contained in:
Simon Ser 2021-04-09 13:58:40 +02:00 committed by Marge Bot
parent 6e697b595f
commit 19378dfe3c
1 changed files with 3 additions and 3 deletions

View File

@ -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));