mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 09:28:07 +02:00
turnip: msm: clean up iova on error path
Fixes:e23c4fbd9b("tu: Switch to userspace iova allocations if kernel supports it") Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org> Reviewed-by: Danylo Piliaiev <dpiliaiev@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29173> (cherry picked from commit3909803849)
This commit is contained in:
parent
028dc8957f
commit
74802851d2
2 changed files with 9 additions and 1 deletions
|
|
@ -4314,7 +4314,7 @@
|
|||
"description": "turnip: msm: clean up iova on error path",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "e23c4fbd9b6b95537ab00d19a034eaffe5fe86b0",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -386,6 +386,9 @@ msm_allocate_userspace_iova(struct tu_device *dev,
|
|||
int ret =
|
||||
drmCommandWriteRead(dev->fd, DRM_MSM_GEM_INFO, &req, sizeof(req));
|
||||
if (ret < 0) {
|
||||
mtx_lock(&dev->vma_mutex);
|
||||
util_vma_heap_free(&dev->vma, *iova, size);
|
||||
mtx_unlock(&dev->vma_mutex);
|
||||
mesa_loge("MSM_INFO_SET_IOVA failed! %d (%s)", ret, strerror(errno));
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
|
@ -445,6 +448,11 @@ tu_bo_init(struct tu_device *dev,
|
|||
if (!new_ptr) {
|
||||
dev->bo_count--;
|
||||
mtx_unlock(&dev->bo_mutex);
|
||||
if (dev->physical_device->has_set_iova) {
|
||||
mtx_lock(&dev->vma_mutex);
|
||||
util_vma_heap_free(&dev->vma, iova, size);
|
||||
mtx_unlock(&dev->vma_mutex);
|
||||
}
|
||||
tu_gem_close(dev, gem_handle);
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue