diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c index 30be488edef..e8e47eca9b5 100644 --- a/src/intel/vulkan/anv_formats.c +++ b/src/intel/vulkan/anv_formats.c @@ -59,6 +59,18 @@ .n_planes = 1, \ } +#define swiz_fmt1_flags(__vk_fmt, __hw_fmt, __swizzle, __flags) \ + [VK_ENUM_OFFSET(__vk_fmt)] = { \ + .planes = { \ + { .isl_format = __hw_fmt, .swizzle = __swizzle, \ + .aspect = VK_IMAGE_ASPECT_COLOR_BIT, \ + }, \ + }, \ + .vk_format = __vk_fmt, \ + .n_planes = 1, \ + .flags = __flags, \ + } + #define fmt1(__vk_fmt, __hw_fmt) \ swiz_fmt1(__vk_fmt, __hw_fmt, RGBA) @@ -320,8 +332,9 @@ static const struct anv_format main_formats[] = { }; static const struct anv_format _4444_formats[] = { - fmt1(VK_FORMAT_A4R4G4B4_UNORM_PACK16, ISL_FORMAT_B4G4R4A4_UNORM), - fmt_unsupported(VK_FORMAT_A4B4G4R4_UNORM_PACK16), + fmt1(VK_FORMAT_A4R4G4B4_UNORM_PACK16, ISL_FORMAT_B4G4R4A4_UNORM), + swiz_fmt1_flags(VK_FORMAT_A4B4G4R4_UNORM_PACK16, ISL_FORMAT_B4G4R4A4_UNORM, BGRA, + ANV_FORMAT_FLAG_NO_CBCWF), }; static const struct anv_format _2plane_444_formats[] = { @@ -448,6 +461,13 @@ anv_get_format(const struct anv_physical_device *device, VkFormat vk_format) if (format->planes[0].isl_format == ISL_FORMAT_UNSUPPORTED) return NULL; + /* This format is only available if custom border colors without format is + * disabled. + */ + if ((format->flags & ANV_FORMAT_FLAG_NO_CBCWF) && + device->instance->custom_border_colors_without_format) + return NULL; + return format; } diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 4042d6ced5b..3e5dcb3be3e 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -5213,6 +5213,8 @@ enum anv_format_flag { ANV_FORMAT_FLAG_CAN_YCBCR = BITFIELD_BIT(0), /* Format supports video API */ ANV_FORMAT_FLAG_CAN_VIDEO = BITFIELD_BIT(1), + /* Format works if custom border colors without format is disabled */ + ANV_FORMAT_FLAG_NO_CBCWF = BITFIELD_BIT(2), }; struct anv_format {