Module: Mesa
Branch: main
Commit: bee2a8465774271b814dd7678397f7208a55fe08
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bee2a8465774271b814dd7678397f7208a55fe08

Author: Lucas Stach <[email protected]>
Date:   Fri Jul 14 18:50:46 2023 +0200

etnaviv: move buffer range tracking into the PIPE_MAP_WRITE clause

Move the valid buffer range tracking next to all the other things we
do on write mapping.

Signed-off-by: Lucas Stach <[email protected]>
Reviewed-by: Christian Gmeiner <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24164>

---

 src/gallium/drivers/etnaviv/etnaviv_transfer.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_transfer.c 
b/src/gallium/drivers/etnaviv/etnaviv_transfer.c
index d6b9e25be19..2d0054e6eb7 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_transfer.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_transfer.c
@@ -167,6 +167,10 @@ etna_transfer_unmap(struct pipe_context *pctx, struct 
pipe_transfer *ptrans)
          FREE(trans->staging);
       }
 
+      if (ptrans->resource->target == PIPE_BUFFER)
+         util_range_add(&rsc->base, &rsc->valid_buffer_range,
+                        ptrans->box.x, ptrans->box.x + ptrans->box.width);
+
       etna_resource_level_ts_mark_invalid(res_level);
       etna_resource_level_mark_changed(res_level);
 
@@ -186,14 +190,6 @@ etna_transfer_unmap(struct pipe_context *pctx, struct 
pipe_transfer *ptrans)
    if (!trans->rsc && !(ptrans->usage & PIPE_MAP_UNSYNCHRONIZED))
       etna_bo_cpu_fini(rsc->bo);
 
-   if ((ptrans->resource->target == PIPE_BUFFER) &&
-       (ptrans->usage & PIPE_MAP_WRITE)) {
-      util_range_add(&rsc->base,
-                     &rsc->valid_buffer_range,
-                     ptrans->box.x,
-                     ptrans->box.x + ptrans->box.width);
-      }
-
    pipe_resource_reference(&trans->rsc, NULL);
    pipe_resource_reference(&ptrans->resource, NULL);
    slab_free(&ctx->transfer_pool, trans);

Reply via email to