panfrost: Update the resource layout before calling util_copy_rect()

If we don't do that, the line_stride might be wrong. We also need
to create a new BO if the previous one is too small to hold the
linear version, which can happen with the tile alignment done on
linear+renderable resources.

Suggested-by: Icecream95
Fixes: d4f662a252 ("panfrost: Update the resource layout when doing a tile -> linear conversion")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7821>
This commit is contained in:
Boris Brezillon 2020-11-28 11:22:57 +01:00 committed by Marge Bot
parent 90515f90c8
commit 741921e2ff

View file

@ -1044,6 +1044,15 @@ panfrost_ptr_unmap(struct pipe_context *pctx,
assert(transfer->box.depth == 1);
if (panfrost_should_linear_convert(prsrc, transfer)) {
size_t bo_size;
panfrost_resource_setup(dev, prsrc, &bo_size, DRM_FORMAT_MOD_LINEAR);
if (bo_size > bo->size) {
panfrost_bo_unreference(bo);
bo = prsrc->bo = panfrost_bo_create(dev, bo_size, 0);
assert(bo);
}
util_copy_rect(
bo->ptr.cpu + prsrc->slices[0].offset,
prsrc->base.format,
@ -1054,8 +1063,6 @@ panfrost_ptr_unmap(struct pipe_context *pctx,
trans->map,
transfer->stride,
0, 0);
panfrost_resource_setup(dev, prsrc, NULL, DRM_FORMAT_MOD_LINEAR);
} else {
panfrost_store_tiled_image(
bo->ptr.cpu + prsrc->slices[transfer->level].offset,