hk: don't advertise impossible modifiers
fixes dEQP-VK.drm_format_modifiers.bound_to_dma_buf.a2b10g10r10_sint_pack32,Crash Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32081>
This commit is contained in:
committed by
Marge Bot
parent
e5d61631fe
commit
d449800e46
@@ -25,8 +25,8 @@ uint64_t agx_best_modifiers[] = {
|
||||
};
|
||||
|
||||
static VkFormatFeatureFlags2
|
||||
hk_modifier_features(uint64_t mod, VkFormat vk_format,
|
||||
const VkFormatProperties *props)
|
||||
hk_modifier_features(const struct agx_device *dev, uint64_t mod,
|
||||
VkFormat vk_format, const VkFormatProperties *props)
|
||||
{
|
||||
/* There's no corresponding fourcc, so don't advertise modifiers */
|
||||
if (vk_format == VK_FORMAT_B10G11R11_UFLOAT_PACK32 ||
|
||||
@@ -34,6 +34,11 @@ hk_modifier_features(uint64_t mod, VkFormat vk_format,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Don't advertise compression for the uncompressable */
|
||||
if (mod == DRM_FORMAT_MOD_APPLE_TWIDDLED_COMPRESSED &&
|
||||
!hk_can_compress_format(dev, vk_format))
|
||||
return 0;
|
||||
|
||||
if (mod == DRM_FORMAT_MOD_LINEAR)
|
||||
return props->linearTilingFeatures;
|
||||
else
|
||||
@@ -51,7 +56,8 @@ get_drm_format_modifier_properties_list(
|
||||
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(agx_best_modifiers); ++i) {
|
||||
uint64_t mod = agx_best_modifiers[i];
|
||||
VkFormatFeatureFlags2 flags = hk_modifier_features(mod, vk_format, props);
|
||||
VkFormatFeatureFlags2 flags =
|
||||
hk_modifier_features(&physical_device->dev, mod, vk_format, props);
|
||||
|
||||
if (!flags)
|
||||
continue;
|
||||
@@ -79,7 +85,8 @@ get_drm_format_modifier_properties_list_2(
|
||||
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(agx_best_modifiers); ++i) {
|
||||
uint64_t mod = agx_best_modifiers[i];
|
||||
VkFormatFeatureFlags2 flags = hk_modifier_features(mod, vk_format, props);
|
||||
VkFormatFeatureFlags2 flags =
|
||||
hk_modifier_features(&physical_device->dev, mod, vk_format, props);
|
||||
|
||||
if (!flags)
|
||||
continue;
|
||||
|
||||
@@ -221,7 +221,7 @@ vk_image_usage_to_format_features(VkImageUsageFlagBits usage_flag)
|
||||
}
|
||||
|
||||
static bool
|
||||
hk_can_compress(struct agx_device *dev, VkFormat format, unsigned plane,
|
||||
hk_can_compress(const struct agx_device *dev, VkFormat format, unsigned plane,
|
||||
unsigned width, unsigned height, unsigned samples,
|
||||
VkImageCreateFlagBits flags, VkImageUsageFlagBits usage,
|
||||
const void *pNext)
|
||||
@@ -297,8 +297,8 @@ hk_can_compress(struct agx_device *dev, VkFormat format, unsigned plane,
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
hk_can_compress_format(struct agx_device *dev, VkFormat format)
|
||||
bool
|
||||
hk_can_compress_format(const struct agx_device *dev, VkFormat format)
|
||||
{
|
||||
/* Check compressability of a sufficiently large image of the same
|
||||
* format, since we don't have dimensions here. This is lossy for
|
||||
|
||||
@@ -129,3 +129,6 @@ hk_image_aspects_to_plane(const struct hk_image *image,
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
struct agx_device;
|
||||
bool hk_can_compress_format(const struct agx_device *dev, VkFormat format);
|
||||
|
||||
Reference in New Issue
Block a user