radeon: use drmCloseBufferHandle

Instead of manually calling drmIoctl, use the equivalent function
from libdrm core.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
main
Simon Ser 2021-10-03 19:45:24 +02:00
parent 7e13fe1dbf
commit 80f8fbd488
1 changed files with 1 additions and 6 deletions

View File

@ -125,7 +125,6 @@ static void bo_ref(struct radeon_bo_int *boi)
static struct radeon_bo *bo_unref(struct radeon_bo_int *boi) static struct radeon_bo *bo_unref(struct radeon_bo_int *boi)
{ {
struct radeon_bo_gem *bo_gem = (struct radeon_bo_gem*)boi; struct radeon_bo_gem *bo_gem = (struct radeon_bo_gem*)boi;
struct drm_gem_close args;
if (boi->cref) { if (boi->cref) {
return (struct radeon_bo *)boi; return (struct radeon_bo *)boi;
@ -134,12 +133,8 @@ static struct radeon_bo *bo_unref(struct radeon_bo_int *boi)
drm_munmap(bo_gem->priv_ptr, boi->size); drm_munmap(bo_gem->priv_ptr, boi->size);
} }
/* Zero out args to make valgrind happy */
memset(&args, 0, sizeof(args));
/* close object */ /* close object */
args.handle = boi->handle; drmCloseBufferHandle(boi->bom->fd, boi->handle);
drmIoctl(boi->bom->fd, DRM_IOCTL_GEM_CLOSE, &args);
memset(bo_gem, 0, sizeof(struct radeon_bo_gem)); memset(bo_gem, 0, sizeof(struct radeon_bo_gem));
free(bo_gem); free(bo_gem);
return NULL; return NULL;