pan/layout: Fix size_B calculation for AFBC(3D)

Right now the headers are not counted when we calculate the total slice
size of an AFBC(3D) image. Fix that by special-casing size_B
initialization for AFBC.

I couldn't get back to the original commit introducing this mistakes,
so I'm flagging for backport instead of adding a proper Fixes tag.

Backport-to: 25.1
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Tested-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35555>
This commit is contained in:
Boris Brezillon 2025-06-19 10:46:48 +02:00
parent a6ba8019d4
commit 1389a23708
2 changed files with 8 additions and 2 deletions

View file

@ -534,7 +534,13 @@ pan_image_layout_init(
/* Compute AFBC sizes if necessary */
offset_B += slice_full_size_B;
slice->size_B = slice_full_size_B;
/* We can't use slice_full_size_B for AFBC(3D), otherwise the headers are
* not counted. */
if (afbc)
slice->size_B = slice->afbc.body_size_B + slice->afbc.header_size_B;
else
slice->size_B = slice_full_size_B;
/* Add a checksum region if necessary */
if (props->crc) {

View file

@ -357,7 +357,7 @@ TEST(AFBCLayout, Linear3D)
EXPECT_EQ(l.slices[0].afbc.body_size_B, 32768);
EXPECT_EQ(l.slices[0].afbc.surface_stride_B, 64);
EXPECT_EQ(l.slices[0].surface_stride_B, 2048); /* XXX: Not meaningful? */
EXPECT_EQ(l.slices[0].size_B, 32768); /* XXX: Not used by anything and wrong */
EXPECT_EQ(l.slices[0].size_B, 33792); /* XXX: Not used by anything */
}
TEST(AFBCLayout, Tiled16x16)