drmtest: remove unused argument from gem_mmap__cpu
PATCH 1/2 drmtest: remove unused argument from gem_mmap__cpu
From: Paulo Zanoni <[email protected]>
That's just misleading.
Signed-off-by Paulo Zanoni <[email protected]>
--- lib/drmtest.c | 2 +- lib/drmtest.h | 2 +- tests/gem_cs_tlb.c | 3 +-- tests/gem_evict_everything.c | 3 +-- tests/gem_fence_thrash.c | 2 +- tests/gem_gtt_speed.c | 10 +++++----- tests/gem_pwrite_pread.c | 8 ++++---- 7 files changed, 14 insertions(+), 16 deletions(-)
lib/drmtest.c +1 -1
@@ -557,7 +557,7 @@ void *gem_mmap__gtt(int fd, uint32_t handle, int size, int prot)return ptr; } -void *gem_mmap__cpu (int fd,uint32_t handle,int size,int prot) +void *gem_mmap__cpu (int fd,uint32_t handle,int size) {struct drm_i915_gem_mmap mmap_arg;
lib/drmtest.h +1 -1
@@ -77,7 +77,7 @@ uint32_t gem_create(int fd, int size);void gem_execbuf (int fd,struct drm_i915_gem_execbuffer2 *execbuf);void *gem_mmap__gtt (int fd,uint32_t handle,int size,int prot); -void *gem_mmap__cpu (int fd,uint32_t handle,int size,int prot); +void *gem_mmap__cpu (int fd,uint32_t handle,int size);#define gem_mmap gem_mmap__gttuint64_t gem_aperture_size (int fd);
tests/gem_cs_tlb.c +1 -2
@@ -113,8 +113,7 @@ 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,BATCH_SIZE , -PROT_READ |PROT_WRITE ); + batch_ptr =gem_mmap__cpu (fd, handle_new,BATCH_SIZE ); batch_ptr[split*2 ] =MI_BATCH_BUFFER_END ;for (i = split*2 +2 ; i <BATCH_SIZE /8 ; i++)
tests/gem_evict_everything.c +1 -2
@@ -196,8 +196,7 @@ static void forked_evictions(int fd, int size, int count,for (l =0 ; l < count && (flags &MEMORY_PRESSURE ); l++) {uint32_t *base =gem_mmap__cpu (realfd, bo[l], - size, -PROT_READ |PROT_WRITE ); + size);memset (base,0 , size);munmap (base, size); }
tests/gem_fence_thrash.c +1 -1
@@ -68,7 +68,7 @@ bo_create (int fd, int tiling) handle =gem_create (fd,OBJECT_SIZE );/* dirty cpu caches a bit ... */ - ptr =gem_mmap__cpu (fd, handle,OBJECT_SIZE ,PROT_READ |PROT_WRITE ); + ptr =gem_mmap__cpu (fd, handle,OBJECT_SIZE );igt_assert (ptr);memset (ptr,0 ,OBJECT_SIZE );munmap (ptr,OBJECT_SIZE );
tests/gem_gtt_speed.c +5 -5
@@ -88,7 +88,7 @@ int main(int argc, char **argv) I915_GEM_DOMAIN_CPU); { -uint32_t *base =gem_mmap__cpu (fd, handle, size,PROT_READ |PROT_WRITE ); +uint32_t *base =gem_mmap__cpu (fd, handle, size);volatile uint32_t *ptr = base;int x =0 ;
@@ -103,7 +103,7 @@ int main(int argc, char **argv)/* mmap read */ gettimeofday (&start,NULL );for (loop =0 ; loop <1000 ; loop++) { - base =gem_mmap__cpu (fd, handle, size,PROT_READ |PROT_WRITE ); + base =gem_mmap__cpu (fd, handle, size); ptr = base; x =0 ;
@@ -122,7 +122,7 @@ int main(int argc, char **argv)/* mmap write */ gettimeofday (&start,NULL );for (loop =0 ; loop <1000 ; loop++) { - base =gem_mmap__cpu (fd, handle, size,PROT_READ |PROT_WRITE ); + base =gem_mmap__cpu (fd, handle, size); ptr = base;for (i =0 ; i < size/sizeof (*ptr); i++)
@@ -136,7 +136,7 @@ int main(int argc, char **argv)gettimeofday (&start,NULL );for (loop =0 ; loop <1000 ; loop++) { - base =gem_mmap__cpu (fd, handle, size,PROT_READ |PROT_WRITE ); + base =gem_mmap__cpu (fd, handle, size);memset (base,0 , size);munmap (base, size); }
@@ -145,7 +145,7 @@ int main(int argc, char **argv) size/1024, elapsed(&start, &end, loop));gettimeofday (&start,NULL ); - base =gem_mmap__cpu (fd, handle, size,PROT_READ |PROT_WRITE ); + base =gem_mmap__cpu (fd, handle, size);for (loop =0 ; loop <1000 ; loop++)memset (base,0 , size);munmap (base, size);
tests/gem_pwrite_pread.c +4 -4
@@ -180,8 +180,8 @@ static void as_cpu_mmap(int fd, uint32_t src, uint32_t dst, void *buf, int len,gem_write (fd, exec[2 ].handle,0 , batch, execbuf.batch_len); - src_ptr =gem_mmap__cpu (fd, src,OBJECT_SIZE ,PROT_WRITE ); - dst_ptr =gem_mmap__cpu (fd, dst,OBJECT_SIZE ,PROT_READ ); + src_ptr =gem_mmap__cpu (fd, src,OBJECT_SIZE ); + dst_ptr =gem_mmap__cpu (fd, dst,OBJECT_SIZE );while (loops--) { gem_set_domain(fd, src,
@@ -309,8 +309,8 @@ static void test_as_cpu_mmap(int fd, uint32_t src, uint32_t dst, int len)gem_write (fd, exec[2 ].handle,0 , batch, execbuf.batch_len); - src_ptr =gem_mmap__cpu (fd, src,OBJECT_SIZE ,PROT_WRITE ); - dst_ptr =gem_mmap__cpu (fd, dst,OBJECT_SIZE ,PROT_READ ); + src_ptr =gem_mmap__cpu (fd, src,OBJECT_SIZE ); + dst_ptr =gem_mmap__cpu (fd, dst,OBJECT_SIZE );gem_set_domain (fd, src,I915_GEM_DOMAIN_CPU ,I915_GEM_DOMAIN_CPU );for (i =0 ; i < len/4 ; i++)
Signature · 1 line
1.8.3.1
PATCH 2/2 drmtest: assert operations inside gem_mmap__cpu
From: Paulo Zanoni <[email protected]>
All the callers seem to rely on the correct behavior of gem_mmap__cpu, so add some assertions to catch the unexpected cases. This way we won't need to worry about adding assertions to all the callers.
Signed-off-by Paulo Zanoni <[email protected]>
--- lib/drmtest.c | 4 ++-- tests/gem_fence_thrash.c | 1 - 2 files changed, 2 insertions(+), 3 deletions(-)
lib/drmtest.c +2 -2
@@ -564,8 +564,8 @@ void *gem_mmap__cpu(int fd, uint32_t handle, int size) mmap_arg.handle = handle; mmap_arg.offset =0 ; mmap_arg.size = size; -if (drmIoctl (fd,DRM_IOCTL_I915_GEM_MMAP , &mmap_arg)) -return NULL ; +do_ioctl (fd,DRM_IOCTL_I915_GEM_MMAP , &mmap_arg); +igt_assert (mmap_arg.addr_ptr);return (void *)(uintptr_t )mmap_arg.addr_ptr; }
tests/gem_fence_thrash.c +0 -1
@@ -69,7 +69,6 @@ bo_create (int fd, int tiling)/* dirty cpu caches a bit ... */ ptr =gem_mmap__cpu (fd, handle,OBJECT_SIZE ); -igt_assert (ptr);memset (ptr,0 ,OBJECT_SIZE );munmap (ptr,OBJECT_SIZE );
Signature · 1 line
1.8.3.1