summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libdrm/xf86drm.c57
-rw-r--r--libdrm/xf86drm.h7
-rw-r--r--linux-core/drm_ttm.c1
3 files changed, 29 insertions, 36 deletions
diff --git a/libdrm/xf86drm.c b/libdrm/xf86drm.c
index e666df3c..88676083 100644
--- a/libdrm/xf86drm.c
+++ b/libdrm/xf86drm.c
@@ -2385,37 +2385,28 @@ static void split32(unsigned long val, unsigned *lo, unsigned *hi)
int drmTTMCreate(int fd, drmTTM *ttm, unsigned long size, unsigned flags)
{
- drm_ttm_arg_t argTTM;
- drm_bo_arg_t arg;
+ drm_ttm_arg_t arg;
- arg.num_requests = 1;
- arg.op = drm_op_ttm;
- split32((unsigned long) &argTTM, &arg.data_lo, &arg.data_hi);
-
- argTTM.op = drm_ttm_create;
- argTTM.flags = flags;
- split32((unsigned long) &size, &argTTM.size_lo, &argTTM.size_hi);
+ arg.op = drm_ttm_create;
+ arg.flags = flags;
+ split32((unsigned long) size, &arg.size_lo, &arg.size_hi);
if (ioctl(fd, DRM_IOCTL_TTM, &arg))
return -errno;
- ttm->handle = argTTM.handle;
- ttm->user_token = (drm_handle_t) argTTM.user_token;
- ttm->flags = argTTM.flags;
- ttm->size = combine64(argTTM.size_lo, argTTM.size_hi);
+ ttm->handle = arg.handle;
+ ttm->user_token = (drm_handle_t) arg.user_token;
+ ttm->flags = arg.flags;
+ ttm->size = combine64(arg.size_lo, arg.size_hi);
return 0;
}
int drmTTMDestroy(int fd, const drmTTM *ttm)
{
- drm_ttm_arg_t argTTM;
- drm_bo_arg_t arg;
+ drm_ttm_arg_t arg;
- arg.num_requests = 1;
- arg.op = drm_op_ttm;
- split32((unsigned long) &argTTM, &arg.data_lo, &arg.data_hi);
- argTTM.op = drm_ttm_destroy;
- argTTM.handle = ttm->handle;
+ arg.op = drm_ttm_destroy;
+ arg.handle = ttm->handle;
if (ioctl(fd, DRM_IOCTL_TTM, &arg))
return -errno;
return 0;
@@ -2424,31 +2415,25 @@ int drmTTMDestroy(int fd, const drmTTM *ttm)
int drmTTMReference(int fd, unsigned handle, drmTTM *ttm)
{
- drm_ttm_arg_t argTTM;
- drm_bo_arg_t arg;
-
- arg.num_requests = 1;
- arg.op = drm_op_ttm;
- split32((unsigned long) &argTTM, &arg.data_lo, &arg.data_hi);
+ drm_ttm_arg_t arg;
- argTTM.handle = handle;
- argTTM.op = drm_ttm_reference;
+ arg.handle = handle;
+ arg.op = drm_ttm_reference;
if (ioctl(fd, DRM_IOCTL_TTM, &arg))
return -errno;
- ttm->handle = argTTM.handle;
- ttm->user_token = (drm_handle_t) argTTM.user_token;
- ttm->flags = argTTM.flags;
- ttm->size = combine64(argTTM.size_lo, argTTM.size_hi);
+ ttm->handle = arg.handle;
+ ttm->user_token = (drm_handle_t) arg.user_token;
+ ttm->flags = arg.flags;
+ ttm->size = combine64(arg.size_lo, arg.size_hi);
return 0;
}
int drmTTMUnreference(int fd, const drmTTM *ttm)
{
- drm_ttm_arg_t argTTM;
- drm_bo_arg_t arg;
+ drm_ttm_arg_t arg;
- argTTM.op = drm_ttm_destroy;
- argTTM.handle = ttm->handle;
+ arg.op = drm_ttm_destroy;
+ arg.handle = ttm->handle;
if (ioctl(fd, DRM_IOCTL_TTM, &arg))
return -errno;
return 0;
diff --git a/libdrm/xf86drm.h b/libdrm/xf86drm.h
index 92cef4c0..433191b4 100644
--- a/libdrm/xf86drm.h
+++ b/libdrm/xf86drm.h
@@ -623,6 +623,13 @@ extern int drmFenceWait(int fd, drmFence *fence, unsigned flush_type,
int lazy, int ignore_signals);
extern int drmFenceEmit(int fd, drmFence *fence, unsigned emit_type);
+/* TTMS */
+extern int drmTTMCreate(int fd, drmTTM *ttm, unsigned long size,
+ unsigned flags);
+extern int drmTTMDestroy(int fd, const drmTTM *ttm);
+extern int drmTTMReference(int fd, unsigned handle, drmTTM *ttm);
+extern int drmTTMUnreference(int fd, const drmTTM *ttm);
+extern drm_handle_t drmTTMMapHandle(int fd, const drmTTM *ttm);
/* Support routines */
diff --git a/linux-core/drm_ttm.c b/linux-core/drm_ttm.c
index 950b0d4d..ad7b279e 100644
--- a/linux-core/drm_ttm.c
+++ b/linux-core/drm_ttm.c
@@ -846,6 +846,7 @@ int drm_ttm_object_create(drm_device_t *dev, unsigned long size,
object->base.unref = NULL;
atomic_set(&object->usage, 1);
+ *ttm_object = object;
return 0;
}