diff --git a/src/gallium/drivers/panfrost/pan_device.c b/src/gallium/drivers/panfrost/pan_device.c index afd2cec7716..dde0ec0f11b 100644 --- a/src/gallium/drivers/panfrost/pan_device.c +++ b/src/gallium/drivers/panfrost/pan_device.c @@ -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 diff --git a/src/gallium/drivers/panfrost/pan_device.h b/src/gallium/drivers/panfrost/pan_device.h index c90e3e8f72f..6e71499e319 100644 --- a/src/gallium/drivers/panfrost/pan_device.h +++ b/src/gallium/drivers/panfrost/pan_device.h @@ -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) diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c index 13e7f33e635..ce1f78ed3e9 100644 --- a/src/gallium/drivers/panfrost/pan_screen.c +++ b/src/gallium/drivers/panfrost/pan_screen.c @@ -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;