panfrost: Extract afbc_stride_blocks helper
Let's keep all the AFBC computations inside the layout code, to keep pan_cs dumb. This helper will need some extension for tiled AFBC. Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16697>
This commit is contained in:
parent
9773ed1dc7
commit
d8a4c9b505
|
@ -206,8 +206,7 @@ pan_prepare_zs(const struct pan_fb_info *fb,
|
||||||
#if PAN_ARCH >= 6
|
#if PAN_ARCH >= 6
|
||||||
const struct pan_image_slice_layout *slice = &zs->image->layout.slices[level];
|
const struct pan_image_slice_layout *slice = &zs->image->layout.slices[level];
|
||||||
|
|
||||||
ext->zs_afbc_row_stride = slice->row_stride /
|
ext->zs_afbc_row_stride = pan_afbc_stride_blocks(slice->row_stride);
|
||||||
AFBC_HEADER_BYTES_PER_TILE;
|
|
||||||
#else
|
#else
|
||||||
ext->zs_block_format = MALI_BLOCK_FORMAT_AFBC;
|
ext->zs_block_format = MALI_BLOCK_FORMAT_AFBC;
|
||||||
ext->zs_afbc_body_size = 0x1000;
|
ext->zs_afbc_body_size = 0x1000;
|
||||||
|
@ -448,8 +447,7 @@ pan_prepare_rt(const struct pan_fb_info *fb, unsigned idx,
|
||||||
const struct pan_image_slice_layout *slice = &rt->image->layout.slices[level];
|
const struct pan_image_slice_layout *slice = &rt->image->layout.slices[level];
|
||||||
|
|
||||||
#if PAN_ARCH >= 6
|
#if PAN_ARCH >= 6
|
||||||
cfg->afbc.row_stride = slice->row_stride /
|
cfg->afbc.row_stride = pan_afbc_stride_blocks(slice->row_stride);
|
||||||
AFBC_HEADER_BYTES_PER_TILE;
|
|
||||||
cfg->afbc.afbc_wide_block_enable =
|
cfg->afbc.afbc_wide_block_enable =
|
||||||
panfrost_afbc_is_wide(rt->image->layout.modifier);
|
panfrost_afbc_is_wide(rt->image->layout.modifier);
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -130,6 +130,17 @@ panfrost_block_size(uint64_t modifier, enum pipe_format format)
|
||||||
return (struct pan_block_size) { 1, 1 };
|
return (struct pan_block_size) { 1, 1 };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Determine the number of header blocks between header rows. This is equal to
|
||||||
|
* the number of bytes between header rows divided by the bytes per blocks of a
|
||||||
|
* header tile
|
||||||
|
*/
|
||||||
|
uint32_t
|
||||||
|
pan_afbc_stride_blocks(uint32_t row_stride_bytes)
|
||||||
|
{
|
||||||
|
return row_stride_bytes / AFBC_HEADER_BYTES_PER_TILE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Computes sizes for checksumming, which is 8 bytes per 16x16 tile.
|
/* Computes sizes for checksumming, which is 8 bytes per 16x16 tile.
|
||||||
* Checksumming is believed to be a CRC variant (CRC64 based on the size?).
|
* Checksumming is believed to be a CRC variant (CRC64 based on the size?).
|
||||||
* This feature is also known as "transaction elimination". */
|
* This feature is also known as "transaction elimination". */
|
||||||
|
|
|
@ -194,6 +194,8 @@ unsigned panfrost_afbc_superblock_height(uint64_t modifier);
|
||||||
|
|
||||||
unsigned panfrost_afbc_is_wide(uint64_t modifier);
|
unsigned panfrost_afbc_is_wide(uint64_t modifier);
|
||||||
|
|
||||||
|
uint32_t pan_afbc_stride_blocks(uint32_t row_stride_bytes);
|
||||||
|
|
||||||
struct pan_block_size
|
struct pan_block_size
|
||||||
panfrost_block_size(uint64_t modifier, enum pipe_format format);
|
panfrost_block_size(uint64_t modifier, enum pipe_format format);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue