Mesa (master): Revert "gallium/u_upload_mgr: allow use of FLUSH_EXPLICIT with persistent mappings"

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jan 28 00:13:25 UTC 2021


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

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Mon Dec 21 01:27:44 2020 -0500

Revert "gallium/u_upload_mgr: allow use of FLUSH_EXPLICIT with persistent mappings"

It's no longer needed after radeonsi had its SDMA uploads removed.

This reverts commit 54f7545cd7925db9ff78b9dccbff7406dd2ad4a4.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8298>

---

 src/gallium/auxiliary/util/u_upload_mgr.c | 36 +++++++------------------------
 src/gallium/auxiliary/util/u_upload_mgr.h |  4 ----
 2 files changed, 8 insertions(+), 32 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_upload_mgr.c b/src/gallium/auxiliary/util/u_upload_mgr.c
index 6eab49fdab0..1d48cc08e75 100644
--- a/src/gallium/auxiliary/util/u_upload_mgr.c
+++ b/src/gallium/auxiliary/util/u_upload_mgr.c
@@ -54,7 +54,6 @@ struct u_upload_mgr {
    unsigned buffer_size; /* Same as buffer->width0. */
    unsigned offset; /* Aligned offset to the upload buffer, pointing
                      * at the first unused byte. */
-   unsigned flushed_size; /* Size we have flushed by transfer_flush_region. */
 };
 
 
@@ -109,21 +108,10 @@ u_upload_clone(struct pipe_context *pipe, struct u_upload_mgr *upload)
                                                  upload->flags);
    if (!upload->map_persistent && result->map_persistent)
       u_upload_disable_persistent(result);
-   else if (upload->map_persistent &&
-            upload->map_flags & PIPE_MAP_FLUSH_EXPLICIT)
-      u_upload_enable_flush_explicit(result);
 
    return result;
 }
 
-void
-u_upload_enable_flush_explicit(struct u_upload_mgr *upload)
-{
-   assert(upload->map_persistent);
-   upload->map_flags &= ~PIPE_MAP_COHERENT;
-   upload->map_flags |= PIPE_MAP_FLUSH_EXPLICIT;
-}
-
 void
 u_upload_disable_persistent(struct u_upload_mgr *upload)
 {
@@ -135,27 +123,19 @@ u_upload_disable_persistent(struct u_upload_mgr *upload)
 static void
 upload_unmap_internal(struct u_upload_mgr *upload, boolean destroying)
 {
-   if (!upload->transfer)
+   if ((!destroying && upload->map_persistent) || !upload->transfer)
       return;
 
-   if (upload->map_flags & PIPE_MAP_FLUSH_EXPLICIT) {
-      struct pipe_box *box = &upload->transfer->box;
-      unsigned flush_offset = box->x + upload->flushed_size;
+   struct pipe_box *box = &upload->transfer->box;
 
-      if (upload->offset > flush_offset) {
-         pipe_buffer_flush_mapped_range(upload->pipe, upload->transfer,
-                                        flush_offset,
-                                        upload->offset - flush_offset);
-         upload->flushed_size = upload->offset;
-      }
+   if (!upload->map_persistent && (int) upload->offset > box->x) {
+      pipe_buffer_flush_mapped_range(upload->pipe, upload->transfer,
+                                     box->x, upload->offset - box->x);
    }
 
-   if (destroying || !upload->map_persistent) {
-      pipe_transfer_unmap(upload->pipe, upload->transfer);
-      upload->transfer = NULL;
-      upload->map = NULL;
-      upload->flushed_size = 0;
-   }
+   pipe_transfer_unmap(upload->pipe, upload->transfer);
+   upload->transfer = NULL;
+   upload->map = NULL;
 }
 
 
diff --git a/src/gallium/auxiliary/util/u_upload_mgr.h b/src/gallium/auxiliary/util/u_upload_mgr.h
index 6a4a60963fe..edfa0ce5fb1 100644
--- a/src/gallium/auxiliary/util/u_upload_mgr.h
+++ b/src/gallium/auxiliary/util/u_upload_mgr.h
@@ -69,10 +69,6 @@ u_upload_create_default(struct pipe_context *pipe);
 struct u_upload_mgr *
 u_upload_clone(struct pipe_context *pipe, struct u_upload_mgr *upload);
 
-/** Whether to use FLUSH_EXPLICIT with persistent mappings. */
-void
-u_upload_enable_flush_explicit(struct u_upload_mgr *upload);
-
 /** Whether to avoid persistent mappings where available */
 void
 u_upload_disable_persistent(struct u_upload_mgr *upload);



More information about the mesa-commit mailing list