summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2017-01-02 11:05:21 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2017-01-02 11:17:19 +0000
commit39858a1e752f8f26250171e8658388f0853c176c (patch)
treeb38b348c71faecca5f4b68b30c3500bd29c9b0cd /lib
parent4de67b26788c60c19254c3e69e151ee200453895 (diff)
lib: Mass conversion to to_user_pointer()
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib')
-rw-r--r--lib/drmtest.c2
-rw-r--r--lib/igt_dummyload.c4
-rw-r--r--lib/igt_gt.c4
-rw-r--r--lib/igt_vc4.c2
-rw-r--r--lib/intel_batchbuffer.c4
-rw-r--r--lib/ioctl_wrappers.c8
-rw-r--r--lib/sw_sync.c2
7 files changed, 13 insertions, 13 deletions
diff --git a/lib/drmtest.c b/lib/drmtest.c
index be1dc937..065ab119 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -167,7 +167,7 @@ void gem_quiescent_gpu(int fd)
gem_write(fd, obj.handle, 0, &bbe, sizeof(&bbe));
memset(&execbuf, 0, sizeof(execbuf));
- execbuf.buffers_ptr = (uintptr_t)&obj;
+ execbuf.buffers_ptr = to_user_pointer(&obj);
execbuf.buffer_count = 1;
for (ring = 0; ring < 1<<6; ring++) {
diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c
index a2bae75a..d664dc94 100644
--- a/lib/igt_dummyload.c
+++ b/lib/igt_dummyload.c
@@ -127,9 +127,9 @@ static void emit_recursive_batch(igt_spin_t *spin,
*++batch = 0;
}
obj[BATCH].relocation_count++;
- obj[BATCH].relocs_ptr = (uintptr_t)relocs;
+ obj[BATCH].relocs_ptr = to_user_pointer(relocs);
- execbuf.buffers_ptr = (uintptr_t)(obj + (2 - execbuf.buffer_count));
+ execbuf.buffers_ptr = to_user_pointer(obj + (2 - execbuf.buffer_count));
for (i = 0; i < nengine; i++) {
execbuf.flags &= ~ENGINE_MASK;
diff --git a/lib/igt_gt.c b/lib/igt_gt.c
index 468c7711..461d4783 100644
--- a/lib/igt_gt.c
+++ b/lib/igt_gt.c
@@ -261,7 +261,7 @@ igt_hang_t igt_hang_ctx(int fd,
exec.handle = gem_create(fd, 4096);
exec.relocation_count = 1;
- exec.relocs_ptr = (uintptr_t)&reloc;
+ exec.relocs_ptr = to_user_pointer(&reloc);
memset(b, 0xc5, sizeof(b));
@@ -292,7 +292,7 @@ igt_hang_t igt_hang_ctx(int fd,
reloc.target_handle = exec.handle;
reloc.read_domains = I915_GEM_DOMAIN_COMMAND;
- execbuf.buffers_ptr = (uintptr_t)&exec;
+ execbuf.buffers_ptr = to_user_pointer(&exec);
execbuf.buffer_count = 1;
execbuf.flags = ring;
i915_execbuffer2_set_context_id(execbuf, ctx);
diff --git a/lib/igt_vc4.c b/lib/igt_vc4.c
index b15ed767..c4682f56 100644
--- a/lib/igt_vc4.c
+++ b/lib/igt_vc4.c
@@ -83,7 +83,7 @@ uint32_t igt_vc4_get_cleared_bo(int fd, size_t size, uint32_t clearval)
.msaa_color_write = { .hindex = ~0 },
.msaa_zs_write = { .hindex = ~0 },
- .bo_handles = (uint64_t)(uintptr_t)&handle,
+ .bo_handles = to_user_pointer(&handle),
.bo_handle_count = 1,
.width = width,
.height = height,
diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
index 692521fd..f1353901 100644
--- a/lib/intel_batchbuffer.c
+++ b/lib/intel_batchbuffer.c
@@ -553,7 +553,7 @@ fill_object(struct drm_i915_gem_exec_object2 *obj, uint32_t gem_handle,
memset(obj, 0, sizeof(*obj));
obj->handle = gem_handle;
obj->relocation_count = count;
- obj->relocs_ptr = (uintptr_t)relocs;
+ obj->relocs_ptr = to_user_pointer(relocs);
}
static void exec_blit(int fd,
@@ -562,7 +562,7 @@ static void exec_blit(int fd,
{
struct drm_i915_gem_execbuffer2 exec;
- exec.buffers_ptr = (uintptr_t)objs;
+ exec.buffers_ptr = to_user_pointer(objs);
exec.buffer_count = count;
exec.batch_start_offset = 0;
exec.batch_len = batch_len * 4;
diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index 9d67a19c..7b419ea6 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -338,7 +338,7 @@ static int __gem_write(int fd, uint32_t handle, uint64_t offset, const void *buf
gem_pwrite.handle = handle;
gem_pwrite.offset = offset;
gem_pwrite.size = length;
- gem_pwrite.data_ptr = (uintptr_t)buf;
+ gem_pwrite.data_ptr = to_user_pointer(buf);
err = 0;
if (drmIoctl(fd, DRM_IOCTL_I915_GEM_PWRITE, &gem_pwrite))
@@ -371,7 +371,7 @@ static int __gem_read(int fd, uint32_t handle, uint64_t offset, void *buf, uint6
gem_pread.handle = handle;
gem_pread.offset = offset;
gem_pread.size = length;
- gem_pread.data_ptr = (uintptr_t)buf;
+ gem_pread.data_ptr = to_user_pointer(buf);
err = 0;
if (drmIoctl(fd, DRM_IOCTL_I915_GEM_PREAD, &gem_pread))
@@ -997,7 +997,7 @@ int __gem_userptr(int fd, void *ptr, int size, int read_only, uint32_t flags, ui
struct local_i915_gem_userptr userptr;
memset(&userptr, 0, sizeof(userptr));
- userptr.user_ptr = (uintptr_t)ptr;
+ userptr.user_ptr = to_user_pointer(ptr);
userptr.user_size = size;
userptr.flags = flags;
if (read_only)
@@ -1464,7 +1464,7 @@ bool gem_has_ring(int fd, unsigned ring)
memset(&exec, 0, sizeof(exec));
memset(&execbuf, 0, sizeof(execbuf));
- execbuf.buffers_ptr = (uintptr_t)&exec;
+ execbuf.buffers_ptr = to_user_pointer(&exec);
execbuf.buffer_count = 1;
execbuf.flags = ring;
return __gem_execbuf(fd, &execbuf) == -ENOENT;
diff --git a/lib/sw_sync.c b/lib/sw_sync.c
index 017a1394..04585261 100644
--- a/lib/sw_sync.c
+++ b/lib/sw_sync.c
@@ -208,7 +208,7 @@ static int __sync_fence_count_status(int fd, int status)
if (!fence_info)
return -ENOMEM;
- info.sync_fence_info = (uintptr_t)fence_info;
+ info.sync_fence_info = to_user_pointer(fence_info);
if (ioctl(fd, LOCAL_SYNC_IOC_FILE_INFO, &info)) {
count = -errno;
} else {