ac/surface: copy the CMASK equation to radeon_surf

Only GFX9 is currently supported.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12140>
This commit is contained in:
Samuel Pitoiset 2021-07-29 09:09:57 +02:00 committed by Marge Bot
parent 1f12c3ccc1
commit eedc0b59b7
2 changed files with 27 additions and 0 deletions

View File

@ -1491,6 +1491,28 @@ static void ac_copy_dcc_equation(const struct radeon_info *info,
}
}
static void ac_copy_cmask_equation(const struct radeon_info *info,
ADDR2_COMPUTE_CMASK_INFO_OUTPUT *cmask,
struct gfx9_meta_equation *equation)
{
equation->meta_block_width = cmask->metaBlkWidth;
equation->meta_block_height = cmask->metaBlkHeight;
equation->meta_block_depth = 1;
if (info->chip_class == GFX9) {
assert(cmask->equation.gfx9.num_bits <= ARRAY_SIZE(equation->u.gfx9.bit));
equation->u.gfx9.num_bits = cmask->equation.gfx9.num_bits;
equation->u.gfx9.num_pipe_bits = cmask->equation.gfx9.numPipeBits;
for (unsigned b = 0; b < ARRAY_SIZE(equation->u.gfx9.bit); b++) {
for (unsigned c = 0; c < ARRAY_SIZE(equation->u.gfx9.bit[b].coord); c++) {
equation->u.gfx9.bit[b].coord[c].dim = cmask->equation.gfx9.bit[b].coord[c].dim;
equation->u.gfx9.bit[b].coord[c].ord = cmask->equation.gfx9.bit[b].coord[c].ord;
}
}
}
}
static void ac_copy_htile_equation(const struct radeon_info *info,
ADDR2_COMPUTE_HTILE_INFO_OUTPUT *htile,
struct gfx9_meta_equation *equation)
@ -1907,6 +1929,8 @@ static int gfx9_compute_miptree(struct ac_addrlib *addrlib, const struct radeon_
surf->cmask_height = cout.height;
surf->u.gfx9.color.cmask_level0.offset = meta_mip_info[0].offset;
surf->u.gfx9.color.cmask_level0.size = meta_mip_info[0].sliceSize;
ac_copy_cmask_equation(info, &cout, &surf->u.gfx9.color.cmask_equation);
}
}

View File

@ -287,6 +287,9 @@ struct gfx9_surf_layout {
/* For DCC retiling. */
struct gfx9_meta_equation dcc_equation; /* 2D only */
struct gfx9_meta_equation display_dcc_equation;
/* For FCE compute. */
struct gfx9_meta_equation cmask_equation; /* 2D only */
} color;
/* Z/S */