Mesa (master): radeons: only force staging uploads for VRAM when all VRAM is not visible

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Dec 9 15:52:01 UTC 2020


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

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Sun Dec  6 14:01:15 2020 -0500

radeons: only force staging uploads for VRAM when all VRAM is not visible

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

---

 src/gallium/drivers/radeonsi/si_buffer.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_buffer.c b/src/gallium/drivers/radeonsi/si_buffer.c
index cfdabf241ee..66ca3dcb64c 100644
--- a/src/gallium/drivers/radeonsi/si_buffer.c
+++ b/src/gallium/drivers/radeonsi/si_buffer.c
@@ -149,18 +149,20 @@ void si_init_resource_fields(struct si_screen *sscreen, struct si_resource *res,
    if (res->domains & RADEON_DOMAIN_VRAM) {
       res->vram_usage = size;
 
-      /* We don't want to evict buffers from VRAM by mapping them for CPU access,
-       * because they might never be moved back again. If a buffer is large enough,
-       * upload data by copying from a temporary GTT buffer. 8K might not seem much,
-       * but there can be 100000 buffers.
-       *
-       * This tweak improves performance for viewperf.
-       */
-      const unsigned min_size = 8196; /* tuned to minimize mapped VRAM */
-      const unsigned max_staging_uploads = 1; /* number of uploads before mapping directly */
+      if (!sscreen->info.all_vram_visible) {
+         /* We don't want to evict buffers from VRAM by mapping them for CPU access,
+          * because they might never be moved back again. If a buffer is large enough,
+          * upload data by copying from a temporary GTT buffer. 8K might not seem much,
+          * but there can be 100000 buffers.
+          *
+          * This tweak improves performance for viewperf.
+          */
+         const unsigned min_size = 8196; /* tuned to minimize mapped VRAM */
+         const unsigned max_staging_uploads = 1; /* number of uploads before mapping directly */
 
-      res->max_forced_staging_uploads = res->b.max_forced_staging_uploads =
-         sscreen->info.has_dedicated_vram && size >= min_size ? max_staging_uploads : 0;
+         res->max_forced_staging_uploads = res->b.max_forced_staging_uploads =
+            sscreen->info.has_dedicated_vram && size >= min_size ? max_staging_uploads : 0;
+      }
    } else if (res->domains & RADEON_DOMAIN_GTT) {
       res->gart_usage = size;
    }



More information about the mesa-commit mailing list