Module: Mesa
Branch: master
Commit: 741921e2ffa877500c8fb4045702dfb4dae4f16e
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=741921e2ffa877500c8fb4045702dfb4dae4f16e

Author: Boris Brezillon <[email protected]>
Date:   Sat Nov 28 11:22:57 2020 +0100

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: d4f662a25227 ("panfrost: Update the resource layout when doing a tile -> 
linear conversion")
Signed-off-by: Boris Brezillon <[email protected]>
Reviewed-by: Alyssa Rosenzweig <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7821>

---

 src/gallium/drivers/panfrost/pan_resource.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_resource.c 
b/src/gallium/drivers/panfrost/pan_resource.c
index 4727483e44f..02e1bc3796c 100644
--- a/src/gallium/drivers/panfrost/pan_resource.c
+++ b/src/gallium/drivers/panfrost/pan_resource.c
@@ -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,

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to