sfmt = fd5_pipe2color(info->src.format);
dfmt = fd5_pipe2color(info->dst.format);
- stile = fd_resource_level_linear(info->src.resource, info->src.level) ?
- TILE5_LINEAR : src->tile_mode;
- dtile = fd_resource_level_linear(info->dst.resource, info->dst.level) ?
- TILE5_LINEAR : dst->tile_mode;
+ stile = fd_resource_tile_mode(info->src.resource, info->src.level);
+ dtile = fd_resource_tile_mode(info->dst.resource, info->dst.level);
sswap = fd5_pipe2swap(info->src.format);
dswap = fd5_pipe2swap(info->dst.format);
stride = slice->pitch * rsc->cpp;
size = slice->size0;
- if (!fd_resource_level_linear(psurf->texture, psurf->u.tex.level))
- tile_mode = rsc->tile_mode;
+ tile_mode = fd_resource_tile_mode(psurf->texture, psurf->u.tex.level);
}
}
OUT_RING(ring, 0x00000000); /* RB_BLIT_FLAG_DST_PITCH */
OUT_RING(ring, 0x00000000); /* RB_BLIT_FLAG_DST_ARRAY_PITCH */
- tiled = rsc->tile_mode &&
- !fd_resource_level_linear(psurf->texture, psurf->u.tex.level);
+ tiled = fd_resource_tile_mode(psurf->texture, psurf->u.tex.level);
OUT_PKT4(ring, REG_A5XX_RB_RESOLVE_CNTL_3, 5);
OUT_RING(ring, 0x00000004 | /* XXX RB_RESOLVE_CNTL_3 */
for (level = 0; level <= prsc->last_level; level++) {
struct fd_resource_slice *slice = fd_resource_slice(rsc, level);
- bool linear_level = fd_resource_level_linear(prsc, level);
uint32_t aligned_height = height;
uint32_t blocks;
- if (rsc->tile_mode && !linear_level) {
+ if (fd_resource_tile_mode(prsc, level)) {
pitchalign = tile_alignment[rsc->cpp].pitchalign;
aligned_height = align(aligned_height, heightalign);
} else {
int blockheight = util_format_get_blockheight(info->src.format);
int nelements;
- stile = fd_resource_level_linear(info->src.resource, info->src.level) ?
- TILE6_LINEAR : src->tile_mode;
- dtile = fd_resource_level_linear(info->dst.resource, info->dst.level) ?
- TILE6_LINEAR : dst->tile_mode;
+ stile = fd_resource_tile_mode(info->src.resource, info->src.level);
+ dtile = fd_resource_tile_mode(info->dst.resource, info->dst.level);
sswap = stile ? WZYX : fd6_pipe2swap(info->src.format);
dswap = dtile ? WZYX : fd6_pipe2swap(info->dst.format);
stride = slice->pitch * rsc->cpp * pfb->samples;
swap = rsc->tile_mode ? WZYX : fd6_pipe2swap(pformat);
- if (rsc->tile_mode &&
- fd_resource_level_linear(psurf->texture, psurf->u.tex.level))
- tile_mode = TILE6_LINEAR;
- else
- tile_mode = rsc->tile_mode;
+ tile_mode = fd_resource_tile_mode(psurf->texture, psurf->u.tex.level);
if (psurf->u.tex.first_layer < psurf->u.tex.last_layer) {
layered = true;
enum a3xx_color_swap swap = rsc->tile_mode ? WZYX : fd6_pipe2swap(pfmt);
enum a3xx_msaa_samples samples =
fd_msaa_samples(rsc->base.nr_samples);
- uint32_t tile_mode;
-
- if (rsc->tile_mode &&
- fd_resource_level_linear(&rsc->base, psurf->u.tex.level))
- tile_mode = TILE6_LINEAR;
- else
- tile_mode = rsc->tile_mode;
+ uint32_t tile_mode = fd_resource_tile_mode(&rsc->base, psurf->u.tex.level);
OUT_PKT4(ring, REG_A6XX_RB_BLIT_DST_INFO, 5);
OUT_RING(ring,
static void emit_image_ssbo(struct fd_ringbuffer *ring, struct fd6_image *img)
{
struct fd_resource *rsc = fd_resource(img->prsc);
- enum a6xx_tile_mode tile_mode = TILE6_LINEAR;
+ enum a6xx_tile_mode tile_mode = fd_resource_tile_mode(img->prsc, img->level);
bool ubwc_enabled = fd_resource_ubwc_enabled(rsc, img->level);
- if (rsc->tile_mode && !fd_resource_level_linear(img->prsc, img->level)) {
- tile_mode = rsc->tile_mode;
- }
-
OUT_RING(ring, A6XX_IBO_0_FMT(img->fmt) |
A6XX_IBO_0_TILE_MODE(tile_mode));
OUT_RING(ring, A6XX_IBO_1_WIDTH(img->width) |
for (level = 0; level <= prsc->last_level; level++) {
struct fd_resource_slice *slice = fd_resource_slice(rsc, level);
- bool linear_level = fd_resource_level_linear(prsc, level);
+ uint32_t tile_mode = fd_resource_tile_mode(prsc, level);
uint32_t width, height;
/* tiled levels of 3D textures are rounded up to PoT dimensions: */
- if ((prsc->target == PIPE_TEXTURE_3D) && rsc->tile_mode && !linear_level) {
+ if ((prsc->target == PIPE_TEXTURE_3D) && tile_mode) {
width = twidth;
height = theight;
} else {
uint32_t aligned_height = height;
uint32_t blocks;
- if (rsc->tile_mode && !linear_level) {
+ if (tile_mode) {
pitchalign = tile_alignment[ta].pitchalign;
aligned_height = align(aligned_height,
tile_alignment[ta].heightalign);
return false;
}
+static inline uint32_t
+fd_resource_tile_mode(struct pipe_resource *prsc, int level)
+{
+ struct fd_resource *rsc = fd_resource(prsc);
+ if (rsc->tile_mode && fd_resource_level_linear(&rsc->base, level))
+ return 0; /* linear */
+ else
+ return rsc->tile_mode;
+}
+
static inline bool
fd_resource_ubwc_enabled(struct fd_resource *rsc, int level)
{
- return rsc->ubwc_size && rsc->tile_mode &&
- !fd_resource_level_linear(&rsc->base, level);
+ return rsc->ubwc_size && fd_resource_tile_mode(&rsc->base, level);
}
/* access # of samples, with 0 normalized to 1 (which is what we care about