panfrost: check fmt.bitfeat_bit for compressed-support
Because we map compressed formats to the interchange-formats on V9 and
later, we end up not actually checking for compressed support here, but
instead always checking bit 0, which is reserved in the spec.
So let's instead explicitly check bitfeat_bit here instead, which we
conveniently stored away in the previous commit.
Use 1u instead of 1 for the shifted constant, to avoid undefined
behavior when we're testing bit 31.
Fixes: 0c1fde956b ("panfrost: Add Valhall compressed formats")
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31419>
This commit is contained in:
committed by
Marge Bot
parent
1637fa3d85
commit
23cad7c695
@@ -43,15 +43,12 @@
|
||||
* compressed formats, so we offer a helper to test if a format is supported */
|
||||
|
||||
bool
|
||||
panfrost_supports_compressed_format(struct panfrost_device *dev, unsigned fmt)
|
||||
panfrost_supports_compressed_format(struct panfrost_device *dev,
|
||||
unsigned texfeat_bit)
|
||||
{
|
||||
if (MALI_EXTRACT_TYPE(fmt) != MALI_FORMAT_COMPRESSED)
|
||||
return true;
|
||||
|
||||
unsigned idx = fmt & ~MALI_FORMAT_COMPRESSED;
|
||||
assert(idx < 32);
|
||||
|
||||
return panfrost_query_compressed_formats(&dev->kmod.props) & (1 << idx);
|
||||
assert(texfeat_bit < 32);
|
||||
return panfrost_query_compressed_formats(&dev->kmod.props) &
|
||||
BITFIELD_BIT(texfeat_bit);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -214,7 +214,7 @@ void panfrost_open_device(void *memctx, int fd, struct panfrost_device *dev);
|
||||
void panfrost_close_device(struct panfrost_device *dev);
|
||||
|
||||
bool panfrost_supports_compressed_format(struct panfrost_device *dev,
|
||||
unsigned fmt);
|
||||
unsigned texfeat_bit);
|
||||
|
||||
static inline struct panfrost_bo *
|
||||
pan_lookup_bo(struct panfrost_device *dev, uint32_t gem_handle)
|
||||
|
||||
@@ -628,7 +628,8 @@ panfrost_is_format_supported(struct pipe_screen *screen,
|
||||
* differences. */
|
||||
|
||||
bool supported =
|
||||
panfrost_supports_compressed_format(dev, MALI_EXTRACT_INDEX(fmt.hw));
|
||||
!util_format_is_compressed(format) ||
|
||||
panfrost_supports_compressed_format(dev, fmt.texfeat_bit);
|
||||
|
||||
if (!supported)
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user