mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-01 03:48:06 +02:00
vulkan/wsi: Fix prime blits to use system memory for the destination
The intention here was to pass VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT to select_memory_types() when requesting device local memory, or simply pass 0 for the prime blit destination which should be in system memory. Unfortunately, that meant we did (type.propertyFlags & 0) == 0 which was vacuously true, causing us to not filter out device local types. Fixes hybrid display of Vulkan apps on Intel TGL+DG1 systems. Tested-by: Luis Felipe Strano Moraes <luis.strano@intel.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11680>
This commit is contained in:
parent
c656c5f055
commit
469875596a
1 changed files with 7 additions and 7 deletions
|
|
@ -65,12 +65,14 @@ wsi_device_matches_drm_fd(const struct wsi_device *wsi, int drm_fd)
|
||||||
|
|
||||||
static uint32_t
|
static uint32_t
|
||||||
select_memory_type(const struct wsi_device *wsi,
|
select_memory_type(const struct wsi_device *wsi,
|
||||||
VkMemoryPropertyFlags props,
|
bool want_device_local,
|
||||||
uint32_t type_bits)
|
uint32_t type_bits)
|
||||||
{
|
{
|
||||||
for (uint32_t i = 0; i < wsi->memory_props.memoryTypeCount; i++) {
|
for (uint32_t i = 0; i < wsi->memory_props.memoryTypeCount; i++) {
|
||||||
const VkMemoryType type = wsi->memory_props.memoryTypes[i];
|
const VkMemoryType type = wsi->memory_props.memoryTypes[i];
|
||||||
if ((type_bits & (1 << i)) && (type.propertyFlags & props) == props)
|
bool local = type.propertyFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
|
||||||
|
|
||||||
|
if ((type_bits & (1 << i)) && local == want_device_local)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -305,8 +307,7 @@ wsi_create_native_image(const struct wsi_swapchain *chain,
|
||||||
.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
|
||||||
.pNext = &memory_dedicated_info,
|
.pNext = &memory_dedicated_info,
|
||||||
.allocationSize = reqs.size,
|
.allocationSize = reqs.size,
|
||||||
.memoryTypeIndex = select_memory_type(wsi, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
|
.memoryTypeIndex = select_memory_type(wsi, true, reqs.memoryTypeBits),
|
||||||
reqs.memoryTypeBits),
|
|
||||||
};
|
};
|
||||||
result = wsi->AllocateMemory(chain->device, &memory_info,
|
result = wsi->AllocateMemory(chain->device, &memory_info,
|
||||||
&chain->alloc, &image->memory);
|
&chain->alloc, &image->memory);
|
||||||
|
|
@ -477,7 +478,7 @@ wsi_create_prime_image(const struct wsi_swapchain *chain,
|
||||||
.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
|
||||||
.pNext = &prime_memory_dedicated_info,
|
.pNext = &prime_memory_dedicated_info,
|
||||||
.allocationSize = linear_size,
|
.allocationSize = linear_size,
|
||||||
.memoryTypeIndex = select_memory_type(wsi, 0, reqs.memoryTypeBits),
|
.memoryTypeIndex = select_memory_type(wsi, false, reqs.memoryTypeBits),
|
||||||
};
|
};
|
||||||
result = wsi->AllocateMemory(chain->device, &prime_memory_info,
|
result = wsi->AllocateMemory(chain->device, &prime_memory_info,
|
||||||
&chain->alloc, &image->prime.memory);
|
&chain->alloc, &image->prime.memory);
|
||||||
|
|
@ -531,8 +532,7 @@ wsi_create_prime_image(const struct wsi_swapchain *chain,
|
||||||
.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
|
||||||
.pNext = &memory_dedicated_info,
|
.pNext = &memory_dedicated_info,
|
||||||
.allocationSize = reqs.size,
|
.allocationSize = reqs.size,
|
||||||
.memoryTypeIndex = select_memory_type(wsi, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
|
.memoryTypeIndex = select_memory_type(wsi, true, reqs.memoryTypeBits),
|
||||||
reqs.memoryTypeBits),
|
|
||||||
};
|
};
|
||||||
result = wsi->AllocateMemory(chain->device, &memory_info,
|
result = wsi->AllocateMemory(chain->device, &memory_info,
|
||||||
&chain->alloc, &image->memory);
|
&chain->alloc, &image->memory);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue