ubwc_slice->size0 = align(meta_pitch * meta_height, UBWC_PLANE_SIZE_ALIGNMENT);
ubwc_slice->pitch = meta_pitch;
- ubwc_slice->offset = layout->ubwc_size;
- layout->ubwc_size += ubwc_slice->size0;
+ ubwc_slice->offset = layout->ubwc_layer_size;
+ layout->ubwc_layer_size += ubwc_slice->size0;
}
depth = u_minify(depth, 1);
*/
if (ubwc) {
for (uint32_t level = 0; level < mip_levels; level++)
- layout->slices[level].offset += layout->ubwc_size * array_size;
- layout->size += layout->ubwc_size * array_size;
+ layout->slices[level].offset += layout->ubwc_layer_size * array_size;
+ layout->size += layout->ubwc_layer_size * array_size;
}
}
for (uint32_t level = 0; level < layout->slices[level].size0; level++) {
struct fdl_slice *slice = &layout->slices[level];
struct fdl_slice *ubwc_slice = &layout->ubwc_slices[level];
- uint32_t tile_mode = (layout->ubwc_size ?
+ uint32_t tile_mode = (layout->ubwc_layer_size ?
layout->tile_mode : fdl_tile_mode(layout, level));
fprintf(stderr, "%s: %ux%ux%u@%ux%u:\t%2u: stride=%4u, size=%6u,%6u, aligned_height=%3u, offset=0x%x,0x%x, layersz %5u,%5u tiling=%d\n",
slice->size0, ubwc_slice->size0,
slice->size0 / (slice->pitch * layout->cpp),
slice->offset, ubwc_slice->offset,
- layout->layer_size, layout->ubwc_size,
+ layout->layer_size, layout->ubwc_layer_size,
tile_mode);
}
}
struct fdl_slice slices[FDL_MAX_MIP_LEVELS];
struct fdl_slice ubwc_slices[FDL_MAX_MIP_LEVELS];
uint32_t layer_size;
+ uint32_t ubwc_layer_size; /* in bytes */
bool layer_first : 1; /* see above description */
/* Note that for tiled textures, beyond a certain mipmap level (ie.
enum pipe_format format;
uint32_t size; /* Size of the whole image, in bytes. */
-
- uint32_t ubwc_size;
};
static inline uint32_t
/* for now this doesn't do anything clever, but when UBWC is enabled
* for multi layer/level images, it will.
*/
- if (layout->ubwc_size) {
+ if (layout->ubwc_layer_size) {
assert(level == 0);
assert(layer == 0);
}
static inline bool
fdl_ubwc_enabled(const struct fdl_layout *layout, int level)
{
- return layout->ubwc_size && fdl_tile_mode(layout, level);
+ return layout->ubwc_layer_size && fdl_tile_mode(layout, level);
}
void
.samples = tu_msaa_samples(iview->image->samples),
.color_format = format->rb,
.color_swap = format->swap,
- .flags = iview->image->layout.ubwc_size != 0),
+ .flags = iview->image->layout.ubwc_layer_size != 0),
A6XX_RB_BLIT_DST(tu_image_view_base_ref(iview)),
A6XX_RB_BLIT_DST_PITCH(tu_image_stride(iview->image, iview->base_mip)),
A6XX_RB_BLIT_DST_ARRAY_PITCH(iview->image->layout.layer_size));
- if (iview->image->layout.ubwc_size) {
+ if (iview->image->layout.ubwc_layer_size) {
tu_cs_emit_regs(cs,
A6XX_RB_BLIT_FLAG_DST(tu_image_view_ubwc_base_ref(iview)),
A6XX_RB_BLIT_FLAG_DST_PITCH(tu_image_view_ubwc_pitches(iview)));
enum a6xx_tile_mode
tu6_get_image_tile_mode(struct tu_image *image, int level)
{
- if (image_level_linear(image, level, !!image->layout.ubwc_size))
+ if (image_level_linear(image, level, !!image->layout.ubwc_layer_size))
return TILE6_LINEAR;
else
return image->layout.tile_mode;
iview->descriptor[4] = base_addr;
iview->descriptor[5] = (base_addr >> 32) | A6XX_TEX_CONST_5_DEPTH(depth);
- if (image->layout.ubwc_size) {
+ if (image->layout.ubwc_layer_size) {
uint32_t block_width, block_height;
fdl6_get_ubwc_blockwidth(&image->layout,
&block_width, &block_height);
iview->storage_descriptor[4] = base_addr;
iview->storage_descriptor[5] = (base_addr >> 32) | A6XX_IBO_5_DEPTH(depth);
- if (image->layout.ubwc_size) {
+ if (image->layout.ubwc_layer_size) {
iview->storage_descriptor[3] |= A6XX_IBO_3_FLAG | A6XX_IBO_3_UNK27;
iview->storage_descriptor[7] |= ubwc_addr;
iview->storage_descriptor[8] |= ubwc_addr >> 32;
pLayout->arrayPitch = image->layout.layer_size;
pLayout->depthPitch = slice->size0;
- if (image->layout.ubwc_size) {
+ if (image->layout.ubwc_layer_size) {
/* UBWC starts at offset 0 */
pLayout->offset = 0;
/* UBWC scanout won't match what the kernel wants if we have levels/layers */
if (!image->layout.tile_mode)
pProperties->drmFormatModifier = DRM_FORMAT_MOD_LINEAR;
- else if (image->layout.ubwc_size)
+ else if (image->layout.ubwc_layer_size)
pProperties->drmFormatModifier = DRM_FORMAT_MOD_QCOM_COMPRESSED;
else
pProperties->drmFormatModifier = DRM_FORMAT_MOD_INVALID;
static inline VkDeviceSize
tu_image_ubwc_size(struct tu_image *image, int level)
{
- return image->layout.ubwc_size;
+ return image->layout.ubwc_layer_size;
}
static inline uint32_t
OUT_RELOCW(ring, rsc->bo, fd_resource_ubwc_offset(rsc, level, layer), 0, 0);
OUT_RING(ring,
A6XX_RB_MRT_FLAG_BUFFER_PITCH_PITCH(rsc->layout.ubwc_slices[level].pitch) |
- A6XX_RB_MRT_FLAG_BUFFER_PITCH_ARRAY_PITCH(rsc->layout.ubwc_size));
+ A6XX_RB_MRT_FLAG_BUFFER_PITCH_ARRAY_PITCH(rsc->layout.ubwc_layer_size >> 2));
} else {
OUT_RING(ring, 0x00000000); /* RB_MRT_FLAG_BUFFER[i].ADDR_LO */
OUT_RING(ring, 0x00000000); /* RB_MRT_FLAG_BUFFER[i].ADDR_HI */
if (ubwc_enabled) {
struct fdl_slice *ubwc_slice = &rsc->layout.ubwc_slices[img->level];
OUT_RELOC(ring, rsc->bo, img->ubwc_offset, 0, 0);
- OUT_RING(ring, A6XX_TEX_CONST_9_FLAG_BUFFER_ARRAY_PITCH(rsc->layout.ubwc_size));
+ OUT_RING(ring, A6XX_TEX_CONST_9_FLAG_BUFFER_ARRAY_PITCH(rsc->layout.ubwc_layer_size >> 2));
OUT_RING(ring, A6XX_TEX_CONST_10_FLAG_BUFFER_PITCH(ubwc_slice->pitch));
} else {
OUT_RING(ring, 0x00000000); /* texconst7 */
if (ubwc_enabled) {
struct fdl_slice *ubwc_slice = &rsc->layout.ubwc_slices[img->level];
OUT_RELOCW(ring, rsc->bo, img->ubwc_offset, 0, 0);
- OUT_RING(ring, A6XX_IBO_9_FLAG_BUFFER_ARRAY_PITCH(rsc->layout.ubwc_size));
+ OUT_RING(ring, A6XX_IBO_9_FLAG_BUFFER_ARRAY_PITCH(rsc->layout.ubwc_layer_size >> 2));
OUT_RING(ring, A6XX_IBO_10_FLAG_BUFFER_PITCH(ubwc_slice->pitch));
} else {
OUT_RING(ring, 0x00000000);
rsc->layout.ubwc_slices[0].offset = 0;
rsc->layout.ubwc_slices[0].pitch = meta_stride;
- rsc->layout.ubwc_size = meta_size >> 2; /* in dwords??? */
+ rsc->layout.ubwc_layer_size = meta_size;
rsc->layout.tile_mode = TILE6_3;
return meta_size;
fd6_validate_format(struct fd_context *ctx, struct fd_resource *rsc,
enum pipe_format format)
{
- if (!rsc->layout.ubwc_size)
+ if (!rsc->layout.ubwc_layer_size)
return;
if (ok_ubwc_format(format))
cso->swizzle_b, cso->swizzle_a);
if (so->ubwc_enabled) {
- so->texconst9 |= A6XX_TEX_CONST_9_FLAG_BUFFER_ARRAY_PITCH(rsc->layout.ubwc_size);
+ so->texconst9 |= A6XX_TEX_CONST_9_FLAG_BUFFER_ARRAY_PITCH(rsc->layout.ubwc_layer_size >> 2);
so->texconst10 |= A6XX_TEX_CONST_10_FLAG_BUFFER_PITCH(rsc->layout.ubwc_slices[lvl].pitch);
}
swap(rsc->layout.slices[level], shadow->layout.slices[level]);
swap(rsc->layout.ubwc_slices[level], shadow->layout.ubwc_slices[level]);
}
- swap(rsc->layout.ubwc_size, shadow->layout.ubwc_size);
+ swap(rsc->layout.ubwc_layer_size, shadow->layout.ubwc_layer_size);
rsc->seqno = p_atomic_inc_return(&ctx->screen->rsc_seqno);
/* at this point, the newly created shadow buffer is not referenced
if (!rsc->layout.tile_mode)
return DRM_FORMAT_MOD_LINEAR;
- if (rsc->layout.ubwc_size)
+ if (rsc->layout.ubwc_layer_size)
return DRM_FORMAT_MOD_QCOM_COMPRESSED;
/* TODO invent a modifier for tiled but not UBWC buffers: */