mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-08 19:20: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;
|
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 *
|
struct iris_bo *
|
||||||
iris_bo_create_userptr(struct iris_bufmgr *bufmgr, const char *name,
|
iris_bo_create_userptr(struct iris_bufmgr *bufmgr, const char *name,
|
||||||
void *ptr, size_t size,
|
void *ptr, size_t size,
|
||||||
enum iris_memory_zone memzone)
|
enum iris_memory_zone memzone)
|
||||||
{
|
{
|
||||||
struct drm_gem_close close = { 0, };
|
|
||||||
struct iris_bo *bo;
|
struct iris_bo *bo;
|
||||||
|
|
||||||
bo = bo_calloc();
|
bo = bo_calloc();
|
||||||
|
|
@ -1214,8 +1222,7 @@ iris_bo_create_userptr(struct iris_bufmgr *bufmgr, const char *name,
|
||||||
return bo;
|
return bo;
|
||||||
|
|
||||||
err_close:
|
err_close:
|
||||||
close.handle = bo->gem_handle;
|
iris_bo_close(bufmgr, bo->gem_handle);
|
||||||
intel_ioctl(bufmgr->fd, DRM_IOCTL_GEM_CLOSE, &close);
|
|
||||||
err_free:
|
err_free:
|
||||||
free(bo);
|
free(bo);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -1262,8 +1269,7 @@ iris_bo_gem_create_from_name(struct iris_bufmgr *bufmgr,
|
||||||
|
|
||||||
bo = bo_calloc();
|
bo = bo_calloc();
|
||||||
if (!bo) {
|
if (!bo) {
|
||||||
struct drm_gem_close close = { .handle = open_arg.handle, };
|
iris_bo_close(bufmgr, open_arg.handle);
|
||||||
intel_ioctl(bufmgr->fd, DRM_IOCTL_GEM_CLOSE, &close);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1325,8 +1331,7 @@ bo_close(struct iris_bo *bo)
|
||||||
_mesa_hash_table_remove(bufmgr->handle_table, entry);
|
_mesa_hash_table_remove(bufmgr->handle_table, entry);
|
||||||
|
|
||||||
list_for_each_entry_safe(struct bo_export, export, &bo->real.exports, link) {
|
list_for_each_entry_safe(struct bo_export, export, &bo->real.exports, link) {
|
||||||
struct drm_gem_close close = { .handle = export->gem_handle };
|
iris_bo_close(bufmgr, export->gem_handle);
|
||||||
intel_ioctl(export->drm_fd, DRM_IOCTL_GEM_CLOSE, &close);
|
|
||||||
|
|
||||||
list_del(&export->link);
|
list_del(&export->link);
|
||||||
free(export);
|
free(export);
|
||||||
|
|
@ -1342,9 +1347,7 @@ bo_close(struct iris_bo *bo)
|
||||||
DBG("Unable to unbind vm of buf %u\n", bo->gem_handle);
|
DBG("Unable to unbind vm of buf %u\n", bo->gem_handle);
|
||||||
|
|
||||||
/* Close this object */
|
/* Close this object */
|
||||||
struct drm_gem_close close = { .handle = bo->gem_handle };
|
if (iris_bo_close(bufmgr, bo->gem_handle) != 0) {
|
||||||
int ret = intel_ioctl(bufmgr->fd, DRM_IOCTL_GEM_CLOSE, &close);
|
|
||||||
if (ret != 0) {
|
|
||||||
DBG("DRM_IOCTL_GEM_CLOSE %d failed (%s): %s\n",
|
DBG("DRM_IOCTL_GEM_CLOSE %d failed (%s): %s\n",
|
||||||
bo->gem_handle, bo->name, strerror(errno));
|
bo->gem_handle, bo->name, strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue