From ff93f351512a194dd3d32e643c7987b5fe2347a5 Mon Sep 17 00:00:00 2001 From: Daniel Vetter Date: Sat, 24 Mar 2012 19:22:21 +0100 Subject: [PATCH] tests/gem_fence_thrash: make some good use of drmtest helpers Signed-Off-by: Daniel Vetter --- tests/gem_fence_thrash.c | 34 ++++++---------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/tests/gem_fence_thrash.c b/tests/gem_fence_thrash.c index 11afba8..3d50e33 100644 --- a/tests/gem_fence_thrash.c +++ b/tests/gem_fence_thrash.c @@ -56,36 +56,14 @@ static void * bo_create (int fd) { - struct drm_i915_gem_create create; - struct drm_i915_gem_set_tiling tiling; - struct drm_i915_gem_mmap_gtt mmap_arg; void *ptr; int handle; - int ret; - - memset(&create, 0, sizeof(create)); - create.size = OBJECT_SIZE; - ret = ioctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create); - assert(ret == 0); - handle = create.handle; - - memset(&tiling, 0, sizeof(tiling)); - tiling.handle = handle; - tiling.tiling_mode = I915_TILING_X; - tiling.stride = 1024; - ret = ioctl(fd, DRM_IOCTL_I915_GEM_SET_TILING, &tiling); - assert(ret == 0); - assert(tiling.tiling_mode == I915_TILING_X); - - memset(&mmap_arg, 0, sizeof(mmap_arg)); - mmap_arg.handle = handle; - - /* Get the fake offset back... */ - ret = ioctl(fd, DRM_IOCTL_I915_GEM_MMAP_GTT, &mmap_arg); - assert (ret == 0); - ptr = mmap64(0, OBJECT_SIZE, PROT_READ | PROT_WRITE, - MAP_SHARED, fd, mmap_arg.offset); - assert (ptr != MAP_FAILED); + + handle = gem_create(fd, OBJECT_SIZE); + + gem_set_tiling(fd, handle, I915_TILING_X, 1024); + + ptr = gem_mmap(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE); /* XXX: mmap_gtt pulls the bo into the GTT read domain. */ gem_sync(fd, handle); -- 2.7.4