{
struct tu_physical_device *phys_dev = cmdbuf->device->physical_device;
- struct tu_native_format dfmt = tu6_format_color(blt->dst.fmt, blt->dst.tiled);
- struct tu_native_format sfmt = tu6_format_texture(blt->src.fmt, blt->src.tiled);
+ struct tu_native_format dfmt = tu6_format_color(blt->dst.fmt, blt->dst.image_tile_mode);
+ struct tu_native_format sfmt = tu6_format_texture(blt->src.fmt, blt->src.image_tile_mode);
if (dfmt.fmt == FMT6_Z24_UNORM_S8_UINT)
dfmt.fmt = FMT6_Z24_UNORM_S8_UINT_AS_R8G8B8A8;
}
} else if ((blt->src.va & 63) || (blt->src.pitch & 63)) {
/* per line copy path (buffer_to_image) */
- assert(blt->type == TU_BLIT_COPY && !blt->src.tiled);
+ assert(blt->type == TU_BLIT_COPY && !blt->src.image_tile_mode);
struct tu_blit line_blt = *blt;
uint64_t src_va = line_blt.src.va + blt->src.pitch * blt->src.y;
}
} else if ((blt->dst.va & 63) || (blt->dst.pitch & 63)) {
/* per line copy path (image_to_buffer) */
- assert(blt->type == TU_BLIT_COPY && !blt->dst.tiled);
+ assert(blt->type == TU_BLIT_COPY && !blt->dst.image_tile_mode);
struct tu_blit line_blt = *blt;
uint64_t dst_va = line_blt.dst.va + blt->dst.pitch * blt->dst.y;
struct tu_blit_surf {
VkFormat fmt;
enum a6xx_tile_mode tile_mode;
- bool tiled;
+ enum a6xx_tile_mode image_tile_mode;
uint64_t va;
uint32_t pitch, layer_size;
uint32_t x, y;
return (struct tu_blit_surf) {
.fmt = image->vk_format,
.tile_mode = tu6_get_image_tile_mode(image, subres.mipLevel),
- .tiled = image->layout.tile_mode != TILE6_LINEAR,
+ .image_tile_mode = image->layout.tile_mode,
.va = tu_image_base(image, subres.mipLevel, layer),
.pitch = tu_image_stride(image, subres.mipLevel),
.layer_size = tu_layer_size(image, subres.mipLevel),
TU6_xTx(ASTC_12x12_SRGB_BLOCK, ASTC_12x12, WZYX), /* 184 */
};
-struct tu_native_format
+static struct tu_native_format
tu6_get_native_format(VkFormat format)
{
struct tu_native_format fmt = {};
return fmt;
}
-enum a6xx_format
-tu6_format_gmem(VkFormat format)
-{
- struct tu_native_format fmt = tu6_get_native_format(format);
- assert(fmt.supported & FMT_COLOR);
-
- if (fmt.fmt == FMT6_10_10_10_2_UNORM)
- return FMT6_10_10_10_2_UNORM_DEST;
-
- return fmt.fmt;
-}
-
struct tu_native_format
-tu6_format_color(VkFormat format, bool tiled)
+tu6_format_color(VkFormat format, enum a6xx_tile_mode tile_mode)
{
struct tu_native_format fmt = tu6_get_native_format(format);
assert(fmt.supported & FMT_COLOR);
if (fmt.fmt == FMT6_10_10_10_2_UNORM)
fmt.fmt = FMT6_10_10_10_2_UNORM_DEST;
- if (tiled)
+ if (tile_mode)
fmt.swap = WZYX;
return fmt;
}
struct tu_native_format
-tu6_format_texture(VkFormat format, bool tiled)
+tu6_format_texture(VkFormat format, enum a6xx_tile_mode tile_mode)
{
struct tu_native_format fmt = tu6_get_native_format(format);
assert(fmt.supported & FMT_TEXTURE);
- if (!tiled) {
+ if (!tile_mode) {
/* different from format table when used as linear src */
if (format == VK_FORMAT_R5G5B5A1_UNORM_PACK16)
fmt.fmt = FMT6_1_5_5_5_UNORM, fmt.swap = WXYZ;
enum VkFormat vfmt = pCreateInfo->format;
enum pipe_format pfmt = vk_format_to_pipe_format(vfmt);
- const struct tu_native_format fmt = tu6_format_texture(vfmt, false);
+ const struct tu_native_format fmt = tu6_format_texture(vfmt, TILE6_LINEAR);
uint32_t range;
if (pCreateInfo->range == VK_WHOLE_SIZE)
VkFormat fmt = cmd->state.pass->attachments[attachment].format;
tu_cs_emit_pkt4(cs, REG_A6XX_RB_BLIT_DST_INFO, 1);
- tu_cs_emit(cs, A6XX_RB_BLIT_DST_INFO_COLOR_FORMAT(tu6_format_gmem(fmt)));
+ tu_cs_emit(cs, A6XX_RB_BLIT_DST_INFO_COLOR_FORMAT(tu6_base_format(fmt)));
tu_cs_emit_pkt4(cs, REG_A6XX_RB_BLIT_INFO, 1);
tu_cs_emit(cs, A6XX_RB_BLIT_INFO_GMEM | A6XX_RB_BLIT_INFO_CLEAR_MASK(component_mask));
{
enum a6xx_format fmt : 8;
enum a3xx_color_swap swap : 8;
+ enum a6xx_tile_mode tile_mode : 8;
enum tu_supported_formats supported : 8;
};
-struct tu_native_format tu6_get_native_format(VkFormat format);
struct tu_native_format tu6_format_vtx(VkFormat format);
-enum a6xx_format tu6_format_gmem(VkFormat format);
-struct tu_native_format tu6_format_color(VkFormat format, bool tiled);
-struct tu_native_format tu6_format_texture(VkFormat format, bool tiled);
+struct tu_native_format tu6_format_color(VkFormat format, enum a6xx_tile_mode tile_mode);
+struct tu_native_format tu6_format_texture(VkFormat format, enum a6xx_tile_mode tile_mode);
+
+static inline enum a6xx_format
+tu6_base_format(VkFormat format)
+{
+ /* note: tu6_format_color doesn't care about tiling for .fmt field */
+ return tu6_format_color(format, TILE6_LINEAR).fmt;
+}
void
tu_pack_clear_value(const VkClearValue *val,
enum a3xx_msaa_samples
tu_msaa_samples(uint32_t samples);
+static inline struct tu_native_format
+tu6_format_image(struct tu_image *image, VkFormat format, uint32_t level)
+{
+ struct tu_native_format fmt =
+ tu6_format_color(format, image->layout.tile_mode);
+ fmt.tile_mode = tu6_get_image_tile_mode(image, level);
+ return fmt;
+}
+
+static inline struct tu_native_format
+tu6_format_image_src(struct tu_image *image, VkFormat format, uint32_t level)
+{
+ struct tu_native_format fmt =
+ tu6_format_texture(format, image->layout.tile_mode);
+ fmt.tile_mode = tu6_get_image_tile_mode(image, level);
+ return fmt;
+}
+
struct tu_image_view
{
struct tu_image *image; /**< VkImageViewCreateInfo::image */