Module: Mesa
Branch: master
Commit: 19378dfe3c2a27ab2f9ed737d5553306233faf30
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=19378dfe3c2a27ab2f9ed737d5553306233faf30

Author: Simon Ser <[email protected]>
Date:   Fri Apr  9 13:58:40 2021 +0200

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 <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Acked-by: Leo Liu <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10134>

---

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

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to