xf86drm: add GEM_CLOSE ioctl wrapper

We have wrappers for PRIME_HANDLE_TO_FD and PRIME_FD_TO_HANDLE,
but not for GEM_CLOSE. Add it so that callers don't need to
manually call drmIoctl.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Daniel Stone <daniels@collabora.com>
main
Simon Ser 2021-09-01 21:26:38 +02:00
parent 122ff0e878
commit 264e66b5e9
3 changed files with 12 additions and 0 deletions

View File

@ -22,6 +22,7 @@ drmAuthMagic
drmAvailable
drmCheckModesettingSupported
drmClose
drmCloseBufferHandle
drmCloseOnce
drmCommandNone
drmCommandRead

View File

@ -3271,6 +3271,15 @@ drm_public int drmPrimeFDToHandle(int fd, int prime_fd, uint32_t *handle)
return 0;
}
drm_public int drmCloseBufferHandle(int fd, uint32_t handle)
{
struct drm_gem_close args;
memclear(args);
args.handle = handle;
return drmIoctl(fd, DRM_IOCTL_GEM_CLOSE, &args);
}
static char *drmGetMinorNameForFD(int fd, int type)
{
#ifdef __linux__

View File

@ -834,6 +834,8 @@ extern int drmGetNodeTypeFromFd(int fd);
extern int drmPrimeHandleToFD(int fd, uint32_t handle, uint32_t flags, int *prime_fd);
extern int drmPrimeFDToHandle(int fd, int prime_fd, uint32_t *handle);
extern int drmCloseBufferHandle(int fd, uint32_t handle);
extern char *drmGetPrimaryDeviceNameFromFd(int fd);
extern char *drmGetRenderDeviceNameFromFd(int fd);