aboutsummaryrefslogtreecommitdiff
path: root/libdrm/xf86drm.c
diff options
context:
space:
mode:
authorThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2006-08-28 09:49:09 +0200
committerThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2006-08-28 09:49:09 +0200
commite181f594a4a75790ce1d2a8e907f9fcc5e88b419 (patch)
tree02465a6eb22dfe2271c0b345275275ebe9dff305 /libdrm/xf86drm.c
parent4ddabd15620e6e4638a6a37a3a2b5bced626fcf9 (diff)
Add a 64-bit drm unsigned type for 64-bit clean IOCTLS.
Conversion functions in drmP.h and xf86drm.c.
Diffstat (limited to 'libdrm/xf86drm.c')
-rw-r--r--libdrm/xf86drm.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/libdrm/xf86drm.c b/libdrm/xf86drm.c
index 88676083..06c64303 100644
--- a/libdrm/xf86drm.c
+++ b/libdrm/xf86drm.c
@@ -2362,25 +2362,27 @@ int drmFenceWait(int fd, drmFence *fence, unsigned flush_type,
return 0;
}
-static unsigned long combine64(unsigned lo, unsigned hi)
+static unsigned long drmUL(drm_u64_t val)
{
- unsigned long ret = lo;
+ unsigned long ret = val.lo;
if (sizeof(ret) == 8) {
int shift = 32;
- ret |= (hi << shift);
+ ret |= (val.hi << shift);
}
return ret;
}
-static void split32(unsigned long val, unsigned *lo, unsigned *hi)
+static drm_u64_t drmU64(unsigned long val)
{
- *lo = val & 0xFFFFFFFFUL;
+ drm_u64_t ret;
+ ret.lo = val & 0xFFFFFFFFUL;
if (sizeof(val) == 8) {
int shift = 32;
- *hi = val >> shift;
+ ret.hi = val >> shift;
} else {
- *hi = 0;
+ ret.hi = 0;
}
+ return ret;
}
int drmTTMCreate(int fd, drmTTM *ttm, unsigned long size, unsigned flags)
@@ -2389,7 +2391,7 @@ int drmTTMCreate(int fd, drmTTM *ttm, unsigned long size, unsigned flags)
arg.op = drm_ttm_create;
arg.flags = flags;
- split32((unsigned long) size, &arg.size_lo, &arg.size_hi);
+ arg.size = drmU64(size);
if (ioctl(fd, DRM_IOCTL_TTM, &arg))
return -errno;
@@ -2397,7 +2399,7 @@ int drmTTMCreate(int fd, drmTTM *ttm, unsigned long size, unsigned flags)
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);
+ ttm->size = drmUL(arg.size);
return 0;
}
@@ -2424,7 +2426,7 @@ int drmTTMReference(int fd, unsigned handle, drmTTM *ttm)
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);
+ ttm->size = drmUL(arg.size);
return 0;
}