TU6_xTx(ASTC_12x12_SRGB_BLOCK, ASTC_12x12, WZYX), /* 184 */
};
+#define FMT_EXT_BASE VK_FORMAT_G8B8G8R8_422_UNORM
+#undef TU6_FMT
+#define TU6_FMT(vkfmt, hwfmt, swapfmt, valid) \
+ [VK_FORMAT_##vkfmt - FMT_EXT_BASE] = { \
+ .fmt = FMT6_##hwfmt, \
+ .swap = swapfmt, \
+ .supported = valid, \
+ }
+
+static const struct tu_native_format tu6_format_table_ext[] = {
+ TU6_xTx(G8B8G8R8_422_UNORM, R8G8R8B8_422_UNORM, WZYX), /* 0 */
+ TU6_xTx(B8G8R8G8_422_UNORM, G8R8B8R8_422_UNORM, WZYX), /* 1 */
+};
+
static struct tu_native_format
tu6_get_native_format(VkFormat format)
{
struct tu_native_format fmt = {};
- if (format >= ARRAY_SIZE(tu6_format_table))
- return fmt;
-
- if (!tu6_format_table[format].supported)
- return fmt;
+ if (format < ARRAY_SIZE(tu6_format_table)) {
+ fmt = tu6_format_table[format];
+ } else if (format >= FMT_EXT_BASE) {
+ unsigned idx = format - FMT_EXT_BASE;
+ if (idx < ARRAY_SIZE(tu6_format_table_ext))
+ fmt = tu6_format_table_ext[idx];
+ }
- if (vk_format_to_pipe_format(format) == PIPE_FORMAT_NONE) {
+ if (fmt.supported && vk_format_to_pipe_format(format) == PIPE_FORMAT_NONE) {
tu_finishme("vk_format %d missing matching pipe format.\n", format);
- return fmt;
+ fmt.supported = false;
}
- return tu6_format_table[format];
+ return fmt;
}
struct tu_native_format
bool ubwc_enabled =
!(device->physical_device->instance->debug_flags & TU_DEBUG_NOUBWC);
- /* disable tiling when linear is requested and for compressed formats */
+ /* disable tiling when linear is requested and for YUYV/UYVY */
if (pCreateInfo->tiling == VK_IMAGE_TILING_LINEAR ||
- modifier == DRM_FORMAT_MOD_LINEAR) {
+ modifier == DRM_FORMAT_MOD_LINEAR ||
+ vk_format_description(image->vk_format)->layout == UTIL_FORMAT_LAYOUT_SUBSAMPLED) {
image->layout.tile_mode = TILE6_LINEAR;
ubwc_enabled = false;
}
};
switch (format) {
+ case VK_FORMAT_G8B8G8R8_422_UNORM:
+ case VK_FORMAT_B8G8R8G8_422_UNORM:
+ swiz[0] = A6XX_TEX_Z;
+ swiz[1] = A6XX_TEX_X;
+ swiz[2] = A6XX_TEX_Y;
+ break;
case VK_FORMAT_BC1_RGB_UNORM_BLOCK:
case VK_FORMAT_BC1_RGB_SRGB_BLOCK:
/* same hardware format is used for BC1_RGB / BC1_RGBA */
pSubresource->mipLevel,
pSubresource->arrayLayer);
pLayout->size = slice->size0;
- pLayout->rowPitch =
- slice->pitch * vk_format_get_blockheight(image->vk_format);
+ pLayout->rowPitch = slice->pitch;
pLayout->arrayPitch = image->layout.layer_size;
pLayout->depthPitch = slice->size0;
static inline bool
vk_format_is_compressed(VkFormat format)
{
- return util_format_is_compressed(vk_format_to_pipe_format(format));
+ /* this includes 4:2:2 formats, which are compressed formats for vulkan */
+ return vk_format_get_blockwidth(format) > 1;
}
static inline bool
enum util_format_colorspace colorspace,
unsigned component)
{
+ switch (format) {
+ case VK_FORMAT_G8B8G8R8_422_UNORM:
+ case VK_FORMAT_B8G8R8G8_422_UNORM:
+ /* util_format_get_component_bits doesn't return what we want */
+ return 8;
+ default:
+ break;
+ }
+
return util_format_get_component_bits(vk_format_to_pipe_format(format),
colorspace, component);
}