Just a wholesale rollout for now, we can refine later on.
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
# include <sys/syscall.h>
#include "drm.h"
/* root (which we run igt as) should always be authenticated */
auth = check_auth(fd);
- assert(auth);
+ igt_assert(auth);
return 0;
}
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
for (i = 0; i < BO_ARRAY_SIZE; i++) {
bos[i] = drm_intel_bo_alloc(bufmgr, "mmap bo", 4096, 4096);
- assert(bos[i]);
+ igt_assert(bos[i]);
drm_intel_bo_map(bos[i], 1);
ptr = bos[i]->virtual;
- assert(ptr);
+ igt_assert(ptr);
*ptr = 'c';
drm_intel_bo_unmap(bos[i]);
drm_intel_gem_bo_map_gtt(bos[i]);
ptr = bos[i]->virtual;
- assert(ptr);
+ igt_assert(ptr);
*ptr = 'c';
drm_intel_gem_bo_unmap_gtt(bos[i]);
}
/* and recheck whether a second map of the same still works */
for (i = 0; i < BO_ARRAY_SIZE; i++) {
bos[i] = drm_intel_bo_alloc(bufmgr, "mmap bo", 4096, 4096);
- assert(bos[i]);
+ igt_assert(bos[i]);
drm_intel_bo_map(bos[i], 1);
ptr = bos[i]->virtual;
- assert(*ptr = 'c');
+ igt_assert(*ptr = 'c');
drm_intel_bo_unmap(bos[i]);
drm_intel_gem_bo_map_gtt(bos[i]);
ptr = bos[i]->virtual;
- assert(*ptr = 'c');
+ igt_assert(*ptr = 'c');
drm_intel_gem_bo_unmap_gtt(bos[i]);
}
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
load_bo = drm_intel_bo_alloc(bufmgr, "target bo", 1024*4096, 4096);
- assert(load_bo);
+ igt_assert(load_bo);
drm_intel_bufmgr_gem_set_vma_cache_size(bufmgr, 500);
for (j = 0; j < GROUP_SZ; j++, i++) {
bo[j] = drm_intel_bo_alloc(bufmgr, "mmap bo", 4096, 4096);
- assert(bo[j]);
+ igt_assert(bo[j]);
drm_intel_gem_bo_map_gtt(bo[j]);
ptr = bo[j]->virtual;
- assert(ptr);
+ igt_assert(ptr);
*ptr = 'c';
drm_intel_gem_bo_unmap_gtt(bo[j]);
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
for (i = 0; i < BO_ARRAY_SIZE; i++) {
bos[i] = drm_intel_bo_alloc(bufmgr, "mmap bo", 4096, 4096);
- assert(bos[i]);
+ igt_assert(bos[i]);
drm_intel_bo_map(bos[i], 1);
ptr = bos[i]->virtual;
- assert(ptr);
+ igt_assert(ptr);
*ptr = 'c';
drm_intel_bo_unmap(bos[i]);
}
/* and recheck whether a second map of the same still works */
for (i = 0; i < BO_ARRAY_SIZE; i++) {
bos[i] = drm_intel_bo_alloc(bufmgr, "mmap bo", 4096, 4096);
- assert(bos[i]);
+ igt_assert(bos[i]);
drm_intel_bo_map(bos[i], 1);
ptr = bos[i]->virtual;
- assert(*ptr = 'c');
+ igt_assert(*ptr = 'c');
drm_intel_bo_unmap(bos[i]);
}
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
for (i = 0; i < BO_ARRAY_SIZE; i++) {
bos[i] = drm_intel_bo_alloc(bufmgr, "mmap bo", 4096, 4096);
- assert(bos[i]);
+ igt_assert(bos[i]);
drm_intel_gem_bo_map_gtt(bos[i]);
ptr = bos[i]->virtual;
- assert(ptr);
+ igt_assert(ptr);
*ptr = 'c';
drm_intel_gem_bo_unmap_gtt(bos[i]);
}
/* and recheck whether a second map of the same still works */
for (i = 0; i < BO_ARRAY_SIZE; i++) {
bos[i] = drm_intel_bo_alloc(bufmgr, "mmap bo", 4096, 4096);
- assert(bos[i]);
+ igt_assert(bos[i]);
drm_intel_gem_bo_map_gtt(bos[i]);
ptr = bos[i]->virtual;
- assert(*ptr = 'c');
+ igt_assert(*ptr = 'c');
drm_intel_gem_bo_unmap_gtt(bos[i]);
}
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
create.handle = 0;
create.size = (size + 4095) & -4096;
ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create);
- assert(retval || ret == 0);
+ igt_assert(retval || ret == 0);
if (retval)
*retval = errno;
int retval = 0;
printf("trying to create a zero-length gem object\n");
do_gem_create(fd, 0, &retval);
- assert(retval == EINVAL);
+ igt_assert(retval == EINVAL);
}
#if 0
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
close_bo.handle = 0x10101010;
ret = ioctl(fd, DRM_IOCTL_GEM_CLOSE, &close_bo);
- assert(ret == -1 && errno == EINVAL);
+ igt_assert(ret == -1 && errno == EINVAL);
}
static void
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
do_or_die(drm_intel_bo_map(bo, false));
vaddr = bo->virtual;
while (size--)
- assert(*vaddr++ == val);
+ igt_assert(*vaddr++ == val);
drm_intel_bo_unmap(bo);
}
drm_intel_bo *bo;
bo = drm_intel_bo_alloc(bufmgr, "bo", 4*width*height, 0);
- assert(bo);
+ igt_assert(bo);
return bo;
}
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
count = 10;
handles = malloc (count * sizeof(uint32_t));
- assert(handles);
+ igt_assert(handles);
noop = gem_create(fd, 4096);
gem_write(fd, noop, 0, end, sizeof(end));
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
DRM_IOCTL_I915_GEM_EXECBUFFER2,
&execbuf);
gem_sync(fd, handle);
- assert(ret == 0);
+ igt_assert(ret == 0);
}
int main(int argc, char **argv)
count = aper_size / 4096;
batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
- assert(batch);
+ igt_assert(batch);
sample_batch_bo = drm_intel_bo_alloc(bufmgr, "", 4096, 4096);
- assert(sample_batch_bo);
+ igt_assert(sample_batch_bo);
ret = drm_intel_bo_subdata(sample_batch_bo, 4096-sizeof(batch_end),
sizeof(batch_end), batch_end);
- assert(ret == 0);
+ igt_assert(ret == 0);
/* fill the entire gart with batches and run them */
for (i = 0; i < count; i++) {
drm_intel_bo *batch_bo;
batch_bo = drm_intel_bo_alloc(bufmgr, "", 4096, 4096);
- assert(batch_bo);
+ igt_assert(batch_bo);
/* copy the sample batch with the gpu to the new one, so that we
* also test the unmappable part of the gtt. */
#include <stdint.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
if (split > 0) {
/* Check that we've managed to collide in the tlb. */
- assert(gtt_offset == gtt_offset_new);
+ igt_assert(gtt_offset == gtt_offset_new);
/* We hang onto the storage of the old batch by keeping
* the cpu mmap around. */
destroy.ctx_id = ctx_id;
/* Make sure a proper destroy works first */
ret = drmIoctl(fd, CONTEXT_DESTROY_IOCTL, &destroy);
- assert(ret == 0);
+ igt_assert(ret == 0);
/* try double destroy */
ret = drmIoctl(fd, CONTEXT_DESTROY_IOCTL, &destroy);
#include <stdint.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
handle = gem_create(fd, 4096);
gem_write(fd, handle, 0, batch, sizeof(batch));
- assert(exec(fd, handle, I915_EXEC_RENDER, ctx_id) == 0);
- assert(exec(fd, handle, I915_EXEC_BSD, ctx_id) != 0);
- assert(exec(fd, handle, I915_EXEC_BLT, ctx_id) != 0);
+ igt_assert(exec(fd, handle, I915_EXEC_RENDER, ctx_id) == 0);
+ igt_assert(exec(fd, handle, I915_EXEC_BSD, ctx_id) != 0);
+ igt_assert(exec(fd, handle, I915_EXEC_BLT, ctx_id) != 0);
exit(EXIT_SUCCESS);
}
{
buf->bo = drm_intel_bo_alloc(bufmgr, "", size, 4096);
buf->size = size;
- assert(buf->bo);
+ igt_assert(buf->bo);
buf->tiling = I915_TILING_NONE;
buf->stride = 4096;
}
else
td_fd = fd;
- assert(td_fd >= 0);
+ igt_assert(td_fd >= 0);
bufmgr = drm_intel_bufmgr_gem_init(td_fd, 4096);
batch = intel_batchbuffer_alloc(bufmgr, devid);
if (uncontexted) {
- assert(rendercopy);
+ igt_assert(rendercopy);
rendercopy(batch, &src, 0, 0, 0, 0, &dst, 0, 0);
} else {
int ret;
ret = drm_intel_bo_subdata(batch->bo, 0, 4096, batch->buffer);
- assert(ret == 0);
+ igt_assert(ret == 0);
intel_batchbuffer_flush_with_context(batch, context);
}
}
fprintf(stderr, "%s\n", strerror(errno));
exit(EXIT_FAILURE);
}
- assert(create.ctx_id != 0);
+ igt_assert(create.ctx_id != 0);
close(fd);
#include <stdint.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
handle = gem_create(fd, 4096);
gem_write(fd, handle, 0, batch, sizeof(batch));
- assert(exec(fd, handle, I915_EXEC_RENDER, ctx_id) == 0);
+ igt_assert(exec(fd, handle, I915_EXEC_RENDER, ctx_id) == 0);
context_destroy(fd, ctx_id);
ctx_id = context_create(fd);
- assert(exec(fd, handle, I915_EXEC_RENDER, ctx_id) == 0);
+ igt_assert(exec(fd, handle, I915_EXEC_RENDER, ctx_id) == 0);
context_destroy(fd, ctx_id);
- assert(exec(fd, handle, I915_EXEC_RENDER, ctx_id) < 0);
+ igt_assert(exec(fd, handle, I915_EXEC_RENDER, ctx_id) < 0);
exit(EXIT_SUCCESS);
}
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
used = batch->ptr - batch->buffer;
ret = drm_intel_bo_subdata(batch->bo, 0, used, batch->buffer);
- assert(ret == 0);
+ igt_assert(ret == 0);
batch->ptr = NULL;
#include <stdint.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
gem_read(fd, handle, reloc_ofs, &tmp, 4);
- assert(tmp == gem_reloc[0].presumed_offset);
+ igt_assert(tmp == gem_reloc[0].presumed_offset);
return ret;
}
#include <stdint.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
uint32_t *b = batch;
int height = length / (16 * 1024);
- assert(height <= 1<<16);
+ igt_assert(height <= 1<<16);
if (height) {
b[0] = COPY_BLT_CMD | BLT_WRITE_ALPHA | BLT_WRITE_RGB;
#include <stdint.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
uint32_t *b = batch;
int height = length / (16 * 1024);
- assert(height <= 1<<16);
+ igt_assert(height <= 1<<16);
if (height) {
b[0] = COPY_BLT_CMD | BLT_WRITE_ALPHA | BLT_WRITE_RGB;
ret = drmIoctl(fd,
DRM_IOCTL_I915_GEM_EXECBUFFER2,
execbuf);
- assert(ret == 0);
+ igt_assert(ret == 0);
}
static void run(int object_size)
gem_write(fd, handle_relocs, 0, reloc, sizeof(reloc));
gtt_relocs = gem_mmap(fd, handle_relocs, 4096,
PROT_READ | PROT_WRITE);
- assert(gtt_relocs);
+ igt_assert(gtt_relocs);
exec[2].handle = handle;
exec[2].relocation_count = len > 40 ? 4 : 2;
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
/* dirty cpu caches a bit ... */
ptr = gem_mmap__cpu(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE);
- assert(ptr);
+ igt_assert(ptr);
memset(ptr, 0, OBJECT_SIZE);
munmap(ptr, OBJECT_SIZE);
gem_set_tiling(fd, handle, tiling, 1024);
ptr = gem_mmap(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE);
- assert(ptr);
+ igt_assert(ptr);
/* XXX: mmap_gtt pulls the bo into the GTT read domain. */
gem_sync(fd, handle);
assert (t->num_surfaces > 0);
s = calloc(sizeof(*s), t->num_surfaces);
- assert(s);
+ igt_assert(s);
for (k = 0; k < t->num_surfaces; k++)
s[k] = bo_create(fd, t->tiling);
pthread_join (threads[n], NULL);
} else {
void *(*func)(void *) = f;
- assert(func(&t) == (void *)0);
+ igt_assert(func(&t) == (void *)0);
}
close(t.fd);
}
igt_subtest("bo-copy")
- assert(run_test(1, bo_copy, I915_TILING_X, 1) == 0);
+ igt_assert(run_test(1, bo_copy, I915_TILING_X, 1) == 0);
return 0;
}
#include <sys/ioctl.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <drm.h>
val = gem_available_fences(fd);
printf ("total %d fences\n", val);
- assert(val > 4);
+ igt_assert(val > 4);
return val;
}
ret = drmIoctl(fd,
DRM_IOCTL_I915_GEM_EXECBUFFER2,
&execbuf[0]);
- assert(expected_errno ?
+ igt_assert(expected_errno ?
ret < 0 && errno == expected_errno :
ret == 0);
ret = drmIoctl(fd,
DRM_IOCTL_I915_GEM_EXECBUFFER2,
&execbuf[1]);
- assert(expected_errno ?
+ igt_assert(expected_errno ?
ret < 0 && errno == expected_errno :
ret == 0);
} while (--loop);
num_fences = get_num_fences(fd);
devid = intel_get_drm_devid(fd);
- assert(num_fences <= MAX_FENCES);
+ igt_assert(num_fences <= MAX_FENCES);
run_test(fd, num_fences - 2, 0);
run_test(fd, num_fences + 1, intel_gen(devid) >= 4 ? 0 : EDEADLK);
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
memset(&create, 0, sizeof(create));
create.size = 16 * 1024;
ret = ioctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create);
- assert(ret == 0);
+ igt_assert(ret == 0);
flink.handle = create.handle;
ret = ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink);
- assert(ret == 0);
+ igt_assert(ret == 0);
open_struct.name = flink.name;
ret = ioctl(fd, DRM_IOCTL_GEM_OPEN, &open_struct);
- assert(ret == 0);
- assert(open_struct.handle != 0);
+ igt_assert(ret == 0);
+ igt_assert(open_struct.handle != 0);
}
static void
memset(&create, 0, sizeof(create));
create.size = 16 * 1024;
ret = ioctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create);
- assert(ret == 0);
+ igt_assert(ret == 0);
flink.handle = create.handle;
ret = ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink);
- assert(ret == 0);
+ igt_assert(ret == 0);
flink2.handle = create.handle;
ret = ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink2);
- assert(ret == 0);
- assert(flink2.name == flink.name);
+ igt_assert(ret == 0);
+ igt_assert(flink2.name == flink.name);
}
static void
flink.handle = 0x10101010;
ret = ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink);
- assert(ret == -1 && errno == ENOENT);
+ igt_assert(ret == -1 && errno == ENOENT);
}
static void
open_struct.name = 0x10101010;
ret = ioctl(fd, DRM_IOCTL_GEM_OPEN, &open_struct);
- assert(ret == -1 && errno == ENOENT);
+ igt_assert(ret == -1 && errno == ENOENT);
}
static void
memset(&create, 0, sizeof(create));
create.size = 16 * 1024;
ret = ioctl(fd2, DRM_IOCTL_I915_GEM_CREATE, &create);
- assert(ret == 0);
+ igt_assert(ret == 0);
flink.handle = create.handle;
ret = ioctl(fd2, DRM_IOCTL_GEM_FLINK, &flink);
- assert(ret == 0);
+ igt_assert(ret == 0);
open_struct.name = flink.name;
ret = ioctl(fd, DRM_IOCTL_GEM_OPEN, &open_struct);
- assert(ret == 0);
- assert(open_struct.handle != 0);
+ igt_assert(ret == 0);
+ igt_assert(open_struct.handle != 0);
close(fd2);
fd2 = drm_open_any();
open_struct.name = flink.name;
ret = ioctl(fd2, DRM_IOCTL_GEM_OPEN, &open_struct);
- assert(ret == 0);
- assert(open_struct.handle != 0);
+ igt_assert(ret == 0);
+ igt_assert(open_struct.handle != 0);
}
int main(int argc, char **argv)
#include <sys/ioctl.h>
#include <stdlib.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <unistd.h>
#include <pthread.h>
char *path;
ret = asprintf(&path, "/sys/kernel/debug/dri/%d/i915_gem_objects", device);
- assert(ret != -1);
+ igt_assert(ret != -1);
file = fopen(path, "r");
scanned = fscanf(file, "%i objects", &ret);
- assert(scanned == 1);
+ igt_assert(scanned == 1);
return ret;
}
if (ret == 0) {
uint32_t name = gem_flink(fd, open_struct.handle);
- assert(name == 1);
+ igt_assert(name == 1);
gem_close(fd, open_struct.handle);
} else
- assert(errno == ENOENT);
+ igt_assert(errno == ENOENT);
}
return (void *)0;
threads = calloc(num_threads, sizeof(pthread_t));
fd = drm_open_any();
- assert(fd >= 0);
+ igt_assert(fd >= 0);
for (i = 0; i < num_threads; i++) {
r = pthread_create(&threads[i], NULL,
thread_fn_flink_name, NULL);
- assert(r == 0);
+ igt_assert(r == 0);
}
for (i = 0; i < 1000000; i++) {
for (i = 0; i < num_threads; i++) {
pthread_join(threads[i], &status);
- assert(status == 0);
+ igt_assert(status == 0);
}
close(fd);
threads = calloc(num_threads, sizeof(pthread_t));
fd = drm_open_any();
- assert(fd >= 0);
+ igt_assert(fd >= 0);
for (i = 0; i < num_threads; i++) {
r = pthread_create(&threads[i], NULL,
thread_fn_flink_close, NULL);
- assert(r == 0);
+ igt_assert(r == 0);
}
sleep(5);
for (i = 0; i < num_threads; i++) {
pthread_join(threads[i], &status);
- assert(status == 0);
+ igt_assert(status == 0);
}
close(fd);
obj_count = get_object_count() - obj_count;
printf("leaked %i objects\n", obj_count);
- assert(obj_count == 0);
+ igt_assert(obj_count == 0);
}
int main(int argc, char **argv)
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
drm_intel_gem_bo_start_gtt_access(bo, false);
vaddr = bo->virtual;
while (size--)
- assert(*vaddr++ == val);
+ igt_assert(*vaddr++ == val);
}
static drm_intel_bo *
drm_intel_bo *bo;
bo = drm_intel_bo_alloc(bufmgr, "bo", 4*width*height, 0);
- assert(bo);
+ igt_assert(bo);
/* gtt map doesn't have a write parameter, so just keep the mapping
* around (to avoid the set_domain with the gtt write domain set) and
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
/* stirr up the page allocator a bit. */
ptr = malloc(OBJ_SIZE);
- assert(ptr);
+ igt_assert(ptr);
memset(ptr, 0x1, OBJ_SIZE);
handle = create_bo(fd);
*/
gem_read(fd, handle, 0, ptr, OBJ_SIZE);
for (i = 0; i < OBJ_SIZE/4; i++)
- assert(ptr[i] == i);
+ igt_assert(ptr[i] == i);
close(fd);
#include <stdint.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
fd = drm_open_any();
handle = gem_create(fd, size);
- assert(handle);
+ igt_assert(handle);
for (tiling = I915_TILING_NONE; tiling <= I915_TILING_Y; tiling++) {
if (tiling != I915_TILING_NONE) {
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
drmCommandNone(fd, DRM_I915_GEM_THROTTLE);
ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
}
- assert(ret == 0);
+ igt_assert(ret == 0);
gem_close(fd, handle);
}
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
gem_exec = calloc(num_exec+1, sizeof(*gem_exec));
gem_reloc = calloc(num_reloc, sizeof(*gem_reloc));
- assert(gem_exec && gem_reloc);
+ igt_assert(gem_exec && gem_reloc);
for (n = 0; n < num_exec; n++) {
gem_exec[n].handle = gem_create(fd, 4096);
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
arg.size = 4096;
printf("Testing mmaping of bad object.\n");
ret = ioctl(fd, DRM_IOCTL_I915_GEM_MMAP, &arg);
- assert(ret == -1 && errno == ENOENT);
+ igt_assert(ret == -1 && errno == ENOENT);
handle = gem_create(fd, OBJECT_SIZE);
arg.offset = 0;
arg.size = OBJECT_SIZE;
ret = ioctl(fd, DRM_IOCTL_I915_GEM_MMAP, &arg);
- assert(ret == 0);
+ igt_assert(ret == 0);
addr = (uint8_t *)(uintptr_t)arg.addr_ptr;
printf("Testing contents of newly created object.\n");
memset(expected, 0, sizeof(expected));
- assert(memcmp(addr, expected, sizeof(expected)) == 0);
+ igt_assert(memcmp(addr, expected, sizeof(expected)) == 0);
printf("Testing coherency of writes and mmap reads.\n");
memset(buf, 0, sizeof(buf));
memset(buf + 1024, 0x01, 1024);
memset(expected + 1024, 0x01, 1024);
gem_write(fd, handle, 0, buf, OBJECT_SIZE);
- assert(memcmp(buf, addr, sizeof(buf)) == 0);
+ igt_assert(memcmp(buf, addr, sizeof(buf)) == 0);
printf("Testing that mapping stays after close\n");
gem_close(fd, handle);
- assert(memcmp(buf, addr, sizeof(buf)) == 0);
+ igt_assert(memcmp(buf, addr, sizeof(buf)) == 0);
printf("Testing unmapping\n");
munmap(addr, OBJECT_SIZE);
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
void *ptr;
ptr = gem_mmap(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE);
- assert(ptr != MAP_FAILED);
+ igt_assert(ptr != MAP_FAILED);
return ptr;
}
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
if (!ptr) {
fprintf(stderr, "mmap failed\n");
- assert(ptr);
+ igt_assert(ptr);
}
/* touch it to force it into the gtt */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
execbuf.rsvd2 = 0;
do_or_die(drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf));
- assert(gem_exec[0].offset == offset);
+ igt_assert(gem_exec[0].offset == offset);
}
static int gem_linear_blt(uint32_t *batch,
/* pin anidle bo */
handle[i] = gem_create(fd, 4096);
offset[i] = gem_pin(fd, handle[i], 0);
- assert(offset[i]);
+ igt_assert(offset[i]);
gem_write(fd, handle[i], 0, batch, sizeof(batch));
} else {
/* try to pin an anidle bo */
handle[i] = gem_create(fd, 4096);
make_busy(fd, handle[i]);
offset[i] = gem_pin(fd, handle[i], 256*1024);
- assert(offset[i]);
- assert((offset[i] & (256*1024-1)) == 0);
+ igt_assert(offset[i]);
+ igt_assert((offset[i] & (256*1024-1)) == 0);
gem_write(fd, handle[i], 0, batch, sizeof(batch));
}
}
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
vaddr = tmp = malloc(size*4);
drm_intel_bo_get_subdata(bo, 0, size*4, tmp);
while (size--)
- assert(*vaddr++ == val);
+ igt_assert(*vaddr++ == val);
free(tmp);
}
drm_intel_bo *bo;
bo = drm_intel_bo_alloc(bufmgr, "bo", 4*width*height, 0);
- assert(bo);
+ igt_assert(bo);
return bo;
}
#include <stdint.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
gem_close(fd, exec[2].handle);
for (i = 0; i < len/4; i++)
- assert(buf[i] == i);
+ igt_assert(buf[i] == i);
}
static void test_as_gtt_mmap(int fd, uint32_t src, uint32_t dst, int len)
gem_set_domain(fd, dst, I915_GEM_DOMAIN_GTT, 0);
for (i = 0; i < len/4; i++)
- assert(dst_ptr[i] == i);
+ igt_assert(dst_ptr[i] == i);
munmap(dst_ptr, len);
munmap(src_ptr, len);
gem_set_domain(fd, dst, I915_GEM_DOMAIN_CPU, 0);
for (i = 0; i < len/4; i++)
- assert(dst_ptr[i] == i);
+ igt_assert(dst_ptr[i] == i);
munmap(dst_ptr, len);
munmap(src_ptr, len);
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
printf("Testing contents of newly created object.\n");
ret = do_read(fd, handle, buf, 0, OBJECT_SIZE);
- assert(ret == 0);
+ igt_assert(ret == 0);
memset(&expected, 0, sizeof(expected));
- assert(memcmp(expected, buf, sizeof(expected)) == 0);
+ igt_assert(memcmp(expected, buf, sizeof(expected)) == 0);
printf("Testing read beyond end of buffer.\n");
ret = do_read(fd, handle, buf, OBJECT_SIZE / 2, OBJECT_SIZE);
- assert(ret == -1 && errno == EINVAL);
+ igt_assert(ret == -1 && errno == EINVAL);
printf("Testing full write of buffer\n");
memset(buf, 0, sizeof(buf));
memset(buf + 1024, 0x01, 1024);
memset(expected + 1024, 0x01, 1024);
ret = do_write(fd, handle, buf, 0, OBJECT_SIZE);
- assert(ret == 0);
+ igt_assert(ret == 0);
ret = do_read(fd, handle, buf, 0, OBJECT_SIZE);
- assert(ret == 0);
- assert(memcmp(buf, expected, sizeof(buf)) == 0);
+ igt_assert(ret == 0);
+ igt_assert(memcmp(buf, expected, sizeof(buf)) == 0);
printf("Testing partial write of buffer\n");
memset(buf + 4096, 0x02, 1024);
memset(expected + 4096, 0x02, 1024);
ret = do_write(fd, handle, buf + 4096, 4096, 1024);
- assert(ret == 0);
+ igt_assert(ret == 0);
ret = do_read(fd, handle, buf, 0, OBJECT_SIZE);
- assert(ret == 0);
- assert(memcmp(buf, expected, sizeof(buf)) == 0);
+ igt_assert(ret == 0);
+ igt_assert(memcmp(buf, expected, sizeof(buf)) == 0);
printf("Testing partial read of buffer\n");
ret = do_read(fd, handle, buf, 512, 1024);
- assert(ret == 0);
- assert(memcmp(buf, expected + 512, 1024) == 0);
+ igt_assert(ret == 0);
+ igt_assert(memcmp(buf, expected + 512, 1024) == 0);
printf("Testing read of bad buffer handle\n");
ret = do_read(fd, 1234, buf, 0, 1024);
- assert(ret == -1 && errno == ENOENT);
+ igt_assert(ret == -1 && errno == ENOENT);
printf("Testing write of bad buffer handle\n");
ret = do_write(fd, 1234, buf, 0, 1024);
- assert(ret == -1 && errno == ENOENT);
+ igt_assert(ret == -1 && errno == ENOENT);
close(fd);
#include <stdio.h>
#include <stdint.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
BATCH(CMD_POLY_STIPPLE_OFFSET << 16);
BATCH(0);
}
- assert(len % 2 == 0);
+ igt_assert(len % 2 == 0);
BATCH(MI_NOOP);
BATCH(MI_BATCH_BUFFER_END);
for (i = 0; i < NUM_TARGET_BOS; i++) {
pc_target_bo[i] = drm_intel_bo_alloc(bufmgr, "special batch", 4096, 4096);
emit_dummy_load(pitch);
- assert(pc_target_bo[i]->offset == 0);
+ igt_assert(pc_target_bo[i]->offset == 0);
drm_intel_bo_emit_reloc(special_bo, special_reloc_ofs,
pc_target_bo[i],
0,
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
igt_progress(output, i, width*height);
- assert(y < height);
+ igt_assert(y < height);
/* Dummy load to fill the ring */
copy(batch, &src, 0, 0, width, height, &tmp, 0, 0);
#include <stdlib.h>
#include <string.h>
#include <time.h>
-#include <assert.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/types.h>
/* buf->bo = drm_intel_bo_alloc(bufmgr, "", size, 4096); */
buf->bo = bo;
buf->size = width * height * 4;
- assert(buf->bo);
+ igt_assert(buf->bo);
buf->tiling = I915_TILING_NONE;
buf->data = buf->cpu_mapping = NULL;
buf->num_tiles = width * height * 4;
drm_intel_bo *bo;
bo = drm_intel_bo_alloc(bufmgr, "bo", width * height * 4, 0);
- assert(bo);
+ igt_assert(bo);
/* gtt map doesn't have a write parameter, so just keep the mapping
* around (to avoid the set_domain with the gtt write domain set) and
"test is shallow!\n");
warned = 1;
}
- assert(dst->bo);
- assert(src->bo);
+ igt_assert(dst->bo);
+ igt_assert(src->bo);
intel_copy_bo(batch_blt, dst->bo, src->bo, width, height);
intel_batchbuffer_flush(batch_blt);
}
struct scratch_buf *s_src, *s_dst;
fd = drm_open_any();
- assert(fd >= 0);
+ igt_assert(fd >= 0);
gem_quiescent_gpu(fd);
bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
drm_intel_bufmgr_gem_enable_reuse(bufmgr);
batch_blt = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
- assert(batch_blt);
+ igt_assert(batch_blt);
batch_3d = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
- assert(batch_3d);
+ igt_assert(batch_3d);
src = malloc(num_buffers * sizeof(**src));
- assert(src);
+ igt_assert(src);
dst1 = malloc(num_buffers * sizeof(**dst1));
- assert(dst1);
+ igt_assert(dst1);
dst2 = malloc(num_buffers * sizeof(**dst2));
- assert(dst2);
+ igt_assert(dst2);
s_src = malloc(num_buffers * sizeof(*s_src));
- assert(s_src);
+ igt_assert(s_src);
s_dst = malloc(num_buffers * sizeof(*s_dst));
- assert(s_dst);
+ igt_assert(s_dst);
p_dst1 = malloc(num_buffers * sizeof(unsigned int));
if (p_dst1 == NULL)
for (i = 0; i < num_buffers; i++) {
p_dst1[i] = p_dst2[i] = i;
src[i] = create_bo(bufmgr, i, width, height);
- assert(src[i]);
+ igt_assert(src[i]);
dst1[i] = create_bo(bufmgr, ~i, width, height);
- assert(dst1[i]);
+ igt_assert(dst1[i]);
dst2[i] = create_bo(bufmgr, ~i, width, height);
- assert(dst2[i]);
+ igt_assert(dst2[i]);
init_buffer(bufmgr, &s_src[i], src[i], width, height);
init_buffer(bufmgr, &s_dst[i], dst1[i], width, height);
}
if (getcwd(path, PATH_MAX) == NULL)
perror("getcwd");
- assert(snprintf(full_path, PATH_MAX, "%s/%s", path, wexp.we_wordv[0]) > 0);
+ igt_assert(snprintf(full_path, PATH_MAX, "%s/%s", path, wexp.we_wordv[0]) > 0);
/* if (!options.verbose) {
close(STDOUT_FILENO);
int wrap = 0;
r = __read_seqno(&seqno);
- assert(r == 0);
+ igt_assert(r == 0);
if (last_seqno > seqno)
wrap++;
return 0;
fh = dfs_open(O_RDWR);
- assert(snprintf(buf, sizeof(buf), "0x%x", seqno) > 0);
+ igt_assert(snprintf(buf, sizeof(buf), "0x%x", seqno) > 0);
r = write(fh, buf, strnlen(buf, sizeof(buf)));
close(fh);
if (r < 0)
return r;
- assert(r == strnlen(buf, sizeof(buf)));
+ igt_assert(r == strnlen(buf, sizeof(buf)));
last_seqno = seqno;
static void preset_run_once(void)
{
- assert(write_seqno(1) == 0);
- assert(run_test() == 0);
+ igt_assert(write_seqno(1) == 0);
+ igt_assert(run_test() == 0);
- assert(write_seqno(0x7fffffff) == 0);
- assert(run_test() == 0);
+ igt_assert(write_seqno(0x7fffffff) == 0);
+ igt_assert(run_test() == 0);
- assert(write_seqno(0xffffffff) == 0);
- assert(run_test() == 0);
+ igt_assert(write_seqno(0xffffffff) == 0);
+ igt_assert(run_test() == 0);
- assert(write_seqno(0xfffffff0) == 0);
- assert(run_test() == 0);
+ igt_assert(write_seqno(0xfffffff0) == 0);
+ igt_assert(run_test() == 0);
}
static void random_run_once(void)
val += random();
} while (val == 0);
- assert(write_seqno(val) == 0);
- assert(run_test() == 0);
+ igt_assert(write_seqno(val) == 0);
+ igt_assert(run_test() == 0);
}
static void wrap_run_once(void)
{
const uint32_t pw_val = calc_prewrap_val();
- assert(write_seqno(UINT32_MAX - pw_val) == 0);
+ igt_assert(write_seqno(UINT32_MAX - pw_val) == 0);
while(!read_seqno())
- assert(run_test() == 0);
+ igt_assert(run_test() == 0);
}
static void background_run_once(void)
{
const uint32_t pw_val = calc_prewrap_val();
- assert(write_seqno(UINT32_MAX - pw_val) == 0);
+ igt_assert(write_seqno(UINT32_MAX - pw_val) == 0);
while(!read_seqno())
sleep(3);
parse_options(argc, argv);
card_index = drm_get_card(0);
- assert(card_index != -1);
+ igt_assert(card_index != -1);
srandom(time(NULL));
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
test_bo = drm_intel_bo_alloc(bufmgr, "tiled busy bo", TEST_SIZE, 4096);
test_bo_handle = test_bo->handle;
ret = drm_intel_bo_set_tiling(test_bo, &tiling_after, stride_after);
- assert(ret == 0);
+ igt_assert(ret == 0);
drm_intel_gem_bo_map_gtt(test_bo);
ptr = test_bo->virtual;
*ptr = 0;
test_bo_handle = test_bo->handle;
/* ensure we have the right tiling before we start. */
ret = drm_intel_bo_set_tiling(test_bo, &tiling, stride);
- assert(ret == 0);
+ igt_assert(ret == 0);
if (tiling == I915_TILING_NONE) {
drm_intel_bo_subdata(test_bo, 0, TEST_SIZE, data);
if (test_bo_handle != test_bo->handle)
fprintf(stderr, "libdrm reuse trick failed\n");
ret = drm_intel_bo_set_tiling(test_bo, &tiling_after, stride_after);
- assert(ret == 0);
+ igt_assert(ret == 0);
/* Note: We don't care about gen4+ here because the blitter doesn't use
* fences there. So not setting tiling flags on the tiled buffer is ok.
memset(data, 0, TEST_SIZE);
drm_intel_bo_get_subdata(target_bo, 0, TEST_SIZE, data);
for (i = 0; i < TEST_SIZE/4; i++)
- assert(data[i] == i);
+ igt_assert(data[i] == i);
/* check whether tiling on the test_bo actually changed. */
drm_intel_gem_bo_map_gtt(test_bo);
tiling_changed = true;
ptr = NULL;
drm_intel_gem_bo_unmap_gtt(test_bo);
- assert(tiling_changed);
+ igt_assert(tiling_changed);
drm_intel_bo_unreference(test_bo);
drm_intel_bo_unreference(target_bo);
tiling = I915_TILING_NONE;
tiling_after = I915_TILING_X;
do_test(tiling, TEST_STRIDE, tiling_after, TEST_STRIDE);
- assert(tiling == I915_TILING_NONE);
- assert(tiling_after == I915_TILING_X);
+ igt_assert(tiling == I915_TILING_NONE);
+ igt_assert(tiling_after == I915_TILING_X);
}
igt_subtest("tiled-to-untiled") {
tiling = I915_TILING_X;
tiling_after = I915_TILING_NONE;
do_test(tiling, TEST_STRIDE, tiling_after, TEST_STRIDE);
- assert(tiling == I915_TILING_X);
- assert(tiling_after == I915_TILING_NONE);
+ igt_assert(tiling == I915_TILING_X);
+ igt_assert(tiling_after == I915_TILING_NONE);
}
igt_subtest("tiled-to-tiled") {
tiling = I915_TILING_X;
tiling_after = I915_TILING_X;
do_test(tiling, TEST_STRIDE/2, tiling_after, TEST_STRIDE);
- assert(tiling == I915_TILING_X);
- assert(tiling_after == I915_TILING_X);
+ igt_assert(tiling == I915_TILING_X);
+ igt_assert(tiling_after == I915_TILING_X);
}
return 0;
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
handle = gem_create(fd, OBJECT_SIZE);
ptr = gem_mmap(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE);
- assert(ptr);
+ igt_assert(ptr);
/* 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);
for (i = 0; i < OBJECT_SIZE/4; i++)
if (ptr[i] != data[i])
tiling_changed = true;
- assert(tiling_changed);
+ igt_assert(tiling_changed);
gem_set_domain(fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
for (i = 0; i < OBJECT_SIZE/4; i++)
i, row, half, ofs);
printf("read: 0x%08x, expected: 0x%08x\n",
ptr[i], val);
- assert(0);
+ igt_assert(0);
}
}
for (i = 0; i < OBJECT_SIZE/4; i++)
if (ptr[i] != data[i])
tiling_changed = true;
- assert(tiling_changed);
+ igt_assert(tiling_changed);
munmap(ptr, OBJECT_SIZE);
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
handle = gem_create(fd, OBJECT_SIZE);
ptr = gem_mmap(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE);
- assert(ptr);
+ igt_assert(ptr);
gem_set_tiling(fd, handle, I915_TILING_X, TEST_STRIDE);
memset(data, 0, OBJECT_SIZE);
gem_read(fd, handle, 0, data, OBJECT_SIZE);
for (i = 0; i < OBJECT_SIZE/4; i++)
- assert(i == data[i]);
+ igt_assert(i == data[i]);
/* touch it before changing the tiling, so that the fence sticks around */
gem_set_domain(fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
memset(data, 0, OBJECT_SIZE);
gem_read(fd, handle, 0, data, OBJECT_SIZE);
for (i = 0; i < OBJECT_SIZE/4; i++)
- assert(i == data[i]);
+ igt_assert(i == data[i]);
munmap(ptr, OBJECT_SIZE);
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
static void tile2xy(struct scratch_buf *buf, unsigned tile, unsigned *x, unsigned *y)
{
- assert(tile < buf->num_tiles);
+ igt_assert(tile < buf->num_tiles);
*x = (tile*options.tile_size) % (buf->stride/sizeof(uint32_t));
*y = ((tile*options.tile_size) / (buf->stride/sizeof(uint32_t))) * options.tile_size;
}
int tmp;
tmp = 1 << gpu_busy_load;
- assert(tmp <= 1024);
+ igt_assert(tmp <= 1024);
emit_blt(busy_bo, 0, 4096, 0, 0, tmp, 128,
busy_bo, 0, 4096, 0, 128);
struct scratch_buf *dst, unsigned dst_x, unsigned dst_y,
unsigned logical_tile_no)
{
- assert(batch->ptr == batch->buffer);
+ igt_assert(batch->ptr == batch->buffer);
if (options.ducttape)
drm_intel_bo_wait_rendering(dst->bo);
uint32_t tmp_tile[options.tile_size*options.tile_size];
int i;
- assert(batch->ptr == batch->buffer);
+ igt_assert(batch->ptr == batch->buffer);
if (options.ducttape)
drm_intel_bo_wait_rendering(dst->bo);
if (buf_width(buf) < options.tile_size)
buf->stride = options.tile_size * sizeof(uint32_t);
- assert(buf->stride <= 8192);
- assert(buf_width(buf) <= options.max_dimension);
- assert(buf_height(buf) <= options.max_dimension);
+ igt_assert(buf->stride <= 8192);
+ igt_assert(buf_width(buf) <= options.max_dimension);
+ igt_assert(buf_height(buf) <= options.max_dimension);
- assert(buf_width(buf) >= options.tile_size);
- assert(buf_height(buf) >= options.tile_size);
+ igt_assert(buf_width(buf) >= options.tile_size);
+ igt_assert(buf_height(buf) >= options.tile_size);
}
{
buf->bo = drm_intel_bo_alloc(bufmgr, "tiled bo", size, 4096);
buf->size = size;
- assert(buf->bo);
+ igt_assert(buf->bo);
buf->tiling = I915_TILING_NONE;
buf->stride = 4096;
val = gem_available_fences(drm_fd);
printf ("total %d fences\n", val);
- assert(val > 4);
+ igt_assert(val > 4);
return val - 2;
}
tile_permutation = malloc(num_total_tiles*sizeof(uint32_t));
current_permutation = malloc(num_total_tiles*sizeof(uint32_t));
tmp_permutation = malloc(num_total_tiles*sizeof(uint32_t));
- assert(tile_permutation);
- assert(current_permutation);
- assert(tmp_permutation);
+ igt_assert(tile_permutation);
+ igt_assert(current_permutation);
+ igt_assert(tmp_permutation);
fan_out();
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
/* Access the buffer objects in the order we want to have the laid out. */
ptr1 = gem_mmap(fd, handle1, OBJECT_SIZE, PROT_READ | PROT_WRITE);
- assert(ptr1 != MAP_FAILED);
+ igt_assert(ptr1 != MAP_FAILED);
for (i = 0; i < OBJECT_SIZE/sizeof(uint32_t); i++)
ptr1[i] = i;
ptr_tiled = gem_mmap(fd, handle_tiled, OBJECT_SIZE, PROT_READ | PROT_WRITE);
- assert(ptr_tiled != MAP_FAILED);
+ igt_assert(ptr_tiled != MAP_FAILED);
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(fd, handle2, OBJECT_SIZE, PROT_READ | PROT_WRITE);
- assert(ptr2 != MAP_FAILED);
+ igt_assert(ptr2 != MAP_FAILED);
for (i = 0; i < OBJECT_SIZE/sizeof(uint32_t); i++)
ptr2[i] = i;
printf("checking the first canary object\n");
for (i = 0; i < OBJECT_SIZE/sizeof(uint32_t); i++)
- assert(ptr1[i] == i);
+ igt_assert(ptr1[i] == i);
printf("checking the second canary object\n");
for (i = 0; i < OBJECT_SIZE/sizeof(uint32_t); i++)
- assert(ptr2[i] == i);
+ igt_assert(ptr2[i] == i);
gem_close(fd, handle1);
gem_close(fd, handle2);
#include <stdlib.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <unistd.h>
#include <pthread.h>
for (i = 0; i < NUM_THREADS; i++) {
tctx[i].bo = bo;
r = pthread_create(&thr[i], NULL, copy_fn, (void *)&tctx[i]);
- assert(r == 0);
+ igt_assert(r == 0);
}
for (i = 0; i < NUM_THREADS; i++) {
pthread_join(thr[i], &status);
- assert(status == 0);
+ igt_assert(status == 0);
}
return 0;
igt_skip_on_simulation();
fd = drm_open_any();
- assert(fd >= 0);
+ igt_assert(fd >= 0);
bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
- assert(bufmgr);
+ igt_assert(bufmgr);
bo = drm_intel_bo_alloc_tiled(bufmgr, "mmap bo", WIDTH, HEIGHT, 1,
&tiling_mode, &pitch, 0);
- assert(bo);
+ igt_assert(bo);
r = drm_intel_gem_bo_map_gtt(bo);
- assert(!r);
+ igt_assert(!r);
r = copy_tile_threaded(bo);
- assert(!r);
+ igt_assert(!r);
r = drm_intel_gem_bo_unmap_gtt(bo);
- assert(!r);
+ igt_assert(!r);
drm_intel_bo_unreference(bo);
drm_intel_bufmgr_destroy(bufmgr);
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
bo = drm_intel_bo_alloc(bufmgr, "tiled bo", 1024 * 1024, 4096);
do_or_die(drm_intel_bo_set_tiling(bo, &tiling, width * 4));
- assert(tiling == I915_TILING_X);
+ igt_assert(tiling == I915_TILING_X);
linear_bo = drm_intel_bo_alloc(bufmgr, "linear src", 1024 * 1024, 4096);
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
bo = drm_intel_bo_alloc(bufmgr, "tiled bo", 1024 * 1024, 4096);
ret = drm_intel_bo_set_tiling(bo, &tiling, width * 4);
- assert(ret == 0);
- assert(tiling == I915_TILING_X);
+ igt_assert(ret == 0);
+ igt_assert(tiling == I915_TILING_X);
/* Fill the BO with dwords starting at start_val */
for (i = 0; i < 1024 * 1024 / 4; i++)
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
scratch_bo = drm_intel_bo_alloc_tiled(bufmgr, "scratch bo", 1024,
BO_SIZE/4096, 4,
&tiling_mode, &scratch_pitch, 0);
- assert(tiling_mode == I915_TILING_X);
- assert(scratch_pitch == 4096);
+ igt_assert(tiling_mode == I915_TILING_X);
+ igt_assert(scratch_pitch == 4096);
staging_bo = drm_intel_bo_alloc(bufmgr, "staging bo", BO_SIZE, 4096);
tiled_staging_bo = drm_intel_bo_alloc_tiled(bufmgr, "scratch bo", 1024,
BO_SIZE/4096, 4,
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
get_tiling.handle = handle;
ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_GET_TILING, &get_tiling);
- assert(ret == 0);
+ igt_assert(ret == 0);
*tiling = get_tiling.tiling_mode;
*swizzle = get_tiling.swizzle_mode;
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
get_tiling.handle = handle;
ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_GET_TILING, &get_tiling);
- assert(ret == 0);
+ igt_assert(ret == 0);
*tiling = get_tiling.tiling_mode;
*swizzle = get_tiling.swizzle_mode;
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
/* need slightly more than total ram */
count = intel_get_total_ram_mb() * 11 / 10;
bo_handles = calloc(count, sizeof(uint32_t));
- assert(bo_handles);
+ igt_assert(bo_handles);
idx_arr = calloc(count, sizeof(int));
- assert(idx_arr);
+ igt_assert(idx_arr);
if (intel_get_total_swap_mb() == 0) {
printf("no swap detected\n");
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
ret = ioctl(fd, DRM_IOCTL_I915_GEM_SET_TILING, &st);
} while (ret == -1 && (errno == EINTR || errno == EAGAIN));
- assert(ret == -1 && errno == EINVAL);
+ igt_assert(ret == -1 && errno == EINVAL);
}
static void test_invalid_tiling(int fd, uint32_t handle, int stride)
size = stride * tile_height;
data = malloc(size);
- assert(data);
+ igt_assert(data);
/* Fill each line with the line number */
for (y = 0; y < tile_height; y++) {
handle = gem_create(fd, size);
ptr = gem_mmap(fd, handle, size, PROT_READ | PROT_WRITE);
- assert(ptr);
+ igt_assert(ptr);
test_invalid_tiling(fd, handle, 0);
test_invalid_tiling(fd, handle, 64);
for (i = 0; i < size / 4; ) {
for (y = 0; y < tile_height; y++) {
for (x = 0; x < tile_width / 4; x++) {
- assert(y == data[i]);
+ igt_assert(y == data[i]);
i++;
}
}
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
test_bo = drm_intel_bo_alloc(bufmgr, "test_bo",
TEST_SIZE, 4096);
ret = drm_intel_bo_set_tiling(test_bo, &tiling, TEST_STRIDE);
- assert(ret == 0);
+ igt_assert(ret == 0);
drm_intel_bo_disable_reuse(test_bo);
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
//drm_intel_bufmgr_gem_enable_reuse(bufmgr);
batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
- assert(batch);
+ igt_assert(batch);
/* put some load onto the gpu to keep the light buffers active for long
* enough */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
pread.size = size;
pread.data_ptr = (uintptr_t)buf;
ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_PREAD, &pread);
- assert(ret == 0);
+ igt_assert(ret == 0);
}
static void
drmCommandNone(fd, DRM_I915_GEM_THROTTLE);
ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
}
- assert(ret == 0);
+ igt_assert(ret == 0);
gem_close(fd, handle);
}
struct local_drm_i915_gem_wait wait;
int ret;
- assert(timeout_ns);
+ igt_assert(timeout_ns);
wait.bo_handle = handle;
wait.timeout_ns = *timeout_ns;
#define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC
#endif
- assert(clock_gettime(CLOCK_MONOTONIC_RAW, &start) == 0);
+ igt_assert(clock_gettime(CLOCK_MONOTONIC_RAW, &start) == 0);
for (i = 0; i < iter; i++)
blt_color_fill(batch, dst, BUF_PAGES);
intel_batchbuffer_flush(batch);
drm_intel_bo_wait_rendering(dst);
- assert(clock_gettime(CLOCK_MONOTONIC_RAW, &end) == 0);
+ igt_assert(clock_gettime(CLOCK_MONOTONIC_RAW, &end) == 0);
diff = do_time_diff(&end, &start);
- assert(diff >= 0);
+ igt_assert(diff >= 0);
if ((diff / MSEC_PER_SEC) > ENOUGH_WORK_IN_SECONDS)
done = true;
iter <<= 1;
} while (!done && iter < 1000000);
- assert(iter < 1000000);
+ igt_assert(iter < 1000000);
printf("%d iters is enough work\n", iter);
gem_quiescent_gpu(fd);
blt_color_fill(batch, dst2, BUF_PAGES);
intel_batchbuffer_flush(batch);
- assert(gem_bo_busy(fd, dst2->handle) == true);
+ igt_assert(gem_bo_busy(fd, dst2->handle) == true);
ret = gem_bo_wait_timeout(fd, dst2->handle, &timeout);
if (ret) {
fprintf(stderr, "Timed wait failed %s\n", strerror(errno));
exit(EXIT_FAILURE);
}
- assert(gem_bo_busy(fd, dst2->handle) == false);
- assert(timeout != 0);
+ igt_assert(gem_bo_busy(fd, dst2->handle) == false);
+ igt_assert(timeout != 0);
if (timeout == (ENOUGH_WORK_IN_SECONDS * NSEC_PER_SEC))
printf("Buffer was already done!\n");
else {
/* check that polling with timeout=0 works. */
timeout = 0;
- assert(gem_bo_wait_timeout(fd, dst2->handle, &timeout) == 0);
- assert(timeout == 0);
+ igt_assert(gem_bo_wait_timeout(fd, dst2->handle, &timeout) == 0);
+ igt_assert(timeout == 0);
/* Now check that we correctly time out, twice the auto-tune load should
* be good enough. */
intel_batchbuffer_flush(batch);
ret = gem_bo_wait_timeout(fd, dst2->handle, &timeout);
- assert(ret == -ETIME);
- assert(timeout == 0);
- assert(gem_bo_busy(fd, dst2->handle) == true);
+ igt_assert(ret == -ETIME);
+ igt_assert(timeout == 0);
+ igt_assert(gem_bo_busy(fd, dst2->handle) == true);
/* check that polling with timeout=0 works. */
timeout = 0;
- assert(gem_bo_wait_timeout(fd, dst2->handle, &timeout) == -ETIME);
- assert(timeout == 0);
+ igt_assert(gem_bo_wait_timeout(fd, dst2->handle, &timeout) == -ETIME);
+ igt_assert(timeout == 0);
if (do_signals)
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
* set_domain. */
drm_intel_bo_map(target_bo, 0);
ptr = target_bo->virtual;
- assert(*ptr == 0);
+ igt_assert(*ptr == 0);
/* put some load onto the gpu to keep the light buffers active for long
* enough */
intel_batchbuffer_flush_on_ring(batch, ring);
gem_set_domain(fd, target_bo->handle, I915_GEM_DOMAIN_GTT, 0);
- assert(*ptr == COLOR);
+ igt_assert(*ptr == COLOR);
drm_intel_bo_unmap(target_bo);
drm_intel_bo_unreference(target_bo);
//drm_intel_bufmgr_gem_enable_reuse(bufmgr);
batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
- assert(batch);
+ igt_assert(batch);
dummy_bo = drm_intel_bo_alloc(bufmgr, "dummy bo", 4096, 4096);
if (!dummy_bo) {
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
if ((b - batch) & 1)
*b++ = 0;
- assert(b - batch <= 1024);
+ igt_assert(b - batch <= 1024);
handle = gem_create(fd, 4096);
gem_write(fd, handle, 0, batch, (b-batch)*sizeof(batch[0]));
- assert(r-reloc == 2);
+ igt_assert(r-reloc == 2);
tiling_bits = 0;
if (use_fence)
drmCommandNone(fd, DRM_I915_GEM_THROTTLE);
ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
}
- assert(ret == 0);
+ igt_assert(ret == 0);
gem_close(fd, handle);
}
if ((b - batch) & 1)
*b++ = 0;
- assert(b - batch <= 1024);
+ igt_assert(b - batch <= 1024);
handle = gem_create(fd, 4096);
gem_write(fd, handle, 0, batch, (b-batch)*sizeof(batch[0]));
- assert(r-reloc == 2);
+ igt_assert(r-reloc == 2);
obj[0].handle = dst;
obj[0].relocation_count = 0;
drmCommandNone(fd, DRM_I915_GEM_THROTTLE);
ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
}
- assert(ret == 0);
+ igt_assert(ret == 0);
gem_close(fd, handle);
}
/* Fill the BO with dwords starting at val */
v = gem_mmap(fd, handle, WIDTH*HEIGHT*4, PROT_READ | PROT_WRITE);
- assert(v);
+ igt_assert(v);
for (i = 0; i < WIDTH*HEIGHT; i++)
v[i] = val++;
munmap(v, WIDTH*HEIGHT*4);
int i;
v = gem_mmap(fd, handle, WIDTH*HEIGHT*4, PROT_READ);
- assert(v);
+ igt_assert(v);
for (i = 0; i < WIDTH*HEIGHT; i++) {
if (v[i] != val) {
fprintf(stderr, "Expected 0x%08x, found 0x%08x "
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
if ((b - batch) & 1)
*b++ = 0;
- assert(b - batch <= 1024);
+ igt_assert(b - batch <= 1024);
handle = gem_create(fd, 4096);
gem_write(fd, handle, 0, batch, (b-batch)*sizeof(batch[0]));
- assert(r-reloc == 2);
+ igt_assert(r-reloc == 2);
obj[0].handle = dst;
obj[0].relocation_count = 0;
drmCommandNone(fd, DRM_I915_GEM_THROTTLE);
ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
}
- assert(ret == 0);
+ igt_assert(ret == 0);
gem_close(fd, handle);
}
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
if ((b - batch) & 1)
*b++ = 0;
- assert(b - batch <= 1024);
+ igt_assert(b - batch <= 1024);
handle = gem_create(fd, 4096);
gem_write(fd, handle, 0, batch, (b-batch)*sizeof(batch[0]));
- assert(r-reloc == 2);
+ igt_assert(r-reloc == 2);
obj[0].handle = dst;
obj[0].relocation_count = 0;
drmCommandNone(fd, DRM_I915_GEM_THROTTLE);
ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
}
- assert(ret == 0);
+ igt_assert(ret == 0);
gem_close(fd, handle);
}
/* Fill the BO with dwords starting at val */
v = gem_mmap(fd, handle, WIDTH*HEIGHT*4, PROT_READ | PROT_WRITE);
- assert(v);
+ igt_assert(v);
for (i = 0; i < WIDTH*HEIGHT; i++)
v[i] = val++;
munmap(v, WIDTH*HEIGHT*4);
int i;
v = gem_mmap(fd, handle, WIDTH*HEIGHT*4, PROT_READ);
- assert(v);
+ igt_assert(v);
for (i = 0; i < WIDTH*HEIGHT; i++) {
if (v[i] != val) {
fprintf(stderr, "Expected 0x%08x, found 0x%08x "
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
if ((b - batch) & 1)
*b++ = 0;
- assert(b - batch <= 1024);
+ igt_assert(b - batch <= 1024);
handle = gem_create(fd, 4096);
gem_write(fd, handle, 0, batch, (b-batch)*sizeof(batch[0]));
- assert(r-reloc == 2);
+ igt_assert(r-reloc == 2);
obj[0].handle = dst;
obj[0].relocation_count = 0;
drmCommandNone(fd, DRM_I915_GEM_THROTTLE);
ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
}
- assert(ret == 0);
+ igt_assert(ret == 0);
gem_close(fd, handle);
}
/* Fill the BO with dwords starting at val */
v = gem_mmap(fd, handle, WIDTH*HEIGHT*4, PROT_READ | PROT_WRITE);
- assert(v);
+ igt_assert(v);
for (i = 0; i < WIDTH*HEIGHT; i++)
v[i] = val++;
munmap(v, WIDTH*HEIGHT*4);
int i;
v = gem_mmap(fd, handle, WIDTH*HEIGHT*4, PROT_READ);
- assert(v);
+ igt_assert(v);
for (i = 0; i < WIDTH*HEIGHT; i++) {
if (v[i] != val) {
fprintf(stderr, "Expected 0x%08x, found 0x%08x "
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
if ((b - batch) & 1)
*b++ = 0;
- assert(b - batch <= 1024);
+ igt_assert(b - batch <= 1024);
handle = gem_create(fd, 4096);
gem_write(fd, handle, 0, batch, (b-batch)*sizeof(batch[0]));
- assert(r-reloc == 2);
+ igt_assert(r-reloc == 2);
obj[0].handle = dst;
obj[0].relocation_count = 0;
drmCommandNone(fd, DRM_I915_GEM_THROTTLE);
ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
}
- assert(ret == 0);
+ igt_assert(ret == 0);
gem_close(fd, handle);
}
/* Fill the BO with dwords starting at val */
v = gem_mmap(fd, handle, WIDTH*HEIGHT*4, PROT_READ | PROT_WRITE);
- assert(v);
+ igt_assert(v);
for (i = 0; i < WIDTH*HEIGHT; i++)
v[i] = val++;
munmap(v, WIDTH*HEIGHT*4);
int i;
v = gem_mmap(fd, handle, WIDTH*HEIGHT*4, PROT_READ);
- assert(v);
+ igt_assert(v);
for (i = 0; i < WIDTH*HEIGHT; i++) {
if (v[i] != val) {
fprintf(stderr, "Expected 0x%08x, found 0x%08x "
*/
client.idx = 0;
ret = ioctl(fd, DRM_IOCTL_GET_CLIENT, &client);
- assert(ret == 0);
+ igt_assert(ret == 0);
/* Look for some absurd client index and make sure it's invalid.
* The DRM drivers currently always return data, so the user has
*/
client.idx = 0x7fffffff;
ret = ioctl(fd, DRM_IOCTL_GET_CLIENT, &client);
- assert(ret == -1 && errno == EINVAL);
+ igt_assert(ret == -1 && errno == EINVAL);
close(fd);
return 0;
fd = drm_open_any();
ret = ioctl(fd, DRM_IOCTL_GET_STATS, &stats);
- assert(ret == 0);
+ igt_assert(ret == 0);
close(fd);
return 0;
fd = drm_open_any();
v = drmGetVersion(fd);
- assert(strlen(v->name) != 0);
- assert(strlen(v->date) != 0);
- assert(strlen(v->desc) != 0);
- assert(v->version_major >= 1);
+ igt_assert(strlen(v->name) != 0);
+ igt_assert(strlen(v->date) != 0);
+ igt_assert(strlen(v->desc) != 0);
+ igt_assert(v->version_major >= 1);
drmFree(v);
close(fd);
return 0;
#include "config.h"
#endif
-#include <assert.h>
#include <cairo.h>
#include <errno.h>
#include <fcntl.h>
limit = intel_gen(devid) < 6 ? 500 : 5000;
dummy_bo = drm_intel_bo_alloc(bufmgr, "dummy_bo", fb_info->size, 4096);
- assert(dummy_bo);
+ igt_assert(dummy_bo);
target_bo = gem_handle_to_libdrm_bo(bufmgr, drm_fd, "imported", fb_info->gem_handle);
- assert(target_bo);
+ igt_assert(target_bo);
for (i = 0; i < limit; i++) {
BEGIN_BATCH(8);
static void set_flag(unsigned int *v, unsigned int flag)
{
- assert(!(*v & flag));
+ igt_assert(!(*v & flag));
*v |= flag;
}
static void clear_flag(unsigned int *v, unsigned int flag)
{
- assert(*v & flag);
+ igt_assert(*v & flag);
*v &= ~flag;
}
memset(&wait_vbl, 0, sizeof(wait_vbl));
crtc_idx_mask = crtc_idx << DRM_VBLANK_HIGH_CRTC_SHIFT;
- assert(!(crtc_idx_mask & ~DRM_VBLANK_HIGH_CRTC_MASK));
+ igt_assert(!(crtc_idx_mask & ~DRM_VBLANK_HIGH_CRTC_MASK));
wait_vbl.request.type = crtc_idx_mask;
if (flags & TEST_VBLANK_ABSOLUTE)
/* Call rmfb/getfb/addfb to ensure those don't introduce stalls */
r = drmModeGetFB(drm_fd, fb_info->fb_id);
- assert(r);
+ igt_assert(r);
do_or_die(drmModeAddFB(drm_fd, o->fb_width, o->fb_height, o->depth,
o->bpp, fb_info->stride,
/* Call rmfb/getfb/addfb to ensure those don't introduce stalls */
r = drmModeGetFB(drm_fd, fb_info->fb_id);
- assert(r);
+ igt_assert(r);
gem_set_tiling(drm_fd, r->handle, I915_TILING_Y, fb_info->stride);
gem_close(drm_fd, r->handle);
drmFree(r);
int fd;
ssize_t r;
- assert(card_index != -1);
+ igt_assert(card_index != -1);
/* clear the error state */
snprintf(fname, FILENAME_MAX, "%s/%i/%s",
int fd;
ssize_t r;
- assert(card_index != -1);
+ igt_assert(card_index != -1);
snprintf(fname, FILENAME_MAX, "%s/%i/%s",
dfs_base, card_index, dfs_entry);
do_or_die(__wait_for_vblank(TEST_VBLANK_ABSOLUTE |
TEST_VBLANK_BLOCK, o->pipe, exp_seq,
0, &reply));
- assert(gettime_us() - start < 500);
- assert(reply.sequence == exp_seq);
- assert(timercmp(&reply.ts, &o->flip_state.last_ts, ==));
+ igt_assert(gettime_us() - start < 500);
+ igt_assert(reply.sequence == exp_seq);
+ igt_assert(timercmp(&reply.ts, &o->flip_state.last_ts, ==));
}
if (do_flip && (o->flags & TEST_EINVAL) && o->flip_state.count > 0)
- assert(do_page_flip(o, new_fb_id, true) == expected_einval);
+ igt_assert(do_page_flip(o, new_fb_id, true) == expected_einval);
if (o->flags & TEST_FB_BAD_TILING)
new_fb_id = o->fb_ids[o->current_fb_id];
if (do_vblank && (o->flags & TEST_EINVAL) && o->vblank_state.count > 0)
- assert(do_wait_for_vblank(o, o->pipe, target_seq, &vbl_reply)
+ igt_assert(do_wait_for_vblank(o, o->pipe, target_seq, &vbl_reply)
== -EINVAL);
if (o->flags & TEST_DPMS_OFF)
}
if (do_flip && (o->flags & TEST_EBUSY))
- assert(do_page_flip(o, new_fb_id, true) == -EBUSY);
+ igt_assert(do_page_flip(o, new_fb_id, true) == -EBUSY);
if (do_flip && (o->flags & TEST_RMFB))
recreate_fb(o);
}
if (do_vblank && (o->flags & TEST_EINVAL) && o->vblank_state.count > 0)
- assert(do_wait_for_vblank(o, o->pipe, target_seq, &vbl_reply)
+ igt_assert(do_wait_for_vblank(o, o->pipe, target_seq, &vbl_reply)
== -EINVAL);
if (do_flip && (o->flags & TEST_EINVAL) && !(o->flags & TEST_FB_BAD_TILING))
- assert(do_page_flip(o, new_fb_id, true) == expected_einval);
+ igt_assert(do_page_flip(o, new_fb_id, true) == expected_einval);
if (do_flip && (o->flags & TEST_HANG)) {
gem_sync(drm_fd, handle);
cairo_set_source_rgb(cr, 1, 1, 1);
cairo_fill(cr);
- assert(!cairo_status(cr));
+ igt_assert(!cairo_status(cr));
}
static int
int ret;
event_mask = o->pending_events;
- assert(event_mask);
+ igt_assert(event_mask);
memset(&evctx, 0, sizeof evctx);
evctx.version = DRM_EVENT_CONTEXT_VERSION;
do_or_die(drmHandleEvent(drm_fd, &evctx));
event_mask ^= o->pending_events;
- assert(event_mask);
+ igt_assert(event_mask);
return event_mask;
}
}
goto out;
}
- assert(fb_is_bound(o, o->fb_ids[0]));
+ igt_assert(fb_is_bound(o, o->fb_ids[0]));
/* quiescent the hw a bit so ensure we don't miss a single frame */
if (o->flags & TEST_CHECK_TS)
int ret;
ret = drmGetCap(drm_fd, DRM_CAP_TIMESTAMP_MONOTONIC, &cap_mono);
- assert(ret == 0 || errno == EINVAL);
+ igt_assert(ret == 0 || errno == EINVAL);
monotonic_timestamp = ret == 0 && cap_mono == 1;
printf("Using %s timestamps\n",
monotonic_timestamp ? "monotonic" : "real");
#include "config.h"
#endif
-#include <assert.h>
#include <cairo.h>
#include <errno.h>
#include <stdint.h>
drm_intel_bo *src_bo;
int bpp;
- assert(dst_fb->drm_format == src_fb->drm_format);
- assert(src_fb->drm_format == DRM_FORMAT_RGB565 ||
+ igt_assert(dst_fb->drm_format == src_fb->drm_format);
+ igt_assert(src_fb->drm_format == DRM_FORMAT_RGB565 ||
drm_format_to_bpp(src_fb->drm_format) != 16);
bpp = drm_format_to_bpp(src_fb->drm_format);
dst_bo = gem_handle_to_libdrm_bo(bufmgr, drm_fd, "destination",
dst_fb->gem_handle);
- assert(dst_bo);
+ igt_assert(dst_bo);
src_bo = gem_handle_to_libdrm_bo(bufmgr, drm_fd, "source",
src_fb->gem_handle);
- assert(src_bo);
+ igt_assert(src_bo);
intel_blt_copy(batch,
src_bo, 0, 0, src_fb->width * bpp / 8,
ret = asprintf(&mode_format_str, "%s @ %dHz / %s",
mode->name, mode->vrefresh, kmstest_format_str(format));
- assert(ret > 0);
+ igt_assert(ret > 0);
ret = asprintf(&cconf_str, "pipe %s, encoder %s, connector %s",
kmstest_pipe_str(cconf->pipe),
kmstest_encoder_type_str(cconf->encoder->encoder_type),
kmstest_connector_type_str(cconf->connector->connector_type));
- assert(ret > 0);
+ igt_assert(ret > 0);
printf("Beginning test %s with %s on %s\n",
test_name, mode_format_str, cconf_str);
int i;
resources = drmModeGetResources(drm_fd);
- assert(resources);
+ igt_assert(resources);
/* Find any connected displays */
for (i = 0; i < resources->count_connectors; i++) {
break;
ret = fgets(vendor_id, 8, fl);
- assert(ret);
+ igt_assert(ret);
fclose(fl);
venid = strtoul(vendor_id, NULL, 16);
{
uint32_t x, y, dx, dy;
uint8_t *endptr = out + w * h;
- assert(!(w % 128));
- assert(!(h % 32));
+ igt_assert(!(w % 128));
+ igt_assert(!(h % 32));
for (y = 0; y < h; y += 32) {
for (x = 0; x < w; x += 128, out += TILE_SIZE) {
for (dy = 0; dy < 32; ++dy) {
uint32_t out_ofs = (dx * 32 + dy) * 16;
uint32_t in_ofs = (y + dy) * w + (x + 16 * dx);
- assert(out_ofs < TILE_SIZE);
- assert(in_ofs < w*h);
+ igt_assert(out_ofs < TILE_SIZE);
+ igt_assert(in_ofs < w*h);
// To do the Y tiling quirk:
// out_ofs = out_ofs ^ (((out_ofs >> 9) & 1) << 6);
}
}
}
- assert(out == endptr);
+ igt_assert(out == endptr);
return 0;
}
{
uint32_t x, y, dy;
uint8_t *endptr = out + w * h;
- assert(!(w % 512));
- assert(!(h % 8));
+ igt_assert(!(w % 512));
+ igt_assert(!(h % 8));
for (y = 0; y < h; y += 8) {
for (x = 0; x < w; x += 512, out += TILE_SIZE) {
for (dy = 0; dy < 8; ++dy) {
uint32_t out_ofs = 512 * dy;
uint32_t in_ofs = (y + dy) * w + x;
- assert(out_ofs < TILE_SIZE);
- assert(in_ofs < w*h);
+ igt_assert(out_ofs < TILE_SIZE);
+ igt_assert(in_ofs < w*h);
memcpy(&out[out_ofs], &in[in_ofs], 512);
}
}
}
- assert(out == endptr);
+ igt_assert(out == endptr);
return 0;
}
break;
ret = fgets(vendor_id, 8, fl);
- assert(ret);
+ igt_assert(ret);
fclose(fl);
venid = strtoul(vendor_id, NULL, 16);
drm_intel_bo *bo;
bo = drm_intel_bo_alloc(ibufmgr, "bo", 4*width*height, 0);
- assert(bo);
+ igt_assert(bo);
/* gtt map doesn't have a write parameter, so just keep the mapping
* around (to avoid the set_domain with the gtt write domain set) and
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
ptr1 = gem_mmap(fd1, handle1, BO_SIZE, PROT_READ | PROT_WRITE);
ptr2 = gem_mmap(fd2, handle2, BO_SIZE, PROT_READ | PROT_WRITE);
- assert(ptr1);
+ igt_assert(ptr1);
/* check whether it's still our old object first. */
for (i = 0; i < BO_SIZE; i++) {
- assert(ptr1[i] == counter);
- assert(ptr2[i] == counter);
+ igt_assert(ptr1[i] == counter);
+ igt_assert(ptr2[i] == counter);
}
counter++;
memset(ptr1, counter, BO_SIZE);
- assert(memcmp(ptr1, ptr2, BO_SIZE) == 0);
+ igt_assert(memcmp(ptr1, ptr2, BO_SIZE) == 0);
munmap(ptr1, BO_SIZE);
munmap(ptr2, BO_SIZE);
handle_import = prime_fd_to_handle(fd2, dma_buf_fd2);
/* dma-buf selfimporting an flink bo should give the same handle */
- assert(handle_import == handle_open);
+ igt_assert(handle_import == handle_open);
close(fd1);
close(fd2);
/* reimport should give us the same handle so that userspace can check
* whether it has that bo already somewhere. */
handle_import2 = prime_fd_to_handle(fd2, dma_buf_fd);
- assert(handle_import1 == handle_import2);
+ igt_assert(handle_import1 == handle_import2);
/* Same for re-importing on the exporting fd. */
handle_selfimport = prime_fd_to_handle(fd1, dma_buf_fd);
- assert(handle == handle_selfimport);
+ igt_assert(handle == handle_selfimport);
/* close dma_buf, check whether nothing disappears. */
close(dma_buf_fd);
char *path;
ret = asprintf(&path, "/sys/kernel/debug/dri/%d/i915_gem_objects", device);
- assert(ret != -1);
+ igt_assert(ret != -1);
file = fopen(path, "r");
scanned = fscanf(file, "%i objects", &ret);
- assert(scanned == 1);
+ igt_assert(scanned == 1);
return ret;
}
threads = calloc(num_threads, sizeof(pthread_t));
fds[0] = drm_open_any();
- assert(fds[0] >= 0);
+ igt_assert(fds[0] >= 0);
handle = gem_create(fds[0], BO_SIZE);
r = pthread_create(&threads[i], NULL,
thread_fn_reimport_vs_close,
(void *)(uintptr_t)fds);
- assert(r == 0);
+ igt_assert(r == 0);
}
sleep(5);
for (i = 0; i < num_threads; i++) {
pthread_join(threads[i], &status);
- assert(status == 0);
+ igt_assert(status == 0);
}
close(fds[0]);
obj_count = get_object_count() - obj_count;
printf("leaked %i objects\n", obj_count);
- assert(obj_count == 0);
+ igt_assert(obj_count == 0);
}
static void *thread_fn_export_vs_close(void *p)
threads = calloc(num_threads, sizeof(pthread_t));
fd = drm_open_any();
- assert(fd >= 0);
+ igt_assert(fd >= 0);
for (i = 0; i < num_threads; i++) {
r = pthread_create(&threads[i], NULL,
thread_fn_export_vs_close,
(void *)(uintptr_t)fd);
- assert(r == 0);
+ igt_assert(r == 0);
}
sleep(5);
for (i = 0; i < num_threads; i++) {
pthread_join(threads[i], &status);
- assert(status == 0);
+ igt_assert(status == 0);
}
close(fd);
obj_count = get_object_count() - obj_count;
printf("leaked %i objects\n", obj_count);
- assert(obj_count == 0);
+ igt_assert(obj_count == 0);
}
int main(int argc, char **argv)
abort();
}
scanned = fscanf(file, "%u", &ret);
- assert(scanned == 1);
+ igt_assert(scanned == 1);
fclose(file);
close(fd);
ret = asprintf(&path, "/sys/class/drm/card%d/power/rc6_enable", device);
- assert(ret != -1);
+ igt_assert(ret != -1);
/* For some reason my ivb isn't idle even after syncing up with the gpu.
* Let's add a sleept just to make it happy. */
exit(EXIT_SUCCESS);
ret = asprintf(&path, "/sys/class/drm/card%d/power/rc6_residency_ms", device);
- assert(ret != -1);
+ igt_assert(ret != -1);
ret = asprintf(&pathp, "/sys/class/drm/card%d/power/rc6p_residency_ms", device);
- assert(ret != -1);
+ igt_assert(ret != -1);
ret = asprintf(&pathpp, "/sys/class/drm/card%d/power/rc6pp_residency_ms", device);
- assert(ret != -1);
+ igt_assert(ret != -1);
value1 = readit(path);
value1p = readit(pathp);
if (!(COND)) { \
writeval(stuff[MIN].filp, origmin); \
writeval(stuff[MAX].filp, origmax); \
- assert(0); \
+ igt_assert(0); \
} \
} while (0);
fflush(filp);
rewind(filp);
scanned = fscanf(filp, "%d", &val);
- assert(scanned == 1);
+ igt_assert(scanned == 1);
return val;
}
rewind(filp);
ret = fprintf(filp, "%d", val);
if (ret && lerrno)
- assert(errno = lerrno);
+ igt_assert(errno = lerrno);
fflush(filp);
return ret;
}
int val = -1;
char *path;
ret = asprintf(&path, sysfs_base_path, device, junk->name);
- assert(ret != -1);
+ igt_assert(ret != -1);
junk->filp = fopen(path, junk->mode);
if (junk->filp == NULL) {
printf("Kernel is too old. GTFO\n");
exit(77);
}
val = readval(junk->filp);
- assert(val >= 0);
+ igt_assert(val >= 0);
junk++;
} while(junk->name != NULL);
#include "config.h"
#endif
-#include <assert.h>
#include <cairo.h>
#include <errno.h>
#include <math.h>
c->pipe = config.pipe;
if (mode_num != -1) {
- assert(mode_num < config.connector->count_modes);
+ igt_assert(mode_num < config.connector->count_modes);
c->mode = config.connector->modes[mode_num];
} else {
c->mode = config.default_mode;
if (qr_code)
paint_image(cr, "./pass.png");
- assert(!cairo_status(cr));
+ igt_assert(!cairo_status(cr));
}
static void sighandler(int signo)
fb_ptr = gem_mmap(drm_fd, fb_info.gem_handle,
fb_info.size, PROT_READ | PROT_WRITE);
- assert(fb_ptr);
+ igt_assert(fb_ptr);
paint_color_key(&fb_info);
gem_close(drm_fd, fb_info.gem_handle);
*(pos+1) = '\0';
ret = chdir(exec_path);
- assert(ret == 0);
+ igt_assert(ret == 0);
free(exec_path);
}