amd/common: Add retile map size helper.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9042>
This commit is contained in:
@@ -2990,6 +2990,12 @@ uint64_t ac_surface_get_plane_size(const struct radeon_surf *surf,
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t ac_surface_get_retile_map_size(const struct radeon_surf *surf)
|
||||
{
|
||||
return surf->u.gfx9.dcc_retile_num_elements *
|
||||
(surf->u.gfx9.dcc_retile_use_uint16 ? 2 : 4);
|
||||
}
|
||||
|
||||
void ac_surface_print_info(FILE *out, const struct radeon_info *info,
|
||||
const struct radeon_surf *surf)
|
||||
{
|
||||
|
@@ -370,6 +370,7 @@ uint64_t ac_surface_get_plane_stride(enum chip_class chip_class,
|
||||
/* Of the whole miplevel, not an individual layer */
|
||||
uint64_t ac_surface_get_plane_size(const struct radeon_surf *surf,
|
||||
unsigned plane);
|
||||
uint32_t ac_surface_get_retile_map_size(const struct radeon_surf *surf);
|
||||
|
||||
void ac_surface_print_info(FILE *out, const struct radeon_info *info,
|
||||
const struct radeon_surf *surf);
|
||||
|
@@ -648,7 +648,7 @@ void si_retile_dcc(struct si_context *sctx, struct si_texture *tex)
|
||||
|
||||
img[0].format = use_uint16 ? PIPE_FORMAT_R16G16B16A16_UINT : PIPE_FORMAT_R32G32B32A32_UINT;
|
||||
img[0].u.buf.offset = 0;
|
||||
img[0].u.buf.size = num_elements * (use_uint16 ? 2 : 4);
|
||||
img[0].u.buf.size = ac_surface_get_retile_map_size(&tex->surface);
|
||||
|
||||
img[1].format = PIPE_FORMAT_R8_UINT;
|
||||
img[1].u.buf.offset = tex->surface.dcc_offset;
|
||||
|
@@ -1077,9 +1077,7 @@ static struct si_texture *si_texture_create_object(struct pipe_screen *screen,
|
||||
* Use a staging buffer for the upload, because
|
||||
* the buffer backing the texture is unmappable.
|
||||
*/
|
||||
bool use_uint16 = tex->surface.u.gfx9.dcc_retile_use_uint16;
|
||||
unsigned num_elements = tex->surface.u.gfx9.dcc_retile_num_elements;
|
||||
unsigned dcc_retile_map_size = num_elements * (use_uint16 ? 2 : 4);
|
||||
uint32_t dcc_retile_map_size = ac_surface_get_retile_map_size(&tex->surface);
|
||||
|
||||
tex->dcc_retile_buffer = si_aligned_buffer_create(screen,
|
||||
SI_RESOURCE_FLAG_DRIVER_INTERNAL, PIPE_USAGE_DEFAULT,
|
||||
|
Reference in New Issue
Block a user