tests: fixup new warnings

Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
Daniel Vetter 2012-01-10 15:50:20 +01:00
parent bd5cf9a07d
commit a7a80c2c2f
10 changed files with 50 additions and 53 deletions

View File

@ -42,13 +42,13 @@
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

View 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);

View 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);

View 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;

View 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);
}

View 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",

View 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));

View 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;

View 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);

View 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;
}