mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-09 01:50:12 +01:00
anv: do not map from_host_ptr bos in image_bind_address
Rusticl running on zink might end up creating an 1D image from a host_ptr
and zink might bind it with VK_IMAGE_USAGE_HOST_TRANSFER_BIT_EXT.
That ended up hitting an assert inside anv_device_map_bo.
Cc: mesa-stable
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36701>
(cherry picked from commit 8d8f5558eb)
This commit is contained in:
parent
ef3d8f3cd2
commit
76d3f87af1
2 changed files with 22 additions and 15 deletions
|
|
@ -144,7 +144,7 @@
|
|||
"description": "anv: do not map from_host_ptr bos in image_bind_address",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -1940,7 +1940,7 @@ anv_image_finish(struct anv_image *image)
|
|||
}
|
||||
|
||||
for (uint32_t b = 0; b < ARRAY_SIZE(image->bindings); b++) {
|
||||
if (image->bindings[b].host_map != NULL) {
|
||||
if (image->bindings[b].host_map != NULL && !image->bindings[b].address.bo->from_host_ptr) {
|
||||
anv_device_unmap_bo(device,
|
||||
image->bindings[b].address.bo,
|
||||
image->bindings[b].host_map,
|
||||
|
|
@ -2656,21 +2656,28 @@ anv_image_bind_address(struct anv_device *device,
|
|||
if (image->vk.usage & VK_IMAGE_USAGE_HOST_TRANSFER_BIT_EXT) {
|
||||
uint64_t offset = image->bindings[binding].address.offset +
|
||||
image->bindings[binding].memory_range.offset;
|
||||
uint64_t map_offset, map_size;
|
||||
anv_sanitize_map_params(device, offset,
|
||||
image->bindings[binding].memory_range.size,
|
||||
&map_offset, &map_size);
|
||||
|
||||
VkResult result = anv_device_map_bo(device,
|
||||
image->bindings[binding].address.bo,
|
||||
map_offset, map_size,
|
||||
NULL /* placed_addr */,
|
||||
&image->bindings[binding].host_map);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
if (address.bo->from_host_ptr) {
|
||||
image->bindings[binding].host_map = address.bo->map + address.bo->offset;
|
||||
image->bindings[binding].map_size = address.bo->size;
|
||||
image->bindings[binding].map_delta = 0;
|
||||
} else {
|
||||
uint64_t map_offset, map_size;
|
||||
anv_sanitize_map_params(device, offset,
|
||||
image->bindings[binding].memory_range.size,
|
||||
&map_offset, &map_size);
|
||||
|
||||
image->bindings[binding].map_delta = (offset - map_offset);
|
||||
image->bindings[binding].map_size = map_size;
|
||||
VkResult result = anv_device_map_bo(device,
|
||||
image->bindings[binding].address.bo,
|
||||
map_offset, map_size,
|
||||
NULL /* placed_addr */,
|
||||
&image->bindings[binding].host_map);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
image->bindings[binding].map_delta = (offset - map_offset);
|
||||
image->bindings[binding].map_size = map_size;
|
||||
}
|
||||
}
|
||||
|
||||
ANV_RMV(image_bind, device, image, binding);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue