tests: fixup new warnings
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 10 Jan 2012 14:50:20 +0000 (15:50 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 10 Jan 2012 14:50:20 +0000 (15:50 +0100)
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
tests/gem_basic.c
tests/gem_exec_bad_domains.c
tests/gem_exec_faulting_reloc.c
tests/gem_exec_nop.c
tests/gem_flink.c
tests/gem_gtt_speed.c
tests/gem_mmap.c
tests/gem_reloc_vs_gpu.c
tests/gem_ring_sync_loop.c
tests/gem_stress_gen6.c

index d52cca5..2e29c28 100644 (file)
 static void
 test_bad_close(int fd)
 {
-       struct drm_gem_close close;
+       struct drm_gem_close close_bo;
        int ret;
 
        printf("Testing error return on bad close ioctl.\n");
 
-       close.handle = 0x10101010;
-       ret = ioctl(fd, DRM_IOCTL_GEM_CLOSE, &close);
+       close_bo.handle = 0x10101010;
+       ret = ioctl(fd, DRM_IOCTL_GEM_CLOSE, &close_bo);
 
        assert(ret == -1 && errno == EINVAL);
 }
@@ -57,7 +57,6 @@ static void
 test_create_close(int fd)
 {
        struct drm_i915_gem_create create;
-       struct drm_gem_close close;
        int ret;
 
        printf("Testing creating and closing an object.\n");
@@ -67,8 +66,7 @@ test_create_close(int fd)
        ret = ioctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create);
        assert(ret == 0);
 
-       close.handle = create.handle;
-       ret = ioctl(fd, DRM_IOCTL_GEM_CLOSE, &close);
+       gem_close(fd, create.handle);
 }
 
 static void
index da104b1..f3ee08b 100644 (file)
@@ -52,7 +52,7 @@ struct intel_batchbuffer *batch;
 #define BAD_GTT_DEST ((512*1024*1024)) /* past end of aperture */
 
 static int
-run_batch(struct intel_batchbuffer *batch)
+run_batch(void)
 {
        unsigned int used = batch->ptr - batch->buffer;
        int ret;
@@ -100,7 +100,7 @@ int main(int argc, char **argv)
        OUT_BATCH(0);
        OUT_RELOC(tmp, I915_GEM_DOMAIN_CPU, 0, 0);
        ADVANCE_BATCH();
-       ret = run_batch(batch);
+       ret = run_batch();
        if (ret != -EINVAL) {
                fprintf(stderr, "(cpu, 0) reloc not rejected\n");
                exit(1);
@@ -110,7 +110,7 @@ int main(int argc, char **argv)
        OUT_BATCH(0);
        OUT_RELOC(tmp, I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU, 0);
        ADVANCE_BATCH();
-       ret = run_batch(batch);
+       ret = run_batch();
        if (ret != -EINVAL) {
                fprintf(stderr, "(cpu, cpu) reloc not rejected\n");
                exit(1);
@@ -120,7 +120,7 @@ int main(int argc, char **argv)
        OUT_BATCH(0);
        OUT_RELOC(tmp, I915_GEM_DOMAIN_GTT, 0, 0);
        ADVANCE_BATCH();
-       ret = run_batch(batch);
+       ret = run_batch();
        if (ret != -EINVAL) {
                fprintf(stderr, "(gtt, 0) reloc not rejected\n");
                exit(1);
@@ -130,7 +130,7 @@ int main(int argc, char **argv)
        OUT_BATCH(0);
        OUT_RELOC(tmp, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT, 0);
        ADVANCE_BATCH();
-       ret = run_batch(batch);
+       ret = run_batch();
        if (ret != -EINVAL) {
                fprintf(stderr, "(gtt, gtt) reloc not rejected\n");
                exit(1);
index fec3a47..d584e64 100644 (file)
@@ -192,7 +192,7 @@ static void run(int object_size)
        uint32_t handle, handle_relocs, src, dst;
        void *gtt_relocs;
        int fd, len;
-       int ring, ret;
+       int ring;
 
        fd = drm_open_any();
        handle = gem_create(fd, 4096);
index 7bfe37f..b6c361e 100644 (file)
@@ -76,19 +76,19 @@ static double elapsed(const struct timeval *start,
 static int exec(int fd, uint32_t handle, int loops)
 {
        struct drm_i915_gem_execbuffer2 execbuf;
-       struct drm_i915_gem_exec_object2 exec[1];
+       struct drm_i915_gem_exec_object2 gem_exec[1];
        int ret = 0;
 
-       exec[0].handle = handle;
-       exec[0].relocation_count = 0;
-       exec[0].relocs_ptr = 0;
-       exec[0].alignment = 0;
-       exec[0].offset = 0;
-       exec[0].flags = 0;
-       exec[0].rsvd1 = 0;
-       exec[0].rsvd2 = 0;
+       gem_exec[0].handle = handle;
+       gem_exec[0].relocation_count = 0;
+       gem_exec[0].relocs_ptr = 0;
+       gem_exec[0].alignment = 0;
+       gem_exec[0].offset = 0;
+       gem_exec[0].flags = 0;
+       gem_exec[0].rsvd1 = 0;
+       gem_exec[0].rsvd2 = 0;
 
-       execbuf.buffers_ptr = (uintptr_t)exec;
+       execbuf.buffers_ptr = (uintptr_t)gem_exec;
        execbuf.buffer_count = 1;
        execbuf.batch_start_offset = 0;
        execbuf.batch_len = 8;
index 0b00b1e..c869480 100644 (file)
@@ -43,7 +43,7 @@ test_flink(int fd)
 {
        struct drm_i915_gem_create create;
        struct drm_gem_flink flink;
-       struct drm_gem_open open;
+       struct drm_gem_open gem_open;
        int ret;
 
        printf("Testing flink and open.\n");
@@ -57,10 +57,10 @@ test_flink(int fd)
        ret = ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink);
        assert(ret == 0);
 
-       open.name = flink.name;
-       ret = ioctl(fd, DRM_IOCTL_GEM_OPEN, &open);
+       gem_open.name = flink.name;
+       ret = ioctl(fd, DRM_IOCTL_GEM_OPEN, &gem_open);
        assert(ret == 0);
-       assert(open.handle != 0);
+       assert(gem_open.handle != 0);
 }
 
 static void
@@ -104,13 +104,13 @@ test_bad_flink(int fd)
 static void
 test_bad_open(int fd)
 {
-       struct drm_gem_open open;
+       struct drm_gem_open gem_open;
        int ret;
 
        printf("Testing error return on bad open ioctl.\n");
 
-       open.name = 0x10101010;
-       ret = ioctl(fd, DRM_IOCTL_GEM_OPEN, &open);
+       gem_open.name = 0x10101010;
+       ret = ioctl(fd, DRM_IOCTL_GEM_OPEN, &gem_open);
 
        assert(ret == -1 && errno == ENOENT);
 }
index 9ab8372..8e3750d 100644 (file)
@@ -140,24 +140,24 @@ int main(int argc, char **argv)
 
                /* prefault into gtt */
                {
-                       volatile uint32_t *ptr = gem_mmap(fd, handle, size, PROT_READ);
+                       uint32_t *ptr = gem_mmap(fd, handle, size, PROT_READ);
                        int x = 0;
 
                        for (i = 0; i < size/sizeof(*ptr); i++)
                                x += ptr[i];
 
-                       munmap((void *)ptr, size);
+                       munmap(ptr, size);
                }
                /* mmap read */
                gettimeofday(&start, NULL);
                for (loop = 0; loop < 1000; loop++) {
-                       volatile uint32_t *ptr = gem_mmap(fd, handle, size, PROT_READ);
+                       uint32_t *ptr = gem_mmap(fd, handle, size, PROT_READ);
                        int x = 0;
 
                        for (i = 0; i < size/sizeof(*ptr); i++)
                                x += ptr[i];
 
-                       munmap((void *)ptr, size);
+                       munmap(ptr, size);
                }
                gettimeofday(&end, NULL);
                printf("Time to read %dk through a GTT map:             %7.3fµs\n",
@@ -166,12 +166,12 @@ int main(int argc, char **argv)
                /* mmap write */
                gettimeofday(&start, NULL);
                for (loop = 0; loop < 1000; loop++) {
-                       volatile uint32_t *ptr = gem_mmap(fd, handle, size, PROT_READ | PROT_WRITE);
+                       uint32_t *ptr = gem_mmap(fd, handle, size, PROT_READ | PROT_WRITE);
 
                        for (i = 0; i < size/sizeof(*ptr); i++)
                                ptr[i] = i;
 
-                       munmap((void *)ptr, size);
+                       munmap(ptr, size);
                }
                gettimeofday(&end, NULL);
                printf("Time to write %dk through a GTT map:            %7.3fµs\n",
@@ -180,13 +180,13 @@ int main(int argc, char **argv)
                /* mmap read */
                gettimeofday(&start, NULL);
                for (loop = 0; loop < 1000; loop++) {
-                       volatile uint32_t *ptr = gem_mmap(fd, handle, size, PROT_READ);
+                       uint32_t *ptr = gem_mmap(fd, handle, size, PROT_READ);
                        int x = 0;
 
                        for (i = 0; i < size/sizeof(*ptr); i++)
                                x += ptr[i];
 
-                       munmap((void *)ptr, size);
+                       munmap(ptr, size);
                }
                gettimeofday(&end, NULL);
                printf("Time to read %dk (again) through a GTT map:     %7.3fµs\n",
index 5730f7e..f251d89 100644 (file)
@@ -46,7 +46,7 @@ int main(int argc, char **argv)
 {
        int fd;
        struct drm_i915_gem_create create;
-       struct drm_i915_gem_mmap mmap;
+       struct drm_i915_gem_mmap gem_mmap;
        struct drm_gem_close unref;
        uint8_t expected[OBJECT_SIZE];
        uint8_t buf[OBJECT_SIZE];
@@ -56,12 +56,12 @@ int main(int argc, char **argv)
 
        fd = drm_open_any();
 
-       memset(&mmap, 0, sizeof(mmap));
-       mmap.handle = 0x10101010;
-       mmap.offset = 0;
-       mmap.size = 4096;
+       memset(&gem_mmap, 0, sizeof(gem_mmap));
+       gem_mmap.handle = 0x10101010;
+       gem_mmap.offset = 0;
+       gem_mmap.size = 4096;
        printf("Testing mmaping of bad object.\n");
-       ret = ioctl(fd, DRM_IOCTL_I915_GEM_MMAP, &mmap);
+       ret = ioctl(fd, DRM_IOCTL_I915_GEM_MMAP, &gem_mmap);
        assert(ret == -1 && errno == ENOENT);
 
        memset(&create, 0, sizeof(create));
@@ -71,12 +71,12 @@ int main(int argc, char **argv)
        handle = create.handle;
 
        printf("Testing mmaping of newly created object.\n");
-       mmap.handle = handle;
-       mmap.offset = 0;
-       mmap.size = OBJECT_SIZE;
-       ret = ioctl(fd, DRM_IOCTL_I915_GEM_MMAP, &mmap);
+       gem_mmap.handle = handle;
+       gem_mmap.offset = 0;
+       gem_mmap.size = OBJECT_SIZE;
+       ret = ioctl(fd, DRM_IOCTL_I915_GEM_MMAP, &gem_mmap);
        assert(ret == 0);
-       addr = (uint8_t *)(uintptr_t)mmap.addr_ptr;
+       addr = (uint8_t *)(uintptr_t)gem_mmap.addr_ptr;
 
        printf("Testing contents of newly created object.\n");
        memset(expected, 0, sizeof(expected));
index b56c3fb..47681d5 100644 (file)
@@ -55,7 +55,6 @@ drm_intel_bo *pc_target_bo[NUM_TARGET_BOS];
 drm_intel_bo *dummy_bo;
 drm_intel_bo *special_bo;
 uint32_t devid;
-int fd;
 int special_reloc_ofs;
 int special_batch_len;
 
index a415715..b689bcd 100644 (file)
@@ -56,7 +56,7 @@ static drm_intel_bo *target_buffer;
 #define MI_DO_COMPARE                  (1<<21)
 
 static void
-store_dword_loop(int ring)
+store_dword_loop(void)
 {
        int i;
 
@@ -127,7 +127,7 @@ int main(int argc, char **argv)
                exit(-1);
        }
 
-       store_dword_loop(I915_EXEC_RENDER);
+       store_dword_loop();
 
        drm_intel_bo_unreference(target_buffer);
        intel_batchbuffer_free(batch);
index 1137530..735c489 100644 (file)
@@ -49,10 +49,10 @@ batch_align(uint32_t align)
 }
 
 static uint32_t
-batch_round_upto(uint32_t div)
+batch_round_upto(uint32_t divisor)
 {
        uint32_t offset = batch_used();
-       offset = (offset + div-1) / div * div;
+       offset = (offset + divisor-1) / divisor * divisor;
        batch->ptr = batch->buffer + offset;
        return offset;
 }