pan/crc: Restrict CRC buffer creation to 1st RT mipmap level

Restrict the creation of a CRC buffer for an image to the 1st mipmap
level. At emit_fbd() time, Transation Elimination is only enabled if
CRC is enabled for the selected RT and if its first configured level
is 0.

This was previously enforced at the Gallium driver level but it needs
to be done at the lib level to later support PanVK too.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
This commit is contained in:
Loïc Molinari 2026-02-10 13:04:57 +01:00
parent c4bd6bd590
commit b965adc60f
3 changed files with 5 additions and 4 deletions

View file

@ -830,7 +830,7 @@ panfrost_should_checksum(const struct panfrost_device *dev,
return pres->base.bind & PIPE_BIND_RENDER_TARGET && panfrost_is_2d(pres) &&
bytes_per_pixel <= bytes_per_pixel_max &&
pres->base.last_level == 0 && !(dev->debug & PAN_DBG_NO_CRC);
!(dev->debug & PAN_DBG_NO_CRC);
}
static bool

View file

@ -146,7 +146,8 @@ pan_image_view_has_crc(const struct pan_image_view *iview)
if (!p.image)
return false;
return p.image->props.crc;
/* Only mip level 0 gets a CRC buffer allocated. */
return p.image->props.crc && iview->first_level == 0;
}
static inline struct pan_image_plane_ref

View file

@ -125,8 +125,8 @@ pan_image_layout_init(
layout_constraints.offset_B += slayout->size_B;
/* Add a checksum region if necessary */
if (props->crc) {
/* Add a CRC buffer at level 0 if necessary */
if (l == 0 && props->crc) {
init_slice_crc_info(arch, slayout, mip_extent_px.width,
mip_extent_px.height, layout_constraints.offset_B);
layout_constraints.offset_B += slayout->crc.size_B;