Mesa (staging/20.0): etnaviv: retarget transfer to render resource when necessary

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu May 28 18:58:03 UTC 2020


Module: Mesa
Branch: staging/20.0
Commit: b1a5ca11af43ca4d16d2094e536bede52240aaab
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b1a5ca11af43ca4d16d2094e536bede52240aaab

Author: Lucas Stach <l.stach at pengutronix.de>
Date:   Thu May 14 12:59:01 2020 +0200

etnaviv: retarget transfer to render resource when necessary

If we have a separate render resource, it may contain more up-to-date
data than what is available in the base resource, so we need to retarget
the transfer to this resource. As the most likely reason for the
existence of the render resource is a multi-tiled render layout we need
to allow this transfer to go through the resolve/blit copy path, as we
can't de-/tile those layouts in software.

Fixes: b96277653033 (etnaviv: rework compatible render base)
Signed-off-by: Lucas Stach <l.stach at pengutronix.de>
Reviewed-by: Jonathan Marek <jonathan at marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5051>
(cherry picked from commit 9d1821adf0bc51958becf116d6df5c65514d58b6)

---

 .pick_status.json                              |  2 +-
 src/gallium/drivers/etnaviv/etnaviv_transfer.c | 13 ++++++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 18c0b8fc774..4679db8ed75 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -382,7 +382,7 @@
         "description": "etnaviv: retarget transfer to render resource when necessary",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "b9627765303356328c409cd59bef43d15f4eafcf"
     },
diff --git a/src/gallium/drivers/etnaviv/etnaviv_transfer.c b/src/gallium/drivers/etnaviv/etnaviv_transfer.c
index 0115c5eeb7b..b4f30f12c0c 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_transfer.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_transfer.c
@@ -240,6 +240,17 @@ etna_transfer_map(struct pipe_context *pctx, struct pipe_resource *prsc,
 
    assert(level <= prsc->last_level);
 
+   /* This one is a little tricky: if we have a separate render resource, which
+    * is newer than the base resource we want the transfer to target this one,
+    * to get the most up-to-date content, but only if we don't have a texture
+    * target of the same age, as transfering in/out of the texture target is
+    * generally preferred for the reasons listed below */
+   if (rsc->render && etna_resource_newer(etna_resource(rsc->render), rsc) &&
+       (!rsc->texture || etna_resource_newer(etna_resource(rsc->render),
+                                             etna_resource(rsc->texture)))) {
+      rsc = etna_resource(rsc->render);
+   }
+
    if (rsc->texture && !etna_resource_newer(rsc, etna_resource(rsc->texture))) {
       /* We have a texture resource which is the same age or newer than the
        * render resource. Use the texture resource, which avoids bouncing
@@ -302,7 +313,7 @@ etna_transfer_map(struct pipe_context *pctx, struct pipe_resource *prsc,
       }
 
       if (!(usage & PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE))
-         etna_copy_resource_box(pctx, trans->rsc, prsc, level, &ptrans->box);
+         etna_copy_resource_box(pctx, trans->rsc, &rsc->base, level, &ptrans->box);
 
       /* Switch to using the temporary resource instead */
       rsc = etna_resource(trans->rsc);



More information about the mesa-commit mailing list