mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
radv/winsys: check amdgpu_create_bo_from_user_mem() for EINVAL
amdgpu_create_bo_from_user_mem() may fail for multiple reasons. Only return VK_ERROR_INVALID_EXTERNAL_HANDLE if the kernel returned EINVAL, which indicates a bad input parameter. Signed-off-by: Simon Ser <contact@emersion.fr> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24858>
This commit is contained in:
parent
496a17bffe
commit
6c469f9b19
1 changed files with 8 additions and 2 deletions
|
|
@ -602,6 +602,7 @@ radv_amdgpu_winsys_bo_from_ptr(struct radeon_winsys *_ws, void *pointer, uint64_
|
|||
amdgpu_va_handle va_handle;
|
||||
uint64_t vm_alignment;
|
||||
VkResult result = VK_SUCCESS;
|
||||
int ret;
|
||||
|
||||
/* Just be robust for callers that might use NULL-ness for determining if things should be freed.
|
||||
*/
|
||||
|
|
@ -611,8 +612,13 @@ radv_amdgpu_winsys_bo_from_ptr(struct radeon_winsys *_ws, void *pointer, uint64_
|
|||
if (!bo)
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
|
||||
if (amdgpu_create_bo_from_user_mem(ws->dev, pointer, size, &buf_handle)) {
|
||||
result = VK_ERROR_INVALID_EXTERNAL_HANDLE;
|
||||
ret = amdgpu_create_bo_from_user_mem(ws->dev, pointer, size, &buf_handle);
|
||||
if (ret) {
|
||||
if (ret == -EINVAL) {
|
||||
result = VK_ERROR_INVALID_EXTERNAL_HANDLE;
|
||||
} else {
|
||||
result = VK_ERROR_UNKNOWN;
|
||||
}
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue