This is a little refactor in preparation for UBWC mipmapping support.
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
*/
struct fdl_layout {
struct fdl_slice slices[MAX_MIP_LEVELS];
+ struct fdl_slice ubwc_slices[MAX_MIP_LEVELS];
uint32_t layer_size;
bool layer_first : 1; /* see above description */
uint32_t width0, height0, depth0;
- /* UBWC specific fields: */
- uint32_t ubwc_offset; /* offset to UBWC meta data */
- uint32_t ubwc_pitch;
uint32_t ubwc_size;
};
debug_assert(level == 0);
debug_assert(layer == 0);
}
- return layout->ubwc_offset;
+ return layout->ubwc_slices[0].offset;
}
static inline bool
if (fd_resource_ubwc_enabled(rsc, level)) {
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_pitch) |
+ 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));
} else {
OUT_RING(ring, 0x00000000); /* RB_MRT_FLAG_BUFFER[i].ADDR_LO */
OUT_RING(ring, 0x00000000); /* texconst6 */
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_10_FLAG_BUFFER_PITCH(rsc->layout.ubwc_pitch));
+ OUT_RING(ring, A6XX_TEX_CONST_10_FLAG_BUFFER_PITCH(ubwc_slice->pitch));
} else {
OUT_RING(ring, 0x00000000); /* texconst7 */
OUT_RING(ring, 0x00000000); /* texconst8 */
OUT_RING(ring, 0x00000000);
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_10_FLAG_BUFFER_PITCH(rsc->layout.ubwc_pitch));
+ OUT_RING(ring, A6XX_IBO_10_FLAG_BUFFER_PITCH(ubwc_slice->pitch));
} else {
OUT_RING(ring, 0x00000000);
OUT_RING(ring, 0x00000000);
slice->offset += meta_size;
}
- rsc->layout.ubwc_offset = 0;
- rsc->layout.ubwc_pitch = meta_stride;
+ 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.tile_mode = TILE6_3;
if (so->ubwc_enabled) {
so->texconst9 |= A6XX_TEX_CONST_9_FLAG_BUFFER_ARRAY_PITCH(rsc->layout.ubwc_size);
- so->texconst10 |= A6XX_TEX_CONST_10_FLAG_BUFFER_PITCH(rsc->layout.ubwc_pitch);
+ so->texconst10 |= A6XX_TEX_CONST_10_FLAG_BUFFER_PITCH(rsc->layout.ubwc_slices[lvl].pitch);
}
so->texconst2 |= A6XX_TEX_CONST_2_TYPE(fd6_tex_type(cso->target));
/* TODO valid_buffer_range?? */
swap(rsc->bo, shadow->bo);
swap(rsc->write_batch, shadow->write_batch);
- for (int level = 0; level <= prsc->last_level; level++)
+ for (int level = 0; level <= prsc->last_level; level++) {
swap(rsc->layout.slices[level], shadow->layout.slices[level]);
- swap(rsc->layout.ubwc_offset, shadow->layout.ubwc_offset);
- swap(rsc->layout.ubwc_pitch, shadow->layout.ubwc_pitch);
+ swap(rsc->layout.ubwc_slices[level], shadow->layout.ubwc_slices[level]);
+ }
swap(rsc->layout.ubwc_size, shadow->layout.ubwc_size);
rsc->seqno = p_atomic_inc_return(&ctx->screen->rsc_seqno);