iris: Fix close of exported bos
On commit910e659e31("iris: Add function to close gem bos") I used iris_bo_close() to close exported bos with the wrong drm_fd. Causing piglit ext_image_dma_buf_import.ext_image_dma_buf_import* tests to crash during tear-down. So here adding iris_bufmgr_bo_close() that will close bos that belongs to bufmgr->fd and changing the parameters of iris_bo_close() to close the bo of given fd. Fixes:910e659e31("iris: Add function to close gem bos") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8836 Signed-off-by: José Roberto de Souza <jose.souza@intel.com> Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22501>
This commit is contained in:
committed by
Marge Bot
parent
b30a75a195
commit
670d4a2f71
@@ -1165,12 +1165,18 @@ err_free:
|
||||
}
|
||||
|
||||
static int
|
||||
iris_bo_close(struct iris_bufmgr *bufmgr, uint32_t gem_handle)
|
||||
iris_bo_close(int fd, uint32_t gem_handle)
|
||||
{
|
||||
struct drm_gem_close close = {
|
||||
.handle = gem_handle,
|
||||
};
|
||||
return intel_ioctl(bufmgr->fd, DRM_IOCTL_GEM_CLOSE, &close);
|
||||
return intel_ioctl(fd, DRM_IOCTL_GEM_CLOSE, &close);
|
||||
}
|
||||
|
||||
static int
|
||||
iris_bufmgr_bo_close(struct iris_bufmgr *bufmgr, uint32_t gem_handle)
|
||||
{
|
||||
return iris_bo_close(bufmgr->fd, gem_handle);
|
||||
}
|
||||
|
||||
struct iris_bo *
|
||||
@@ -1225,7 +1231,7 @@ iris_bo_create_userptr(struct iris_bufmgr *bufmgr, const char *name,
|
||||
return bo;
|
||||
|
||||
err_close:
|
||||
iris_bo_close(bufmgr, bo->gem_handle);
|
||||
iris_bufmgr_bo_close(bufmgr, bo->gem_handle);
|
||||
err_free:
|
||||
free(bo);
|
||||
return NULL;
|
||||
@@ -1272,7 +1278,7 @@ iris_bo_gem_create_from_name(struct iris_bufmgr *bufmgr,
|
||||
|
||||
bo = bo_calloc();
|
||||
if (!bo) {
|
||||
iris_bo_close(bufmgr, open_arg.handle);
|
||||
iris_bufmgr_bo_close(bufmgr, open_arg.handle);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -1334,7 +1340,7 @@ bo_close(struct iris_bo *bo)
|
||||
_mesa_hash_table_remove(bufmgr->handle_table, entry);
|
||||
|
||||
list_for_each_entry_safe(struct bo_export, export, &bo->real.exports, link) {
|
||||
iris_bo_close(bufmgr, export->gem_handle);
|
||||
iris_bo_close(export->drm_fd, export->gem_handle);
|
||||
|
||||
list_del(&export->link);
|
||||
free(export);
|
||||
@@ -1350,7 +1356,7 @@ bo_close(struct iris_bo *bo)
|
||||
DBG("Unable to unbind vm of buf %u\n", bo->gem_handle);
|
||||
|
||||
/* Close this object */
|
||||
if (iris_bo_close(bufmgr, bo->gem_handle) != 0) {
|
||||
if (iris_bufmgr_bo_close(bufmgr, bo->gem_handle) != 0) {
|
||||
DBG("DRM_IOCTL_GEM_CLOSE %d failed (%s): %s\n",
|
||||
bo->gem_handle, bo->name, strerror(errno));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user