Mesa (staging/21.1): vulkan: allocate host-visible memory for swapchain images

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jul 14 21:53:52 UTC 2021


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

Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date:   Tue Jul 13 15:38:16 2021 +0200

vulkan: allocate host-visible memory for swapchain images

The Vulkan 1.2 specification, section 11.2.12 ("Host Access to Device
Memory Objects") say the following:

> memory must have been created with a memory type that reports
> VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT

Since there's no guarantee that there's any memory that is *both*
device-local *and* host-visible, let's just use the latter requirement.

Fixes: 8af568e4ae7 ("vulkan: implement wsi_win32 backend")
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11848>
(cherry picked from commit e3542b35a8c5980dd4dd43a047ded4a36f89b055)

---

 .pick_status.json                 | 2 +-
 src/vulkan/wsi/wsi_common_win32.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 8d4c1b5ef28..b3ec24916e1 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -256,7 +256,7 @@
         "description": "vulkan: allocate host-visible memory for swapchain images",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "8af568e4ae77332e1cc09031301e559996b81fe9"
     },
diff --git a/src/vulkan/wsi/wsi_common_win32.c b/src/vulkan/wsi/wsi_common_win32.c
index 824cd6b4253..82731f5f9eb 100644
--- a/src/vulkan/wsi/wsi_common_win32.c
+++ b/src/vulkan/wsi/wsi_common_win32.c
@@ -383,7 +383,7 @@ wsi_create_native_image(const struct wsi_swapchain *chain,
       .sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
       .pNext = &memory_dedicated_info,
       .allocationSize = reqs.size,
-      .memoryTypeIndex = select_memory_type(wsi, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
+      .memoryTypeIndex = select_memory_type(wsi, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT,
                                             reqs.memoryTypeBits),
    };
    result = wsi->AllocateMemory(chain->device, &memory_info,



More information about the mesa-commit mailing list