mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 04:58:05 +02:00
lavapipe: do not close import fd on error and amend an error code
The implementation only takes the ownership after a successful import. On import failure, the caller is going to handle the fd. Meanwhile, amend a missing error code on an error path. Fixes:895d3399f7("lavapipe: add support for KHR_external_memory_fd") Reviewed-by: Lucas Fryzek <lfryzek@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36204> (cherry picked from commit160cd3a317)
This commit is contained in:
parent
b3285b1212
commit
f634471a7c
2 changed files with 2 additions and 3 deletions
|
|
@ -2374,7 +2374,7 @@
|
|||
"description": "lavapipe: do not close import fd on error and amend an error code",
|
||||
"nominated": true,
|
||||
"nomination_type": 2,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "895d3399f7fb5cf58aa857fb2b98f23fe89071ba",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -2037,13 +2037,12 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_AllocateMemory(
|
|||
bool dmabuf = import_info->handleType == VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT;
|
||||
uint64_t size;
|
||||
if(!device->pscreen->import_memory_fd(device->pscreen, import_info->fd, &mem->pmem, &size, dmabuf)) {
|
||||
close(import_info->fd);
|
||||
error = VK_ERROR_INVALID_EXTERNAL_HANDLE;
|
||||
goto fail;
|
||||
}
|
||||
if(size < pAllocateInfo->allocationSize) {
|
||||
device->pscreen->free_memory_fd(device->pscreen, mem->pmem);
|
||||
close(import_info->fd);
|
||||
error = VK_ERROR_INVALID_EXTERNAL_HANDLE;
|
||||
goto fail;
|
||||
}
|
||||
if (export_info && export_info->handleTypes == import_info->handleType) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue