summaryrefslogtreecommitdiff
path: root/tests/gen3_render_tiledx_blits.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2012-01-10 18:41:46 +0100
committerDaniel Vetter <daniel.vetter@ffwll.ch>2012-01-10 18:41:46 +0100
commit527cad1618b458a2ff04b1d63ea1ffe926774815 (patch)
treeb7bb0f938b516d7b4b1de591dedd6894ccb7e18a /tests/gen3_render_tiledx_blits.c
parent7a6042e87ef3dee2df06b1666fb8af6889ac35b8 (diff)
lib/drmtest: extract gem_mmap
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'tests/gen3_render_tiledx_blits.c')
-rw-r--r--tests/gen3_render_tiledx_blits.c22
1 files changed, 2 insertions, 20 deletions
diff --git a/tests/gen3_render_tiledx_blits.c b/tests/gen3_render_tiledx_blits.c
index e34d2f778..ce1ed3e00 100644
--- a/tests/gen3_render_tiledx_blits.c
+++ b/tests/gen3_render_tiledx_blits.c
@@ -304,26 +304,6 @@ copy(int fd, uint32_t dst, uint32_t src)
gem_close(fd, handle);
}
-static void *gem_mmap(int fd, uint32_t handle, int size, int prot)
-{
- struct drm_i915_gem_mmap_gtt mmap_arg;
- void *ptr;
-
- mmap_arg.handle = handle;
- if (drmIoctl(fd, DRM_IOCTL_I915_GEM_MMAP_GTT, &mmap_arg)) {
- assert(0);
- return NULL;
- }
-
- ptr = mmap(0, size, prot, MAP_SHARED, fd, mmap_arg.offset);
- if (ptr == MAP_FAILED) {
- assert(0);
- ptr = NULL;
- }
-
- return ptr;
-}
-
static uint32_t
create_bo(int fd, uint32_t val)
{
@@ -336,6 +316,7 @@ create_bo(int fd, uint32_t val)
/* Fill the BO with dwords starting at val */
v = gem_mmap(fd, handle, WIDTH*HEIGHT*4, PROT_READ | PROT_WRITE);
+ assert(v);
for (i = 0; i < WIDTH*HEIGHT; i++)
v[i] = val++;
munmap(v, WIDTH*HEIGHT*4);
@@ -350,6 +331,7 @@ check_bo(int fd, uint32_t handle, uint32_t val)
int i;
v = gem_mmap(fd, handle, WIDTH*HEIGHT*4, PROT_READ);
+ assert(v);
for (i = 0; i < WIDTH*HEIGHT; i++) {
if (v[i] != val) {
fprintf(stderr, "Expected 0x%08x, found 0x%08x "