panfrost: Fix AFBC body_size for shared resources

Accidental read-before-write due to incorrect statement ordering. I love
SSA as much as anyone, but not everything is a parallel copy.

Fixes faults in glamor in 21.0 when using GIMP on v5.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Fixes: e8b997e175 ("panfrost: Add AFBC slice.body_size and slice.{row,surface}_stride fields")
Closes: #4389
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10148>
This commit is contained in:
Alyssa Rosenzweig 2021-04-09 19:14:14 -04:00 committed by Marge Bot
parent e52712a653
commit 23b060bba7
2 changed files with 6 additions and 3 deletions

View File

@ -184,6 +184,7 @@ panfrost_mfbd_rt_set_buf(struct pipe_surface *surf,
rt->afbc.chunk_size = 9;
rt->midgard_afbc.sparse = true;
rt->afbc.body_size = slice->afbc.body_size;
assert(rt->afbc.body_size > 0);
}
panfrost_get_afbc_pointers(rsrc, level, first_layer,

View File

@ -127,14 +127,16 @@ panfrost_resource_from_handle(struct pipe_screen *pscreen,
unsigned tile_h =
panfrost_block_dim(whandle->modifier, false, 0);
rsc->layout.slices[0].afbc.body_size =
rsc->layout.slices[0].row_stride *
DIV_ROUND_UP(templat->height0, tile_h);
rsc->layout.slices[0].afbc.header_size =
panfrost_afbc_header_size(templat->width0, templat->height0);
rsc->layout.slices[0].afbc.row_stride =
DIV_ROUND_UP(templat->width0, tile_w) *
AFBC_HEADER_BYTES_PER_TILE;
rsc->layout.slices[0].afbc.body_size =
rsc->layout.slices[0].row_stride *
DIV_ROUND_UP(templat->height0, tile_h);
}
if (dev->ro) {