summaryrefslogtreecommitdiff
path: root/xf86drm.c
diff options
context:
space:
mode:
Diffstat (limited to 'xf86drm.c')
-rw-r--r--xf86drm.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/xf86drm.c b/xf86drm.c
index a183eee9..aa23f406 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -2542,3 +2542,32 @@ char *drmGetDeviceNameFromFd(int fd)
return strdup(name);
}
+
+int drmPrimeBufferSet(int fd, uint32_t handle, uint32_t *name)
+{
+ struct drm_prime_handle args;
+ int ret;
+
+ args.handle = handle;
+ ret = drmIoctl(fd, DRM_IOCTL_PRIME_SET, &args);
+ if (ret)
+ return ret;
+
+ *name = args.name;
+ return 0;
+}
+
+int drmPrimeBufferGet(int fd, uint32_t name, uint32_t *handle)
+{
+ struct drm_prime_handle args;
+ int ret;
+
+ args.name = name;
+ ret = drmIoctl(fd, DRM_IOCTL_PRIME_GET, &args);
+ if (ret)
+ return ret;
+
+ *handle = args.handle;
+ return 0;
+}
+