From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> gem_mmap__{cpu,gtt,wc}() already has the assert built in, so replace __gem_mmap__{cpu,gtt,wc}() + igt_assert() with it. Mostly done with coccinelle, with some manual help: @@ identifier I; expression E1, E2, E3, E4, E5, E6; @@ ( - I = __gem_mmap__gtt(E1, E2, E3, E4); + I = gem_mmap__gtt(E1, E2, E3, E4); ... - igt_assert(I); | - I = __gem_mmap__cpu(E1, E2, E3, E4, E5); + I = gem_mmap__cpu(E1, E2, E3, E4, E5); ... - igt_assert(I); | - I = __gem_mmap__wc(E1, E2, E3, E4, E5); + I = gem_mmap__wc(E1, E2, E3, E4, E5); ... - igt_assert(I); ) Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> --- benchmarks/gem_blt.c | 3 +-- benchmarks/gem_mmap.c | 9 +++---- lib/igt_draw.c | 9 +++---- lib/igt_fb.c | 6 ++--- tests/drv_suspend.c | 10 +++---- tests/gem_concurrent_all.c | 18 +++++-------- tests/gem_cs_tlb.c | 3 +-- tests/gem_evict_everything.c | 3 +-- tests/gem_exec_faulting_reloc.c | 5 ++-- tests/gem_exec_lut_handle.c | 3 +-- tests/gem_fence_thrash.c | 7 +++-- tests/gem_fence_upload.c | 12 +++------ tests/gem_gtt_cpu_tlb.c | 6 ++--- tests/gem_gtt_hog.c | 7 +++-- tests/gem_gtt_speed.c | 55 +++++++++++++++----------------------- tests/gem_largeobject.c | 4 +-- tests/gem_mmap.c | 3 +-- tests/gem_mmap_gtt.c | 26 +++++++----------- tests/gem_mmap_offset_exhaustion.c | 3 +-- tests/gem_mmap_wc.c | 21 +++++---------- tests/gem_persistent_relocs.c | 6 ++--- tests/gem_pwrite.c | 3 +-- tests/gem_pwrite_pread.c | 24 ++++++----------- tests/gem_reloc_vs_gpu.c | 5 ++-- tests/gem_set_tiling_vs_gtt.c | 3 +-- tests/gem_set_tiling_vs_pwrite.c | 3 +-- tests/gem_streaming_writes.c | 36 +++++++++++-------------- tests/gem_tiled_pread_basic.c | 4 +-- tests/gem_tiled_pread_pwrite.c | 7 +++-- tests/gem_tiled_swapping.c | 7 +++-- tests/gem_tiled_wb.c | 7 ++--- tests/gem_tiled_wc.c | 6 ++--- tests/gem_tiling_max_stride.c | 3 +-- tests/gem_userptr_blits.c | 11 ++++---- tests/gen3_mixed_blits.c | 7 +++-- tests/gen3_render_mixed_blits.c | 7 +++-- tests/gen3_render_tiledx_blits.c | 7 +++-- tests/gen3_render_tiledy_blits.c | 7 +++-- tests/gen7_forcewake_mt.c | 3 +-- tests/kms_fbc_crc.c | 6 ++--- tests/kms_fence_pin_leak.c | 3 +-- tests/kms_psr_sink_crc.c | 10 +++---- tests/pm_rpm.c | 20 +++++--------- tests/prime_self_import.c | 6 ++--- tests/testdisplay.c | 5 ++-- 45 files changed, 158 insertions(+), 261 deletions(-) diff --git a/benchmarks/gem_blt.c b/benchmarks/gem_blt.c index e722541..181a5f1 100644 --- a/benchmarks/gem_blt.c +++ b/benchmarks/gem_blt.c @@ -177,8 +177,7 @@ static int run(int object, int batch, int count, int reps) fd = drm_open_driver(DRIVER_INTEL); handle = gem_create(fd, size); - buf = __gem_mmap__cpu(fd, handle, 0, size, PROT_WRITE); - igt_assert(buf); + buf = gem_mmap__cpu(fd, handle, 0, size, PROT_WRITE); gen = intel_gen(intel_get_drm_devid(fd)); has_64bit_reloc = gen >= 8; diff --git a/benchmarks/gem_mmap.c b/benchmarks/gem_mmap.c index 571f757..bc26d31 100644 --- a/benchmarks/gem_mmap.c +++ b/benchmarks/gem_mmap.c @@ -115,18 +115,15 @@ int main(int argc, char **argv) handle = gem_create(fd, OBJECT_SIZE); switch (map) { case CPU: - ptr = __gem_mmap__cpu(fd, handle, 0, OBJECT_SIZE, PROT_WRITE); - igt_assert(ptr); + ptr = gem_mmap__cpu(fd, handle, 0, OBJECT_SIZE, PROT_WRITE); gem_set_domain(fd, handle, I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU); break; case GTT: - ptr = __gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_WRITE); - igt_assert(ptr); + ptr = gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_WRITE); gem_set_domain(fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); break; case WC: - ptr = __gem_mmap__wc(fd, handle, 0, OBJECT_SIZE, PROT_WRITE); - igt_assert(ptr); + ptr = gem_mmap__wc(fd, handle, 0, OBJECT_SIZE, PROT_WRITE); gem_set_domain(fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); break; default: diff --git a/lib/igt_draw.c b/lib/igt_draw.c index 07aa812..f85e376 100644 --- a/lib/igt_draw.c +++ b/lib/igt_draw.c @@ -252,8 +252,7 @@ static void draw_rect_mmap_cpu(int fd, struct buf_data *buf, struct rect *rect, if (tiling != I915_TILING_NONE) igt_require(intel_gen(intel_get_drm_devid(fd)) >= 5); - ptr = __gem_mmap__cpu(fd, buf->handle, 0, buf->size, 0); - igt_assert(ptr); + ptr = gem_mmap__cpu(fd, buf->handle, 0, buf->size, 0); switch (tiling) { case I915_TILING_NONE: @@ -281,8 +280,7 @@ static void draw_rect_mmap_gtt(int fd, struct buf_data *buf, struct rect *rect, gem_set_domain(fd, buf->handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); - ptr = __gem_mmap__gtt(fd, buf->handle, buf->size, PROT_READ | PROT_WRITE); - igt_assert(ptr); + ptr = gem_mmap__gtt(fd, buf->handle, buf->size, PROT_READ | PROT_WRITE); draw_rect_ptr_linear(ptr, buf->stride, rect, color, buf->bpp); @@ -303,9 +301,8 @@ static void draw_rect_mmap_wc(int fd, struct buf_data *buf, struct rect *rect, if (tiling != I915_TILING_NONE) igt_require(intel_gen(intel_get_drm_devid(fd)) >= 5); - ptr = __gem_mmap__wc(fd, buf->handle, 0, buf->size, + ptr = gem_mmap__wc(fd, buf->handle, 0, buf->size, PROT_READ | PROT_WRITE); - igt_assert(ptr); switch (tiling) { case I915_TILING_NONE: diff --git a/lib/igt_fb.c b/lib/igt_fb.c index 5ab063f..13a6a34 100644 --- a/lib/igt_fb.c +++ b/lib/igt_fb.c @@ -745,12 +745,11 @@ static void create_cairo_surface__blit(int fd, struct igt_fb *fb) I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU); /* Setup cairo context */ - blit->linear.map = __gem_mmap__cpu(fd, + blit->linear.map = gem_mmap__cpu(fd, blit->linear.handle, 0, blit->linear.size, PROT_READ | PROT_WRITE); - igt_assert(blit->linear.map); cairo_format = drm_format_to_cairo(fb->drm_format); fb->cairo_surface = @@ -774,8 +773,7 @@ static void destroy_cairo_surface__gtt(void *arg) static void create_cairo_surface__gtt(int fd, struct igt_fb *fb) { - void *ptr = __gem_mmap__gtt(fd, fb->gem_handle, fb->size, PROT_READ | PROT_WRITE); - igt_assert(ptr); + void *ptr = gem_mmap__gtt(fd, fb->gem_handle, fb->size, PROT_READ | PROT_WRITE); fb->cairo_surface = cairo_image_surface_create_for_data(ptr, diff --git a/tests/drv_suspend.c b/tests/drv_suspend.c index b85dd2f..601a32e 100644 --- a/tests/drv_suspend.c +++ b/tests/drv_suspend.c @@ -56,20 +56,18 @@ test_fence_restore(int fd, bool tiled2untiled, bool hibernate) handle_tiled = gem_create(fd, OBJECT_SIZE); /* Access the buffer objects in the order we want to have the laid out. */ - ptr1 = __gem_mmap__gtt(fd, handle1, OBJECT_SIZE, PROT_READ | PROT_WRITE); - igt_assert(ptr1); + ptr1 = gem_mmap__gtt(fd, handle1, OBJECT_SIZE, PROT_READ | PROT_WRITE); for (i = 0; i < OBJECT_SIZE/sizeof(uint32_t); i++) ptr1[i] = i; - ptr_tiled = __gem_mmap__gtt(fd, handle_tiled, OBJECT_SIZE, PROT_READ | PROT_WRITE); - igt_assert(ptr_tiled); + ptr_tiled = gem_mmap__gtt(fd, handle_tiled, OBJECT_SIZE, + PROT_READ | PROT_WRITE); if (tiled2untiled) gem_set_tiling(fd, handle_tiled, I915_TILING_X, 2048); for (i = 0; i < OBJECT_SIZE/sizeof(uint32_t); i++) ptr_tiled[i] = i; - ptr2 = __gem_mmap__gtt(fd, handle2, OBJECT_SIZE, PROT_READ | PROT_WRITE); - igt_assert(ptr2); + ptr2 = gem_mmap__gtt(fd, handle2, OBJECT_SIZE, PROT_READ | PROT_WRITE); for (i = 0; i < OBJECT_SIZE/sizeof(uint32_t); i++) ptr2[i] = i; diff --git a/tests/gem_concurrent_all.c b/tests/gem_concurrent_all.c index 5b8c3f0..80a8697 100644 --- a/tests/gem_concurrent_all.c +++ b/tests/gem_concurrent_all.c @@ -471,10 +471,8 @@ static void cpu_copy_bo(drm_intel_bo *dst, drm_intel_bo *src) gem_set_domain(fd, src->handle, I915_GEM_DOMAIN_CPU, 0); gem_set_domain(fd, dst->handle, I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU); - s = __gem_mmap__cpu(fd, src->handle, 0, size, PROT_READ); - igt_assert(s); - d = __gem_mmap__cpu(fd, dst->handle, 0, size, PROT_WRITE); - igt_assert(d); + s = gem_mmap__cpu(fd, src->handle, 0, size, PROT_READ); + d = gem_mmap__cpu(fd, dst->handle, 0, size, PROT_WRITE); memcpy(d, s, size); @@ -490,10 +488,8 @@ static void gtt_copy_bo(drm_intel_bo *dst, drm_intel_bo *src) gem_set_domain(fd, src->handle, I915_GEM_DOMAIN_GTT, 0); gem_set_domain(fd, dst->handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); - s = __gem_mmap__gtt(fd, src->handle, size, PROT_READ); - igt_assert(s); - d = __gem_mmap__gtt(fd, dst->handle, size, PROT_WRITE); - igt_assert(d); + s = gem_mmap__gtt(fd, src->handle, size, PROT_READ); + d = gem_mmap__gtt(fd, dst->handle, size, PROT_WRITE); memcpy(d, s, size); @@ -509,10 +505,8 @@ static void wc_copy_bo(drm_intel_bo *dst, drm_intel_bo *src) gem_set_domain(fd, src->handle, I915_GEM_DOMAIN_GTT, 0); gem_set_domain(fd, dst->handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); - s = __gem_mmap__wc(fd, src->handle, 0, size, PROT_READ); - igt_assert(s); - d = __gem_mmap__wc(fd, dst->handle, 0, size, PROT_WRITE); - igt_assert(d); + s = gem_mmap__wc(fd, src->handle, 0, size, PROT_READ); + d = gem_mmap__wc(fd, dst->handle, 0, size, PROT_WRITE); memcpy(d, s, size); diff --git a/tests/gem_cs_tlb.c b/tests/gem_cs_tlb.c index 71e5996..8b640fa 100644 --- a/tests/gem_cs_tlb.c +++ b/tests/gem_cs_tlb.c @@ -115,9 +115,8 @@ static void run_on_ring(int fd, unsigned ring_id, const char *ring_name) igt_progress(buf, split, BATCH_SIZE/8 - 1); handle_new = gem_create(fd, BATCH_SIZE); - batch_ptr = __gem_mmap__cpu(fd, handle_new, 0, BATCH_SIZE, + batch_ptr = gem_mmap__cpu(fd, handle_new, 0, BATCH_SIZE, PROT_READ | PROT_WRITE); - igt_assert(batch_ptr); batch_ptr[split*2] = MI_BATCH_BUFFER_END; for (i = split*2 + 2; i < BATCH_SIZE/8; i++) diff --git a/tests/gem_evict_everything.c b/tests/gem_evict_everything.c index 93ec7a5..ebf59f9 100644 --- a/tests/gem_evict_everything.c +++ b/tests/gem_evict_everything.c @@ -132,9 +132,8 @@ copy(int fd, uint32_t dst, uint32_t src, uint32_t *all_bo, int n_bo) static void clear(int fd, uint32_t handle, int size) { - void *base = __gem_mmap__cpu(fd, handle, 0, size, PROT_READ | PROT_WRITE); + void *base = gem_mmap__cpu(fd, handle, 0, size, PROT_READ | PROT_WRITE); - igt_assert(base != NULL); memset(base, 0, size); munmap(base, size); } diff --git a/tests/gem_exec_faulting_reloc.c b/tests/gem_exec_faulting_reloc.c index 67fc410..dcd3734 100644 --- a/tests/gem_exec_faulting_reloc.c +++ b/tests/gem_exec_faulting_reloc.c @@ -200,9 +200,8 @@ static void run(int object_size) handle_relocs = gem_create(fd, 4096); gem_write(fd, handle_relocs, 0, reloc, sizeof(reloc)); - gtt_relocs = __gem_mmap__gtt(fd, handle_relocs, 4096, - PROT_READ | PROT_WRITE); - igt_assert(gtt_relocs); + gtt_relocs = gem_mmap__gtt(fd, handle_relocs, 4096, + PROT_READ | PROT_WRITE); exec[2].handle = handle; if (intel_gen(devid) >= 8) diff --git a/tests/gem_exec_lut_handle.c b/tests/gem_exec_lut_handle.c index 0af27bb..672635c 100644 --- a/tests/gem_exec_lut_handle.c +++ b/tests/gem_exec_lut_handle.c @@ -123,8 +123,7 @@ igt_simple_main size = ALIGN(sizeof(mem_reloc), 4096); reloc_handle = gem_create(fd, size); - reloc = __gem_mmap__cpu(fd, reloc_handle, 0, size, PROT_READ | PROT_WRITE); - igt_assert(reloc); + reloc = gem_mmap__cpu(fd, reloc_handle, 0, size, PROT_READ | PROT_WRITE); for (n = 0; n < MAX_NUM_RELOC; n++) { reloc[n].offset = 1024; reloc[n].read_domains = I915_GEM_DOMAIN_RENDER; diff --git a/tests/gem_fence_thrash.c b/tests/gem_fence_thrash.c index 1161e73..52095f2 100644 --- a/tests/gem_fence_thrash.c +++ b/tests/gem_fence_thrash.c @@ -67,15 +67,14 @@ bo_create (int fd, int tiling) handle = gem_create(fd, OBJECT_SIZE); /* dirty cpu caches a bit ... */ - ptr = __gem_mmap__cpu(fd, handle, 0, OBJECT_SIZE, PROT_READ | PROT_WRITE); - igt_assert(ptr); + ptr = gem_mmap__cpu(fd, handle, 0, OBJECT_SIZE, + PROT_READ | PROT_WRITE); memset(ptr, 0, OBJECT_SIZE); munmap(ptr, OBJECT_SIZE); gem_set_tiling(fd, handle, tiling, 1024); - ptr = __gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE); - igt_assert(ptr); + ptr = gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE); gem_set_domain(fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); gem_close(fd, handle); diff --git a/tests/gem_fence_upload.c b/tests/gem_fence_upload.c index d2cbc30..7d9acdc 100644 --- a/tests/gem_fence_upload.c +++ b/tests/gem_fence_upload.c @@ -68,8 +68,7 @@ static void performance(void) for (n = 0; n < count; n++) { handle[n] = gem_create(fd, OBJECT_SIZE); - ptr[n] = __gem_mmap__gtt(fd, handle[n], OBJECT_SIZE, PROT_READ | PROT_WRITE); - igt_assert(ptr[n]); + ptr[n] = gem_mmap__gtt(fd, handle[n], OBJECT_SIZE, PROT_READ | PROT_WRITE); } gettimeofday(&start, NULL); @@ -176,8 +175,7 @@ static void thread_performance(unsigned mask) for (n = 0; n < count; n++) { handle[n] = gem_create(fd, OBJECT_SIZE); - ptr[n] = __gem_mmap__gtt(fd, handle[n], OBJECT_SIZE, PROT_READ | PROT_WRITE); - igt_assert(ptr[n]); + ptr[n] = gem_mmap__gtt(fd, handle[n], OBJECT_SIZE, PROT_READ | PROT_WRITE); if (mask & READ) { readers[n].id = n; @@ -257,8 +255,7 @@ static void *no_contention(void *closure) int n; for (n = 0; n < t->loops; n++) { - uint32_t *ptr = __gem_mmap__gtt(t->fd, t->handle, OBJECT_SIZE, PROT_READ | PROT_WRITE); - igt_assert(ptr); + uint32_t *ptr = gem_mmap__gtt(t->fd, t->handle, OBJECT_SIZE, PROT_READ | PROT_WRITE); memset(ptr + (rand() % 256) * 4096 / 4, 0, 4096); munmap(ptr, OBJECT_SIZE); } @@ -272,8 +269,7 @@ static void *wc_mmap(void *closure) int n; for (n = 0; n < t->loops; n++) { - uint32_t *ptr = __gem_mmap__wc(t->fd, t->handle, 0, OBJECT_SIZE, PROT_READ | PROT_WRITE); - igt_assert(ptr); + uint32_t *ptr = gem_mmap__wc(t->fd, t->handle, 0, OBJECT_SIZE, PROT_READ | PROT_WRITE); memset(ptr + (rand() % 256) * 4096 / 4, 0, 4096); munmap(ptr, OBJECT_SIZE); } diff --git a/tests/gem_gtt_cpu_tlb.c b/tests/gem_gtt_cpu_tlb.c index 9125c34..8ceef44 100644 --- a/tests/gem_gtt_cpu_tlb.c +++ b/tests/gem_gtt_cpu_tlb.c @@ -59,8 +59,7 @@ create_bo(int fd) handle = gem_create(fd, OBJ_SIZE); /* Fill the BO with dwords starting at start_val */ - data = __gem_mmap__gtt(fd, handle, OBJ_SIZE, PROT_READ | PROT_WRITE); - igt_assert(data); + data = gem_mmap__gtt(fd, handle, OBJ_SIZE, PROT_READ | PROT_WRITE); for (i = 0; i < OBJ_SIZE/4; i++) data[i] = i; munmap(data, OBJ_SIZE); @@ -83,8 +82,7 @@ igt_simple_main handle = gem_create(fd, OBJ_SIZE); /* touch one page */ - ptr = __gem_mmap__gtt(fd, handle, OBJ_SIZE, PROT_READ | PROT_WRITE); - igt_assert(ptr); + ptr = gem_mmap__gtt(fd, handle, OBJ_SIZE, PROT_READ | PROT_WRITE); *ptr = 0xdeadbeef; munmap(ptr, OBJ_SIZE); diff --git a/tests/gem_gtt_hog.c b/tests/gem_gtt_hog.c index 28df7a7..7ca7d12 100644 --- a/tests/gem_gtt_hog.c +++ b/tests/gem_gtt_hog.c @@ -140,12 +140,11 @@ static void run(data_t *data, int child) * set-to-gtt-domain within the fault handler. */ if (write) { - ptr = __gem_mmap__gtt(data->fd, handle, size, PROT_READ | PROT_WRITE); - igt_assert(ptr); + ptr = gem_mmap__gtt(data->fd, handle, size, + PROT_READ | PROT_WRITE); ptr[rand() % (size / 4)] = canary; } else { - ptr = __gem_mmap__gtt(data->fd, handle, size, PROT_READ); - igt_assert(ptr); + ptr = gem_mmap__gtt(data->fd, handle, size, PROT_READ); } x = ptr[rand() % (size / 4)]; munmap(ptr, size); diff --git a/tests/gem_gtt_speed.c b/tests/gem_gtt_speed.c index 7228718..1b222ca 100644 --- a/tests/gem_gtt_speed.c +++ b/tests/gem_gtt_speed.c @@ -89,12 +89,10 @@ int main(int argc, char **argv) I915_GEM_DOMAIN_CPU); { - uint32_t *base = __gem_mmap__cpu(fd, handle, 0, size, PROT_READ | PROT_WRITE); + uint32_t *base = gem_mmap__cpu(fd, handle, 0, size, PROT_READ | PROT_WRITE); volatile uint32_t *ptr = base; int x = 0; - igt_assert(base); - for (i = 0; i < size/sizeof(*ptr); i++) x += ptr[i]; @@ -106,12 +104,12 @@ int main(int argc, char **argv) /* mmap read */ gettimeofday(&start, NULL); for (loop = 0; loop < 1000; loop++) { - base = __gem_mmap__cpu(fd, handle, 0, size, PROT_READ | PROT_WRITE); + base = gem_mmap__cpu(fd, handle, 0, + size, + PROT_READ | PROT_WRITE); ptr = base; x = 0; - igt_assert(base); - for (i = 0; i < size/sizeof(*ptr); i++) x += ptr[i]; @@ -127,11 +125,11 @@ int main(int argc, char **argv) /* mmap write */ gettimeofday(&start, NULL); for (loop = 0; loop < 1000; loop++) { - base = __gem_mmap__cpu(fd, handle, 0, size, PROT_READ | PROT_WRITE); + base = gem_mmap__cpu(fd, handle, 0, + size, + PROT_READ | PROT_WRITE); ptr = base; - igt_assert(base); - for (i = 0; i < size/sizeof(*ptr); i++) ptr[i] = i; @@ -143,8 +141,9 @@ int main(int argc, char **argv) gettimeofday(&start, NULL); for (loop = 0; loop < 1000; loop++) { - base = __gem_mmap__cpu(fd, handle, 0, size, PROT_READ | PROT_WRITE); - igt_assert(base); + base = gem_mmap__cpu(fd, handle, 0, + size, + PROT_READ | PROT_WRITE); memset(base, 0, size); munmap(base, size); } @@ -153,8 +152,8 @@ int main(int argc, char **argv) size/1024, elapsed(&start, &end, loop)); gettimeofday(&start, NULL); - base = __gem_mmap__cpu(fd, handle, 0, size, PROT_READ | PROT_WRITE); - igt_assert(base); + base = gem_mmap__cpu(fd, handle, 0, size, + PROT_READ | PROT_WRITE); for (loop = 0; loop < 1000; loop++) memset(base, 0, size); munmap(base, size); @@ -182,12 +181,10 @@ int main(int argc, char **argv) /* prefault into gtt */ { - uint32_t *base = __gem_mmap__gtt(fd, handle, size, PROT_READ | PROT_WRITE); + uint32_t *base = gem_mmap__gtt(fd, handle, size, PROT_READ | PROT_WRITE); volatile uint32_t *ptr = base; int x = 0; - igt_assert(base); - for (i = 0; i < size/sizeof(*ptr); i++) x += ptr[i]; @@ -199,12 +196,10 @@ int main(int argc, char **argv) /* mmap read */ gettimeofday(&start, NULL); for (loop = 0; loop < 1000; loop++) { - uint32_t *base = __gem_mmap__gtt(fd, handle, size, PROT_READ | PROT_WRITE); + uint32_t *base = gem_mmap__gtt(fd, handle, size, PROT_READ | PROT_WRITE); volatile uint32_t *ptr = base; int x = 0; - igt_assert(base); - for (i = 0; i < size/sizeof(*ptr); i++) x += ptr[i]; @@ -220,12 +215,10 @@ int main(int argc, char **argv) if (gem_mmap__has_wc(fd)) { gettimeofday(&start, NULL); for (loop = 0; loop < 1000; loop++) { - uint32_t *base = __gem_mmap__wc(fd, handle, 0, size, PROT_READ | PROT_WRITE); + uint32_t *base = gem_mmap__wc(fd, handle, 0, size, PROT_READ | PROT_WRITE); volatile uint32_t *ptr = base; int x = 0; - igt_assert(base); - for (i = 0; i < size/sizeof(*ptr); i++) x += ptr[i]; @@ -243,11 +236,9 @@ int main(int argc, char **argv) /* mmap write */ gettimeofday(&start, NULL); for (loop = 0; loop < 1000; loop++) { - uint32_t *base = __gem_mmap__gtt(fd, handle, size, PROT_READ | PROT_WRITE); + uint32_t *base = gem_mmap__gtt(fd, handle, size, PROT_READ | PROT_WRITE); volatile uint32_t *ptr = base; - igt_assert(base); - for (i = 0; i < size/sizeof(*ptr); i++) ptr[i] = i; @@ -261,11 +252,9 @@ int main(int argc, char **argv) /* mmap write */ gettimeofday(&start, NULL); for (loop = 0; loop < 1000; loop++) { - uint32_t *base = __gem_mmap__wc(fd, handle, 0, size, PROT_READ | PROT_WRITE); + uint32_t *base = gem_mmap__wc(fd, handle, 0, size, PROT_READ | PROT_WRITE); volatile uint32_t *ptr = base; - igt_assert(base); - for (i = 0; i < size/sizeof(*ptr); i++) ptr[i] = i; @@ -279,7 +268,7 @@ int main(int argc, char **argv) /* mmap clear */ gettimeofday(&start, NULL); for (loop = 0; loop < 1000; loop++) { - uint32_t *base = __gem_mmap__gtt(fd, handle, size, PROT_READ | PROT_WRITE); + uint32_t *base = gem_mmap__gtt(fd, handle, size, PROT_READ | PROT_WRITE); memset(base, 0, size); munmap(base, size); } @@ -291,7 +280,7 @@ int main(int argc, char **argv) /* mmap clear */ gettimeofday(&start, NULL); for (loop = 0; loop < 1000; loop++) { - uint32_t *base = __gem_mmap__wc(fd, handle, 0, size, PROT_READ | PROT_WRITE); + uint32_t *base = gem_mmap__wc(fd, handle, 0, size, PROT_READ | PROT_WRITE); memset(base, 0, size); munmap(base, size); } @@ -301,7 +290,7 @@ int main(int argc, char **argv) } gettimeofday(&start, NULL);{ - uint32_t *base = __gem_mmap__gtt(fd, handle, size, PROT_READ | PROT_WRITE); + uint32_t *base = gem_mmap__gtt(fd, handle, size, PROT_READ | PROT_WRITE); for (loop = 0; loop < 1000; loop++) memset(base, 0, size); munmap(base, size); @@ -311,7 +300,7 @@ int main(int argc, char **argv) if (gem_mmap__has_wc(fd)) { gettimeofday(&start, NULL);{ - uint32_t *base = __gem_mmap__wc(fd, handle, 0, size, PROT_READ | PROT_WRITE); + uint32_t *base = gem_mmap__wc(fd, handle, 0, size, PROT_READ | PROT_WRITE); for (loop = 0; loop < 1000; loop++) memset(base, 0, size); munmap(base, size); @@ -323,7 +312,7 @@ int main(int argc, char **argv) /* mmap read */ gettimeofday(&start, NULL); for (loop = 0; loop < 1000; loop++) { - uint32_t *base = __gem_mmap__gtt(fd, handle, size, PROT_READ | PROT_WRITE); + uint32_t *base = gem_mmap__gtt(fd, handle, size, PROT_READ | PROT_WRITE); volatile uint32_t *ptr = base; int x = 0; diff --git a/tests/gem_largeobject.c b/tests/gem_largeobject.c index 0da8205..c001c17 100644 --- a/tests/gem_largeobject.c +++ b/tests/gem_largeobject.c @@ -64,8 +64,8 @@ test_large_object(int fd) igt_assert(ioctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create) == 0); /* prefault */ - ptr = __gem_mmap__gtt(fd, create.handle, obj_size, PROT_WRITE | PROT_READ); - igt_assert(ptr); + ptr = gem_mmap__gtt(fd, create.handle, obj_size, + PROT_WRITE | PROT_READ); *ptr = 0; gem_write(fd, create.handle, 0, data, obj_size); diff --git a/tests/gem_mmap.c b/tests/gem_mmap.c index 37d0933..2e0d725 100644 --- a/tests/gem_mmap.c +++ b/tests/gem_mmap.c @@ -166,8 +166,7 @@ igt_main igt_subtest("short-mmap") { igt_assert(OBJECT_SIZE > 4096); arg.handle = gem_create(fd, OBJECT_SIZE); - addr = __gem_mmap__cpu(fd, arg.handle, 0, 4096, PROT_WRITE); - igt_assert(addr); + addr = gem_mmap__cpu(fd, arg.handle, 0, 4096, PROT_WRITE); memset(addr, 0, 4096); munmap(addr, 4096); gem_close(fd, arg.handle); diff --git a/tests/gem_mmap_gtt.c b/tests/gem_mmap_gtt.c index 0cfb6f6..62ba35f 100644 --- a/tests/gem_mmap_gtt.c +++ b/tests/gem_mmap_gtt.c @@ -56,8 +56,7 @@ mmap_bo(int fd, uint32_t handle) { void *ptr; - ptr = __gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE); - igt_assert(ptr); + ptr = gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE); return ptr; } @@ -179,8 +178,7 @@ test_read_write(int fd, enum test_read_write order) handle = gem_create(fd, OBJECT_SIZE); - ptr = __gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE); - igt_assert(ptr); + ptr = gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE); if (order == READ_BEFORE_WRITE) { val = *(uint32_t *)ptr; @@ -203,11 +201,9 @@ test_read_write2(int fd, enum test_read_write order) handle = gem_create(fd, OBJECT_SIZE); - r = __gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_READ); - igt_assert(r); + r = gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_READ); - w = __gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE); - igt_assert(w); + w = gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE); if (order == READ_BEFORE_WRITE) { val = *(uint32_t *)r; @@ -291,13 +287,11 @@ test_huge_bo(int fd, int huge, int tiling) bo = gem_create(fd, PAGE_SIZE); if (tiling) gem_set_tiling(fd, bo, tiling, pitch); - linear_pattern = __gem_mmap__gtt(fd, bo, PAGE_SIZE, + linear_pattern = gem_mmap__gtt(fd, bo, PAGE_SIZE, PROT_READ | PROT_WRITE); - igt_assert(linear_pattern); for (i = 0; i < PAGE_SIZE; i++) linear_pattern[i] = i; - tiled_pattern = __gem_mmap__cpu(fd, bo, 0, PAGE_SIZE, PROT_READ); - igt_assert(tiled_pattern); + tiled_pattern = gem_mmap__cpu(fd, bo, 0, PAGE_SIZE, PROT_READ); gem_set_domain(fd, bo, I915_GEM_DOMAIN_CPU | I915_GEM_DOMAIN_GTT, 0); gem_close(fd, bo); @@ -307,7 +301,7 @@ test_huge_bo(int fd, int huge, int tiling) gem_set_tiling(fd, bo, tiling, pitch); /* Initialise first/last page through CPU mmap */ - ptr = __gem_mmap__cpu(fd, bo, 0, size, PROT_READ | PROT_WRITE); + ptr = gem_mmap__cpu(fd, bo, 0, size, PROT_READ | PROT_WRITE); memcpy(ptr, tiled_pattern, PAGE_SIZE); memcpy(ptr + last_offset, tiled_pattern, PAGE_SIZE); munmap(ptr, size); @@ -440,11 +434,9 @@ test_write_cpu_read_gtt(int fd) handle = gem_create(fd, OBJECT_SIZE); - dst = __gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_READ); - igt_assert(dst); + dst = gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_READ); - src = __gem_mmap__cpu(fd, handle, 0, OBJECT_SIZE, PROT_WRITE); - igt_assert(src); + src = gem_mmap__cpu(fd, handle, 0, OBJECT_SIZE, PROT_WRITE); gem_close(fd, handle); diff --git a/tests/gem_mmap_offset_exhaustion.c b/tests/gem_mmap_offset_exhaustion.c index 50153cc..8c8e3fa 100644 --- a/tests/gem_mmap_offset_exhaustion.c +++ b/tests/gem_mmap_offset_exhaustion.c @@ -60,8 +60,7 @@ create_and_map_bo(int fd) handle = gem_create(fd, OBJECT_SIZE); - ptr = __gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE); - igt_assert(ptr); + ptr = gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE); /* touch it to force it into the gtt */ *ptr = 0; diff --git a/tests/gem_mmap_wc.c b/tests/gem_mmap_wc.c index 377749c..91588a4 100644 --- a/tests/gem_mmap_wc.c +++ b/tests/gem_mmap_wc.c @@ -62,8 +62,7 @@ mmap_bo(int fd, uint32_t handle) { void *ptr; - ptr = __gem_mmap__wc(fd, handle, 0, OBJECT_SIZE, PROT_READ | PROT_WRITE); - igt_assert(ptr); + ptr = gem_mmap__wc(fd, handle, 0, OBJECT_SIZE, PROT_READ | PROT_WRITE); return ptr; } @@ -183,11 +182,9 @@ test_read_write2(int fd, enum test_read_write order) handle = gem_create(fd, OBJECT_SIZE); set_domain(fd, handle); - r = __gem_mmap__wc(fd, handle, 0, OBJECT_SIZE, PROT_READ); - igt_assert(r); + r = gem_mmap__wc(fd, handle, 0, OBJECT_SIZE, PROT_READ); - w = __gem_mmap__wc(fd, handle, 0, OBJECT_SIZE, PROT_READ | PROT_WRITE); - igt_assert(w); + w = gem_mmap__wc(fd, handle, 0, OBJECT_SIZE, PROT_READ | PROT_WRITE); if (order == READ_BEFORE_WRITE) { val = *(uint32_t *)r; @@ -288,11 +285,9 @@ test_write_cpu_read_wc(int fd, int force_domain) handle = gem_create(fd, OBJECT_SIZE); - dst = __gem_mmap__wc(fd, handle, 0, OBJECT_SIZE, PROT_READ); - igt_assert(dst); + dst = gem_mmap__wc(fd, handle, 0, OBJECT_SIZE, PROT_READ); - src = __gem_mmap__cpu(fd, handle, 0, OBJECT_SIZE, PROT_WRITE); - igt_assert(src); + src = gem_mmap__cpu(fd, handle, 0, OBJECT_SIZE, PROT_WRITE); memset(src, 0xaa, OBJECT_SIZE); if (force_domain) @@ -315,11 +310,9 @@ test_write_gtt_read_wc(int fd) handle = gem_create(fd, OBJECT_SIZE); set_domain(fd, handle); - dst = __gem_mmap__wc(fd, handle, 0, OBJECT_SIZE, PROT_READ); - igt_assert(dst); + dst = gem_mmap__wc(fd, handle, 0, OBJECT_SIZE, PROT_READ); - src = __gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_WRITE); - igt_assert(src); + src = gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_WRITE); memset(src, 0xaa, OBJECT_SIZE); igt_assert(memcmp(dst, src, OBJECT_SIZE) == 0); diff --git a/tests/gem_persistent_relocs.c b/tests/gem_persistent_relocs.c index db69f3a..509c812 100644 --- a/tests/gem_persistent_relocs.c +++ b/tests/gem_persistent_relocs.c @@ -225,10 +225,8 @@ static void do_test(int fd, bool faulting_reloc) relocs_bo_handle[i] = gem_create(fd, 4096); gem_write(fd, relocs_bo_handle[i], 0, reloc, sizeof(reloc)); - gtt_relocs_ptr[i] = __gem_mmap__gtt(fd, relocs_bo_handle[i], 4096, - PROT_READ | PROT_WRITE); - igt_assert(gtt_relocs_ptr[i]); - + gtt_relocs_ptr[i] = gem_mmap__gtt(fd, relocs_bo_handle[i], 4096, + PROT_READ | PROT_WRITE); } /* repeat must be smaller than 4096/small_pitch */ diff --git a/tests/gem_pwrite.c b/tests/gem_pwrite.c index 8080981..3a913f9 100644 --- a/tests/gem_pwrite.c +++ b/tests/gem_pwrite.c @@ -118,8 +118,7 @@ static void test_big_gtt(int fd, int scale) handle = gem_create(fd, size); gem_set_domain(fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); - ptr = __gem_mmap__wc(fd, handle, 0, size, PROT_READ); - igt_assert(ptr); + ptr = gem_mmap__wc(fd, handle, 0, size, PROT_READ); for (offset = 0; offset < size; offset += 4096) { int suboffset = (offset >> 12) % (4096 / sizeof(offset) - 1) * sizeof(offset); diff --git a/tests/gem_pwrite_pread.c b/tests/gem_pwrite_pread.c index 5408140..ef8890e 100644 --- a/tests/gem_pwrite_pread.c +++ b/tests/gem_pwrite_pread.c @@ -112,10 +112,8 @@ static void as_gtt_mmap(int fd, uint32_t src, uint32_t dst, void *buf, int len, uint32_t *src_ptr, *dst_ptr; BUILD_EXEC; - src_ptr = __gem_mmap__gtt(fd, src, OBJECT_SIZE, PROT_WRITE); - igt_assert(src_ptr); - dst_ptr = __gem_mmap__gtt(fd, dst, OBJECT_SIZE, PROT_READ); - igt_assert(dst_ptr); + src_ptr = gem_mmap__gtt(fd, src, OBJECT_SIZE, PROT_WRITE); + dst_ptr = gem_mmap__gtt(fd, dst, OBJECT_SIZE, PROT_READ); while (loops--) { gem_set_domain(fd, src, @@ -139,10 +137,8 @@ static void as_cpu_mmap(int fd, uint32_t src, uint32_t dst, void *buf, int len, uint32_t *src_ptr, *dst_ptr; BUILD_EXEC; - src_ptr = __gem_mmap__cpu(fd, src, 0, OBJECT_SIZE, PROT_WRITE); - igt_assert(src_ptr); - dst_ptr = __gem_mmap__cpu(fd, dst, 0, OBJECT_SIZE, PROT_READ); - igt_assert(dst_ptr); + src_ptr = gem_mmap__cpu(fd, src, 0, OBJECT_SIZE, PROT_WRITE); + dst_ptr = gem_mmap__cpu(fd, dst, 0, OBJECT_SIZE, PROT_READ); while (loops--) { gem_set_domain(fd, src, @@ -186,10 +182,8 @@ static void test_as_gtt_mmap(int fd, uint32_t src, uint32_t dst, int len) int i; BUILD_EXEC; - src_ptr = __gem_mmap__gtt(fd, src, OBJECT_SIZE, PROT_WRITE); - igt_assert(src_ptr); - dst_ptr = __gem_mmap__gtt(fd, dst, OBJECT_SIZE, PROT_READ); - igt_assert(dst_ptr); + src_ptr = gem_mmap__gtt(fd, src, OBJECT_SIZE, PROT_WRITE); + dst_ptr = gem_mmap__gtt(fd, dst, OBJECT_SIZE, PROT_READ); gem_set_domain(fd, src, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); for (i = 0; i < len/4; i++) @@ -212,10 +206,8 @@ static void test_as_cpu_mmap(int fd, uint32_t src, uint32_t dst, int len) int i; BUILD_EXEC; - src_ptr = __gem_mmap__cpu(fd, src, 0, OBJECT_SIZE, PROT_WRITE); - igt_assert(src_ptr); - dst_ptr = __gem_mmap__cpu(fd, dst, 0, OBJECT_SIZE, PROT_READ); - igt_assert(dst_ptr); + src_ptr = gem_mmap__cpu(fd, src, 0, OBJECT_SIZE, PROT_WRITE); + dst_ptr = gem_mmap__cpu(fd, dst, 0, OBJECT_SIZE, PROT_READ); gem_set_domain(fd, src, I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU); for (i = 0; i < len/4; i++) diff --git a/tests/gem_reloc_vs_gpu.c b/tests/gem_reloc_vs_gpu.c index 59ba8c0..e06b98a 100644 --- a/tests/gem_reloc_vs_gpu.c +++ b/tests/gem_reloc_vs_gpu.c @@ -162,9 +162,8 @@ static void reloc_and_emit(int fd, drm_intel_bo *target_bo, bool faulting_reloc) handle_relocs = gem_create(fd, 4096); gem_write(fd, handle_relocs, 0, reloc, sizeof(reloc)); - gtt_relocs = __gem_mmap__gtt(fd, handle_relocs, 4096, - PROT_READ | PROT_WRITE); - igt_assert(gtt_relocs); + gtt_relocs = gem_mmap__gtt(fd, handle_relocs, 4096, + PROT_READ | PROT_WRITE); exec[1].handle = special_bo->handle; exec[1].relocation_count = 1; diff --git a/tests/gem_set_tiling_vs_gtt.c b/tests/gem_set_tiling_vs_gtt.c index 6f04735..2611ec5 100644 --- a/tests/gem_set_tiling_vs_gtt.c +++ b/tests/gem_set_tiling_vs_gtt.c @@ -66,8 +66,7 @@ igt_simple_main tile_height = 8; handle = gem_create(fd, OBJECT_SIZE); - ptr = __gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE); - igt_assert(ptr); + ptr = gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE); /* gtt coherency is done with set_domain in libdrm, don't break that */ gem_set_domain(fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); diff --git a/tests/gem_set_tiling_vs_pwrite.c b/tests/gem_set_tiling_vs_pwrite.c index 5c2e93a..006edfe 100644 --- a/tests/gem_set_tiling_vs_pwrite.c +++ b/tests/gem_set_tiling_vs_pwrite.c @@ -62,8 +62,7 @@ igt_simple_main data[i] = i; handle = gem_create(fd, OBJECT_SIZE); - ptr = __gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE); - igt_assert(ptr); + ptr = gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE); gem_set_tiling(fd, handle, I915_TILING_X, TEST_STRIDE); diff --git a/tests/gem_streaming_writes.c b/tests/gem_streaming_writes.c index 6664582..5b365c9 100644 --- a/tests/gem_streaming_writes.c +++ b/tests/gem_streaming_writes.c @@ -88,22 +88,21 @@ static void test_streaming(int fd, int mode, int sync) switch (mode) { case 0: /* cpu/snoop */ gem_set_caching(fd, src, I915_CACHING_CACHED); - s = __gem_mmap__cpu(fd, src, 0, OBJECT_SIZE, PROT_READ | PROT_WRITE); - igt_assert(s); + s = gem_mmap__cpu(fd, src, 0, OBJECT_SIZE, + PROT_READ | PROT_WRITE); break; case 1: /* gtt */ - s = __gem_mmap__gtt(fd, src, OBJECT_SIZE, PROT_READ | PROT_WRITE); - igt_assert(s); + s = gem_mmap__gtt(fd, src, OBJECT_SIZE, + PROT_READ | PROT_WRITE); break; case 2: /* wc */ - s = __gem_mmap__wc(fd, src, 0, OBJECT_SIZE, PROT_READ | PROT_WRITE); - igt_assert(s); + s = gem_mmap__wc(fd, src, 0, OBJECT_SIZE, + PROT_READ | PROT_WRITE); break; } *s = 0; /* fault the object into the mappable range first (for GTT) */ - d = __gem_mmap__cpu(fd, dst, 0, OBJECT_SIZE, PROT_READ); - igt_assert(d); + d = gem_mmap__cpu(fd, dst, 0, OBJECT_SIZE, PROT_READ); gem_write(fd, dst, 0, tmp, sizeof(tmp)); memset(&execbuf, 0, sizeof(execbuf)); @@ -154,8 +153,7 @@ static void test_streaming(int fd, int mode, int sync) batch[i].handle = gem_create(fd, 4096); batch[i].offset = 0; - base = __gem_mmap__cpu(fd, batch[i].handle, 0, 4096, PROT_WRITE); - igt_assert(base); + base = gem_mmap__cpu(fd, batch[i].handle, 0, 4096, PROT_WRITE); for (int j = 0; j < 64; j++) { unsigned x = (n * CHUNK_SIZE) % 4096 >> 2; @@ -254,11 +252,9 @@ static void test_batch(int fd, int mode, int reverse) exec[DST].handle = gem_create(fd, OBJECT_SIZE); exec[SRC].handle = gem_create(fd, OBJECT_SIZE); - s = __gem_mmap__wc(fd, src, 0, OBJECT_SIZE, PROT_READ | PROT_WRITE); - igt_assert(s); + s = gem_mmap__wc(fd, src, 0, OBJECT_SIZE, PROT_READ | PROT_WRITE); - d = __gem_mmap__cpu(fd, dst, 0, OBJECT_SIZE, PROT_READ); - igt_assert(d); + d = gem_mmap__cpu(fd, dst, 0, OBJECT_SIZE, PROT_READ); memset(reloc, 0, sizeof(reloc)); reloc[0].offset = 4 * sizeof(uint32_t); @@ -285,16 +281,16 @@ static void test_batch(int fd, int mode, int reverse) switch (mode) { case 0: /* cpu/snoop */ igt_require(gem_has_llc(fd)); - base = __gem_mmap__cpu(fd, exec[BATCH].handle, 0, batch_size, PROT_READ | PROT_WRITE); - igt_assert(base); + base = gem_mmap__cpu(fd, exec[BATCH].handle, 0, batch_size, + PROT_READ | PROT_WRITE); break; case 1: /* gtt */ - base = __gem_mmap__gtt(fd, exec[BATCH].handle, batch_size, PROT_READ | PROT_WRITE); - igt_assert(base); + base = gem_mmap__gtt(fd, exec[BATCH].handle, batch_size, + PROT_READ | PROT_WRITE); break; case 2: /* wc */ - base = __gem_mmap__wc(fd, exec[BATCH].handle, 0, batch_size, PROT_READ | PROT_WRITE); - igt_assert(base); + base = gem_mmap__wc(fd, exec[BATCH].handle, 0, batch_size, + PROT_READ | PROT_WRITE); break; } *base = 0; /* fault the object into the mappable range first */ diff --git a/tests/gem_tiled_pread_basic.c b/tests/gem_tiled_pread_basic.c index 14a3706..1dfd87c 100644 --- a/tests/gem_tiled_pread_basic.c +++ b/tests/gem_tiled_pread_basic.c @@ -72,8 +72,8 @@ create_bo(int fd) gem_set_tiling(fd, handle, I915_TILING_X, WIDTH * sizeof(uint32_t)); /* Fill the BO with dwords starting at start_val */ - data = __gem_mmap__gtt(fd, handle, sizeof(linear), PROT_READ | PROT_WRITE); - igt_assert(data); + data = gem_mmap__gtt(fd, handle, sizeof(linear), + PROT_READ | PROT_WRITE); for (i = 0; i < WIDTH*HEIGHT; i++) data[i] = i; munmap(data, sizeof(linear)); diff --git a/tests/gem_tiled_pread_pwrite.c b/tests/gem_tiled_pread_pwrite.c index 8ae23e3..a1d6ed5 100644 --- a/tests/gem_tiled_pread_pwrite.c +++ b/tests/gem_tiled_pread_pwrite.c @@ -79,8 +79,8 @@ create_bo_and_fill(int fd) gem_set_tiling(fd, handle, current_tiling_mode, WIDTH * sizeof(uint32_t)); /* Fill the BO with dwords starting at start_val */ - data = __gem_mmap__gtt(fd, handle, sizeof(linear), PROT_READ | PROT_WRITE); - igt_assert(data); + data = gem_mmap__gtt(fd, handle, sizeof(linear), + PROT_READ | PROT_WRITE); for (i = 0; i < WIDTH*HEIGHT; i++) data[i] = i; munmap(data, sizeof(linear)); @@ -123,8 +123,7 @@ igt_simple_main gem_write(fd, handle_target, 0, linear, sizeof(linear)); /* Check the target bo's contents. */ - data = __gem_mmap__gtt(fd, handle_target, sizeof(linear), PROT_READ | PROT_WRITE); - igt_assert(data); + data = gem_mmap__gtt(fd, handle_target, sizeof(linear), PROT_READ | PROT_WRITE); for (j = 0; j < WIDTH*HEIGHT; j++) igt_assert_f(data[j] == j, "mismatch at %i: %i\n", diff --git a/tests/gem_tiled_swapping.c b/tests/gem_tiled_swapping.c index 730e625..f45244b 100644 --- a/tests/gem_tiled_swapping.c +++ b/tests/gem_tiled_swapping.c @@ -94,8 +94,8 @@ fill_bo(int fd, uint32_t handle) uint32_t *data; int i; - data = __gem_mmap__gtt(fd, handle, LINEAR_DWORDS, PROT_READ | PROT_WRITE); - igt_assert(data); + data = gem_mmap__gtt(fd, handle, LINEAR_DWORDS, + PROT_READ | PROT_WRITE); gem_set_domain(fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); for (i = 0; i < WIDTH*HEIGHT; i++) @@ -109,8 +109,7 @@ check_bo(int fd, uint32_t handle) uint32_t *data; int j; - data = __gem_mmap__gtt(fd, handle, LINEAR_DWORDS, PROT_READ); - igt_assert(data); + data = gem_mmap__gtt(fd, handle, LINEAR_DWORDS, PROT_READ); gem_set_domain(fd, handle, I915_GEM_DOMAIN_GTT, 0); j = rand() % (WIDTH * HEIGHT); igt_assert_f(data[j] == j, "mismatch at %i: %i\n", j, data[j]); diff --git a/tests/gem_tiled_wb.c b/tests/gem_tiled_wb.c index 0a30a48..227ebde 100644 --- a/tests/gem_tiled_wb.c +++ b/tests/gem_tiled_wb.c @@ -71,8 +71,7 @@ create_bo(int fd) /* Write throught the fence to tiled the data. * We then manually detile on reading back through the mmap(wc). */ - data = __gem_mmap__gtt(fd, handle, SIZE, PROT_READ | PROT_WRITE); - igt_assert(data); + data = gem_mmap__gtt(fd, handle, SIZE, PROT_READ | PROT_WRITE); for (i = 0; i < WIDTH*HEIGHT; i++) data[i] = i; munmap(data, SIZE); @@ -179,9 +178,7 @@ igt_simple_main last_page = (offset + len + PAGE_SIZE) & ~(PAGE_SIZE-1); offset -= first_page; - linear = __gem_mmap__cpu(fd, handle, first_page, last_page - first_page, PROT_READ); - igt_assert(linear); - + linear = gem_mmap__cpu(fd, handle, first_page, last_page - first_page, PROT_READ); /* Translate from offsets in the read buffer to the swizzled * address that it corresponds to. This is the opposite of diff --git a/tests/gem_tiled_wc.c b/tests/gem_tiled_wc.c index 66b35c8..a6316cc 100644 --- a/tests/gem_tiled_wc.c +++ b/tests/gem_tiled_wc.c @@ -65,8 +65,7 @@ create_bo(int fd) gem_set_tiling(fd, handle, I915_TILING_X, WIDTH * sizeof(uint32_t)); /* Fill the BO with dwords starting at start_val */ - data = __gem_mmap__gtt(fd, handle, SIZE, PROT_READ | PROT_WRITE); - igt_assert(data); + data = gem_mmap__gtt(fd, handle, SIZE, PROT_READ | PROT_WRITE); for (i = 0; i < WIDTH*HEIGHT; i++) data[i] = i; munmap(data, SIZE); @@ -174,8 +173,7 @@ igt_simple_main first_page = offset & ~(PAGE_SIZE-1); last_page = (offset + len + PAGE_SIZE) & ~(PAGE_SIZE-1); - linear = __gem_mmap__wc(fd, handle, first_page, last_page - first_page, PROT_READ); - igt_assert(linear); + linear = gem_mmap__wc(fd, handle, first_page, last_page - first_page, PROT_READ); /* Translate from offsets in the read buffer to the swizzled * address that it corresponds to. This is the opposite of diff --git a/tests/gem_tiling_max_stride.c b/tests/gem_tiling_max_stride.c index 0867335..a6f97a9 100644 --- a/tests/gem_tiling_max_stride.c +++ b/tests/gem_tiling_max_stride.c @@ -97,8 +97,7 @@ igt_simple_main handle = gem_create(fd, size); - ptr = __gem_mmap__gtt(fd, handle, size, PROT_READ | PROT_WRITE); - igt_assert(ptr); + ptr = gem_mmap__gtt(fd, handle, size, PROT_READ | PROT_WRITE); test_invalid_tiling(fd, handle, 0); test_invalid_tiling(fd, handle, 64); diff --git a/tests/gem_userptr_blits.c b/tests/gem_userptr_blits.c index 93461c2..6a6d5bf 100644 --- a/tests/gem_userptr_blits.c +++ b/tests/gem_userptr_blits.c @@ -544,9 +544,9 @@ static int test_invalid_gtt_mapping(int fd) /* GTT mapping */ handle = create_bo(fd, 0); - ptr = __gem_mmap__gtt(fd, handle, sizeof(linear), PROT_READ | PROT_WRITE); + ptr = gem_mmap__gtt(fd, handle, sizeof(linear), + PROT_READ | PROT_WRITE); gem_close(fd, handle); - igt_assert(ptr); igt_assert(((unsigned long)ptr & (PAGE_SIZE - 1)) == 0); igt_assert((sizeof(linear) & (PAGE_SIZE - 1)) == 0); @@ -688,13 +688,12 @@ static void *umap(int fd, uint32_t handle) void *ptr; if (gem_has_llc(fd)) { - ptr = __gem_mmap__gtt(fd, handle, sizeof(linear), PROT_READ | PROT_WRITE); - igt_assert(ptr); + ptr = gem_mmap__gtt(fd, handle, sizeof(linear), + PROT_READ | PROT_WRITE); } else { uint32_t tmp = gem_create(fd, sizeof(linear)); copy(fd, tmp, handle, 0); - ptr = __gem_mmap__cpu(fd, tmp, 0, sizeof(linear), PROT_READ); - igt_assert(ptr); + ptr = gem_mmap__cpu(fd, tmp, 0, sizeof(linear), PROT_READ); gem_close(fd, tmp); } diff --git a/tests/gen3_mixed_blits.c b/tests/gen3_mixed_blits.c index 0089eb3..dce92b0 100644 --- a/tests/gen3_mixed_blits.c +++ b/tests/gen3_mixed_blits.c @@ -426,8 +426,8 @@ create_bo(int fd, uint32_t val, int tiling) gem_set_tiling(fd, handle, tiling, WIDTH*4); /* Fill the BO with dwords starting at val */ - v = __gem_mmap__gtt(fd, handle, WIDTH*HEIGHT*4, PROT_READ | PROT_WRITE); - igt_assert(v); + v = gem_mmap__gtt(fd, handle, WIDTH * HEIGHT * 4, + PROT_READ | PROT_WRITE); for (i = 0; i < WIDTH*HEIGHT; i++) v[i] = val++; munmap(v, WIDTH*HEIGHT*4); @@ -441,8 +441,7 @@ check_bo(int fd, uint32_t handle, uint32_t val) uint32_t *v; int i; - v = __gem_mmap__gtt(fd, handle, WIDTH*HEIGHT*4, PROT_READ); - igt_assert(v); + v = gem_mmap__gtt(fd, handle, WIDTH * HEIGHT * 4, PROT_READ); for (i = 0; i < WIDTH*HEIGHT; i++) { igt_assert_f(v[i] == val, "Expected 0x%08x, found 0x%08x " diff --git a/tests/gen3_render_mixed_blits.c b/tests/gen3_render_mixed_blits.c index 6dd728d..6cc8d05 100644 --- a/tests/gen3_render_mixed_blits.c +++ b/tests/gen3_render_mixed_blits.c @@ -314,8 +314,8 @@ create_bo(int fd, uint32_t val, int tiling) gem_set_tiling(fd, handle, tiling, WIDTH*4); /* Fill the BO with dwords starting at val */ - v = __gem_mmap__gtt(fd, handle, WIDTH*HEIGHT*4, PROT_READ | PROT_WRITE); - igt_assert(v); + v = gem_mmap__gtt(fd, handle, WIDTH * HEIGHT * 4, + PROT_READ | PROT_WRITE); for (i = 0; i < WIDTH*HEIGHT; i++) v[i] = val++; munmap(v, WIDTH*HEIGHT*4); @@ -329,8 +329,7 @@ check_bo(int fd, uint32_t handle, uint32_t val) uint32_t *v; int i; - v = __gem_mmap__gtt(fd, handle, WIDTH*HEIGHT*4, PROT_READ); - igt_assert(v); + v = gem_mmap__gtt(fd, handle, WIDTH * HEIGHT * 4, PROT_READ); for (i = 0; i < WIDTH*HEIGHT; i++) { igt_assert_f(v[i] == val, "Expected 0x%08x, found 0x%08x " diff --git a/tests/gen3_render_tiledx_blits.c b/tests/gen3_render_tiledx_blits.c index 1abcaaa..6706d3a 100644 --- a/tests/gen3_render_tiledx_blits.c +++ b/tests/gen3_render_tiledx_blits.c @@ -301,8 +301,8 @@ create_bo(int fd, uint32_t val) gem_set_tiling(fd, handle, I915_TILING_X, WIDTH*4); /* Fill the BO with dwords starting at val */ - v = __gem_mmap__gtt(fd, handle, WIDTH*HEIGHT*4, PROT_READ | PROT_WRITE); - igt_assert(v); + v = gem_mmap__gtt(fd, handle, WIDTH * HEIGHT * 4, + PROT_READ | PROT_WRITE); for (i = 0; i < WIDTH*HEIGHT; i++) v[i] = val++; munmap(v, WIDTH*HEIGHT*4); @@ -316,8 +316,7 @@ check_bo(int fd, uint32_t handle, uint32_t val) uint32_t *v; int i; - v = __gem_mmap__gtt(fd, handle, WIDTH*HEIGHT*4, PROT_READ); - igt_assert(v); + v = gem_mmap__gtt(fd, handle, WIDTH * HEIGHT * 4, PROT_READ); for (i = 0; i < WIDTH*HEIGHT; i++) { igt_assert_f(v[i] == val, "Expected 0x%08x, found 0x%08x " diff --git a/tests/gen3_render_tiledy_blits.c b/tests/gen3_render_tiledy_blits.c index e90645a..44e88d4 100644 --- a/tests/gen3_render_tiledy_blits.c +++ b/tests/gen3_render_tiledy_blits.c @@ -301,8 +301,8 @@ create_bo(int fd, uint32_t val) gem_set_tiling(fd, handle, I915_TILING_Y, WIDTH*4); /* Fill the BO with dwords starting at val */ - v = __gem_mmap__gtt(fd, handle, WIDTH*HEIGHT*4, PROT_READ | PROT_WRITE); - igt_assert(v); + v = gem_mmap__gtt(fd, handle, WIDTH * HEIGHT * 4, + PROT_READ | PROT_WRITE); for (i = 0; i < WIDTH*HEIGHT; i++) v[i] = val++; munmap(v, WIDTH*HEIGHT*4); @@ -316,8 +316,7 @@ check_bo(int fd, uint32_t handle, uint32_t val) uint32_t *v; int i; - v = __gem_mmap__gtt(fd, handle, WIDTH*HEIGHT*4, PROT_READ); - igt_assert(v); + v = gem_mmap__gtt(fd, handle, WIDTH * HEIGHT * 4, PROT_READ); for (i = 0; i < WIDTH*HEIGHT; i++) { igt_assert_f(v[i] == val, "Expected 0x%08x, found 0x%08x " diff --git a/tests/gen7_forcewake_mt.c b/tests/gen7_forcewake_mt.c index f7a5aa1..dea1e8a 100644 --- a/tests/gen7_forcewake_mt.c +++ b/tests/gen7_forcewake_mt.c @@ -190,8 +190,7 @@ igt_simple_main gem_execbuf(t[0].fd, &execbuf); gem_sync(t[0].fd, exec[1].handle); - p = __gem_mmap__gtt(t[0].fd, exec[0].handle, 4096, PROT_READ); - igt_assert(p); + p = gem_mmap__gtt(t[0].fd, exec[0].handle, 4096, PROT_READ); igt_info("[%d]={ %08x %08x }\n", i, p[0], p[1]); igt_assert(p[0] & 2); diff --git a/tests/kms_fbc_crc.c b/tests/kms_fbc_crc.c index c31dbdd..d580a94 100644 --- a/tests/kms_fbc_crc.c +++ b/tests/kms_fbc_crc.c @@ -188,8 +188,7 @@ static void fill_mmap_cpu(data_t *data, uint32_t handle, unsigned char color) { void *ptr; - ptr = __gem_mmap__cpu(data->drm_fd, handle, 0, 4096, PROT_WRITE); - igt_assert(ptr); + ptr = gem_mmap__cpu(data->drm_fd, handle, 0, 4096, PROT_WRITE); gem_set_domain(data->drm_fd, handle, I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU); memset(ptr, color, 4); @@ -201,8 +200,7 @@ static void fill_mmap_gtt(data_t *data, uint32_t handle, unsigned char color) { void *ptr; - ptr = __gem_mmap__gtt(data->drm_fd, handle, 4096, PROT_WRITE); - igt_assert(ptr); + ptr = gem_mmap__gtt(data->drm_fd, handle, 4096, PROT_WRITE); gem_set_domain(data->drm_fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); memset(ptr, color, 4); diff --git a/tests/kms_fence_pin_leak.c b/tests/kms_fence_pin_leak.c index 41ce084..7d4ffbc 100644 --- a/tests/kms_fence_pin_leak.c +++ b/tests/kms_fence_pin_leak.c @@ -89,8 +89,7 @@ static void touch_fences(data_t *data) uint32_t handle = data->bos[i]->handle; void *ptr; - ptr = __gem_mmap__gtt(data->drm_fd, handle, 4096, PROT_WRITE); - igt_assert(ptr); + ptr = gem_mmap__gtt(data->drm_fd, handle, 4096, PROT_WRITE); gem_set_domain(data->drm_fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); memset(ptr, 0, 4); munmap(ptr, 4096); diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c index 2da2a61..387c615 100644 --- a/tests/kms_psr_sink_crc.c +++ b/tests/kms_psr_sink_crc.c @@ -379,9 +379,8 @@ static void run_test(data_t *data) expected = "still GREEN"; break; case MMAP_GTT: - ptr = __gem_mmap__gtt(data->drm_fd, handle, data->mod_size, + ptr = gem_mmap__gtt(data->drm_fd, handle, data->mod_size, PROT_WRITE); - igt_assert(ptr); gem_set_domain(data->drm_fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); memset(ptr, 0xcc, data->mod_size); @@ -389,9 +388,8 @@ static void run_test(data_t *data) expected = "BLACK or TRANSPARENT mark on top of plane in test"; break; case MMAP_GTT_WAITING: - ptr = __gem_mmap__gtt(data->drm_fd, handle, data->mod_size, + ptr = gem_mmap__gtt(data->drm_fd, handle, data->mod_size, PROT_WRITE); - igt_assert(ptr); gem_set_domain(data->drm_fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); @@ -413,8 +411,8 @@ static void run_test(data_t *data) expected = "BLACK or TRANSPARENT mark on top of plane in test"; break; case MMAP_CPU: - ptr = __gem_mmap__cpu(data->drm_fd, handle, 0, data->mod_size, PROT_WRITE); - igt_assert(ptr); + ptr = gem_mmap__cpu(data->drm_fd, handle, 0, data->mod_size, + PROT_WRITE); gem_set_domain(data->drm_fd, handle, I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU); memset(ptr, 0, data->mod_size); diff --git a/tests/pm_rpm.c b/tests/pm_rpm.c index 7c3e7ca..d43cc06 100644 --- a/tests/pm_rpm.c +++ b/tests/pm_rpm.c @@ -973,13 +973,11 @@ static void gem_mmap_subtest(bool gtt_mmap) handle = gem_create(drm_fd, buf_size); if (gtt_mmap) { - gem_buf = __gem_mmap__gtt(drm_fd, handle, buf_size, + gem_buf = gem_mmap__gtt(drm_fd, handle, buf_size, PROT_READ | PROT_WRITE); - igt_assert(gem_buf); } else { - gem_buf = __gem_mmap__cpu(drm_fd, handle, 0, buf_size, 0); - igt_assert(gem_buf); + gem_buf = gem_mmap__cpu(drm_fd, handle, 0, buf_size, 0); } @@ -1012,13 +1010,11 @@ static void gem_mmap_subtest(bool gtt_mmap) disable_all_screens_and_wait(&ms_data); if (gtt_mmap) { - gem_buf = __gem_mmap__gtt(drm_fd, handle, buf_size, + gem_buf = gem_mmap__gtt(drm_fd, handle, buf_size, PROT_READ | PROT_WRITE); - igt_assert(gem_buf); } else { - gem_buf = __gem_mmap__cpu(drm_fd, handle, 0, buf_size, 0); - igt_assert(gem_buf); + gem_buf = gem_mmap__cpu(drm_fd, handle, 0, buf_size, 0); } igt_assert(wait_for_suspended()); @@ -1474,8 +1470,7 @@ static void fill_igt_fb(struct igt_fb *fb, uint32_t color) int i; uint32_t *ptr; - ptr = __gem_mmap__gtt(drm_fd, fb->gem_handle, fb->size, PROT_WRITE); - igt_assert(ptr); + ptr = gem_mmap__gtt(drm_fd, fb->gem_handle, fb->size, PROT_WRITE); for (i = 0; i < fb->size/sizeof(uint32_t); i++) ptr[i] = color; igt_assert(munmap(ptr, fb->size) == 0); @@ -1756,9 +1751,8 @@ static void fences_subtest(bool dpms) gem_get_tiling(drm_fd, params.fb.gem_handle, &tiling, &swizzle); igt_assert(tiling); - buf_ptr = __gem_mmap__gtt(drm_fd, params.fb.gem_handle, - params.fb.size, PROT_WRITE | PROT_READ); - igt_assert(buf_ptr); + buf_ptr = gem_mmap__gtt(drm_fd, params.fb.gem_handle, params.fb.size, + PROT_WRITE | PROT_READ); for (i = 0; i < params.fb.size/sizeof(uint32_t); i++) buf_ptr[i] = i; diff --git a/tests/prime_self_import.c b/tests/prime_self_import.c index 23d349e..91fe231 100644 --- a/tests/prime_self_import.c +++ b/tests/prime_self_import.c @@ -60,10 +60,8 @@ check_bo(int fd1, uint32_t handle1, int fd2, uint32_t handle2) char *ptr1, *ptr2; int i; - ptr1 = __gem_mmap__gtt(fd1, handle1, BO_SIZE, PROT_READ | PROT_WRITE); - igt_assert(ptr1); - ptr2 = __gem_mmap__gtt(fd2, handle2, BO_SIZE, PROT_READ | PROT_WRITE); - igt_assert(ptr2); + ptr1 = gem_mmap__gtt(fd1, handle1, BO_SIZE, PROT_READ | PROT_WRITE); + ptr2 = gem_mmap__gtt(fd2, handle2, BO_SIZE, PROT_READ | PROT_WRITE); /* check whether it's still our old object first. */ for (i = 0; i < BO_SIZE; i++) { diff --git a/tests/testdisplay.c b/tests/testdisplay.c index 6d206e3..4efcb59 100644 --- a/tests/testdisplay.c +++ b/tests/testdisplay.c @@ -221,9 +221,8 @@ paint_color_key(struct igt_fb *fb_info) int i, j; uint32_t *fb_ptr; - fb_ptr = __gem_mmap__gtt(drm_fd, fb_info->gem_handle, - fb_info->size, PROT_READ | PROT_WRITE); - igt_assert(fb_ptr); + fb_ptr = gem_mmap__gtt(drm_fd, fb_info->gem_handle, fb_info->size, + PROT_READ | PROT_WRITE); for (i = crtc_y; i < crtc_y + crtc_h; i++) for (j = crtc_x; j < crtc_x + crtc_w; j++) { -- 2.4.9 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx