Mesa (staging/21.3): radv/winsys: fix initializing debug/perftest options if multiple instances

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Feb 20 17:40:40 UTC 2022


Module: Mesa
Branch: staging/21.3
Commit: 88a435835375b6e0248f9ad37dfcb92932d4d770
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=88a435835375b6e0248f9ad37dfcb92932d4d770

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Fri Feb 11 11:17:49 2022 +0100

radv/winsys: fix initializing debug/perftest options if multiple instances

Since the winsys uses refcount, options like RADV_DEBUG_ZERO_VRAM might
have not been initialized if the first instance wasn't created with
application info.

This fixes missing zerovram for vkd3d-proton.

Cc: 21.3 22.0 mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14978>
(cherry picked from commit aa3405e8123324b3d8173c709e6573d86570d99a)

---

 .pick_status.json                                 |  2 +-
 src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index 0f5bb05b274..33477365593 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -2164,7 +2164,7 @@
         "description": "radv/winsys: fix initializing debug/perftest options if multiple instances",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null
     },
diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c
index beb237b21b1..95fd2c03c99 100644
--- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c
+++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c
@@ -207,6 +207,20 @@ radv_amdgpu_winsys_create(int fd, uint64_t debug_flags, uint64_t perftest_flags,
    if (ws) {
       simple_mtx_unlock(&winsys_creation_mutex);
       amdgpu_device_deinitialize(dev);
+
+      /* Check that options don't differ from the existing winsys. */
+      if (((debug_flags & RADV_DEBUG_ALL_BOS) && !ws->debug_all_bos) ||
+          ((debug_flags & RADV_DEBUG_HANG) && !ws->debug_log_bos) ||
+          ((debug_flags & RADV_DEBUG_NO_IBS) && ws->use_ib_bos) ||
+          (perftest_flags != ws->perftest)) {
+         fprintf(stderr, "amdgpu: Found options that differ from the existing winsys.\n");
+         return NULL;
+      }
+
+      /* RADV_DEBUG_ZERO_VRAM is the only option that is allowed to be set again. */
+      if (debug_flags & RADV_DEBUG_ZERO_VRAM)
+         ws->zero_all_vram_allocs = true;
+
       return &ws->base;
    }
 



More information about the mesa-commit mailing list