nouveau/winsys: Take a reference to BOs found in the cache

Fixes: c370260a8f ("nouveau/winsys: Add dma-buf import support")
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24795>
(cherry picked from commit 19b143b7bc)
This commit is contained in:
Faith Ekstrand 2024-05-09 14:33:16 -05:00 committed by Eric Engestrom
parent ce203e13f7
commit dac5e319b0
2 changed files with 6 additions and 3 deletions

View file

@ -1604,7 +1604,7 @@
"description": "nouveau/winsys: Take a reference to BOs found in the cache",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "c370260a8f15e9be2f43a7d237f438592a09cccd",
"notes": null

View file

@ -269,8 +269,11 @@ nouveau_ws_bo_from_dma_buf_locked(struct nouveau_ws_device *dev, int fd)
struct hash_entry *entry =
_mesa_hash_table_search(dev->bos, (void *)(uintptr_t)handle);
if (entry != NULL)
return entry->data;
if (entry != NULL) {
struct nouveau_ws_bo *bo = entry->data;
nouveau_ws_bo_ref(bo);
return bo;
}
/*
* If we got here, no BO exists for the retrieved handle. If we error