hasvk: Add extra memory types for hasvk driver instead of a single one
authorIllia Polishchuk <illia.a.polishchuk@globallogic.com>
Mon, 16 Jan 2023 07:36:36 +0000 (09:36 +0200)
committerMarge Bot <emma+marge@anholt.net>
Tue, 17 Jan 2023 10:48:20 +0000 (10:48 +0000)
Replicates a fix from Anv.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: Illia Polishchuk <illia.a.polishchuk@globallogic.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7360
Tested-by: Matti Hämäläinen <ccr@tnsp.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20720>

src/intel/vulkan_hasvk/anv_device.c

index a530ed6..500c96b 100644 (file)
@@ -403,14 +403,23 @@ anv_physical_device_init_heaps(struct anv_physical_device *device, int fd)
 
       /* Big core GPUs share LLC with the CPU and thus one memory type can be
        * both cached and coherent at the same time.
+       *
+       * But some game engines can't handle single type well
+       * https://gitlab.freedesktop.org/mesa/mesa/-/issues/7360#note_1719438
+       *
+       * And Intel on Windows uses 3 types so it's better to add extra one here
        */
-      device->memory.type_count = 1;
+      device->memory.type_count = 2;
       device->memory.types[0] = (struct anv_memory_type) {
-         .propertyFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT |
-                          VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
-                          VK_MEMORY_PROPERTY_HOST_COHERENT_BIT |
-                          VK_MEMORY_PROPERTY_HOST_CACHED_BIT,
-         .heapIndex = 0,
+          .propertyFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
+          .heapIndex = 0,
+      };
+      device->memory.types[1] = (struct anv_memory_type) {
+          .propertyFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT |
+                           VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
+                           VK_MEMORY_PROPERTY_HOST_COHERENT_BIT |
+                           VK_MEMORY_PROPERTY_HOST_CACHED_BIT,
+          .heapIndex = 0,
       };
    } else {
       device->memory.heap_count = 1;