mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-29 08:00:12 +01:00
iris: Add function to close gem bos
Signed-off-by: José Roberto de Souza <jose.souza@intel.com> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22425>
This commit is contained in:
parent
b1299f42ff
commit
910e659e31
1 changed files with 13 additions and 10 deletions
|
|
@ -1161,12 +1161,20 @@ err_free:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static int
|
||||
iris_bo_close(struct iris_bufmgr *bufmgr, uint32_t gem_handle)
|
||||
{
|
||||
struct drm_gem_close close = {
|
||||
.handle = gem_handle,
|
||||
};
|
||||
return intel_ioctl(bufmgr->fd, DRM_IOCTL_GEM_CLOSE, &close);
|
||||
}
|
||||
|
||||
struct iris_bo *
|
||||
iris_bo_create_userptr(struct iris_bufmgr *bufmgr, const char *name,
|
||||
void *ptr, size_t size,
|
||||
enum iris_memory_zone memzone)
|
||||
{
|
||||
struct drm_gem_close close = { 0, };
|
||||
struct iris_bo *bo;
|
||||
|
||||
bo = bo_calloc();
|
||||
|
|
@ -1214,8 +1222,7 @@ iris_bo_create_userptr(struct iris_bufmgr *bufmgr, const char *name,
|
|||
return bo;
|
||||
|
||||
err_close:
|
||||
close.handle = bo->gem_handle;
|
||||
intel_ioctl(bufmgr->fd, DRM_IOCTL_GEM_CLOSE, &close);
|
||||
iris_bo_close(bufmgr, bo->gem_handle);
|
||||
err_free:
|
||||
free(bo);
|
||||
return NULL;
|
||||
|
|
@ -1262,8 +1269,7 @@ iris_bo_gem_create_from_name(struct iris_bufmgr *bufmgr,
|
|||
|
||||
bo = bo_calloc();
|
||||
if (!bo) {
|
||||
struct drm_gem_close close = { .handle = open_arg.handle, };
|
||||
intel_ioctl(bufmgr->fd, DRM_IOCTL_GEM_CLOSE, &close);
|
||||
iris_bo_close(bufmgr, open_arg.handle);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
|
@ -1325,8 +1331,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) {
|
||||
struct drm_gem_close close = { .handle = export->gem_handle };
|
||||
intel_ioctl(export->drm_fd, DRM_IOCTL_GEM_CLOSE, &close);
|
||||
iris_bo_close(bufmgr, export->gem_handle);
|
||||
|
||||
list_del(&export->link);
|
||||
free(export);
|
||||
|
|
@ -1342,9 +1347,7 @@ bo_close(struct iris_bo *bo)
|
|||
DBG("Unable to unbind vm of buf %u\n", bo->gem_handle);
|
||||
|
||||
/* Close this object */
|
||||
struct drm_gem_close close = { .handle = bo->gem_handle };
|
||||
int ret = intel_ioctl(bufmgr->fd, DRM_IOCTL_GEM_CLOSE, &close);
|
||||
if (ret != 0) {
|
||||
if (iris_bo_close(bufmgr, bo->gem_handle) != 0) {
|
||||
DBG("DRM_IOCTL_GEM_CLOSE %d failed (%s): %s\n",
|
||||
bo->gem_handle, bo->name, strerror(errno));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue