summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/ddi_compute_wrpll.c12
-rw-r--r--tests/drv_hangman.c14
-rw-r--r--tests/gem_bad_reloc.c4
-rw-r--r--tests/gem_fence_upload.c18
-rw-r--r--tests/gem_reg_read.c6
-rw-r--r--tests/gem_render_linear_blits.c2
-rw-r--r--tests/gem_render_tiled_blits.c2
-rw-r--r--tests/gem_ring_sync_copy.c2
-rw-r--r--tests/gem_seqno_wrap.c68
-rw-r--r--tests/gem_stress.c93
-rw-r--r--tests/kms_fence_pin_leak.c4
-rw-r--r--tests/kms_psr_sink_crc.c14
-rw-r--r--tests/testdisplay.c109
-rw-r--r--tests/testdisplay_hotplug.c16
14 files changed, 152 insertions, 212 deletions
diff --git a/tests/ddi_compute_wrpll.c b/tests/ddi_compute_wrpll.c
index 02a96547..45c28e18 100644
--- a/tests/ddi_compute_wrpll.c
+++ b/tests/ddi_compute_wrpll.c
@@ -618,16 +618,8 @@ int main(void)
unsigned r2, n2, p;
wrpll_compute_rnp(ref->clock, &r2, &n2, &p);
- if (ref->r2 != r2 || ref->n2 != n2 || ref->p != p) {
- printf("Computed value differs for %li Hz:\n"
- " Reference: (%u,%u,%u)\n"
- " Computed: (%u,%u,%u)\n",
- (int64_t)ref->clock * 1000,
- ref->r2, ref->n2, ref->p,
- r2, n2, p);
-
- abort();
- }
+ igt_fail_on_f(ref->r2 != r2 || ref->n2 != n2 || ref->p != p,
+ "Computed value differs for %li Hz:\n"" Reference: (%u,%u,%u)\n"" Computed: (%u,%u,%u)\n", (int64_t)ref->clock * 1000, ref->r2, ref->n2, ref->p, r2, n2, p);
}
return 0;
diff --git a/tests/drv_hangman.c b/tests/drv_hangman.c
index d74ed483..3d6b98b4 100644
--- a/tests/drv_hangman.c
+++ b/tests/drv_hangman.c
@@ -118,17 +118,11 @@ static void _assert_dfs_entry(const char *fname, const char *s, bool inverse)
read_dfs(fname, tmp, l + 1);
if (!inverse) {
- if (strncmp(tmp, s, l) != 0) {
- fprintf(stderr, "contents of %s: '%s' (expected '%s')\n",
- fname, tmp, s);
- igt_fail(1);
- }
+ igt_fail_on_f(strncmp(tmp, s, l) != 0,
+ "contents of %s: '%s' (expected '%s')\n", fname, tmp, s);
} else {
- if (strncmp(tmp, s, l) == 0) {
- fprintf(stderr, "contents of %s: '%s' (expected not '%s'\n",
- fname, tmp, s);
- igt_fail(1);
- }
+ igt_fail_on_f(strncmp(tmp, s, l) == 0,
+ "contents of %s: '%s' (expected not '%s'\n", fname, tmp, s);
}
}
diff --git a/tests/gem_bad_reloc.c b/tests/gem_bad_reloc.c
index 26ebd11e..084cb990 100644
--- a/tests/gem_bad_reloc.c
+++ b/tests/gem_bad_reloc.c
@@ -86,7 +86,7 @@ static int negative_reloc(int fd, unsigned flags)
&execbuf));
gem_close(fd, gem_exec[1].handle);
- printf("Found offset %ld for 4k batch\n", (long)gem_exec[0].offset);
+ igt_info("Found offset %ld for 4k batch\n", (long)gem_exec[0].offset);
igt_require(gem_exec[0].offset < BIAS);
memset(gem_reloc, 0, sizeof(gem_reloc));
@@ -106,7 +106,7 @@ static int negative_reloc(int fd, unsigned flags)
DRM_IOCTL_I915_GEM_EXECBUFFER2,
&execbuf));
- printf("Batch is now at offset %ld\n", (long)gem_exec[0].offset);
+ igt_info("Batch is now at offset %ld\n", (long)gem_exec[0].offset);
gem_read(fd, gem_exec[0].handle, 0, buf, sizeof(buf));
gem_close(fd, gem_exec[0].handle);
diff --git a/tests/gem_fence_upload.c b/tests/gem_fence_upload.c
index 8343e01e..ed712c12 100644
--- a/tests/gem_fence_upload.c
+++ b/tests/gem_fence_upload.c
@@ -81,8 +81,7 @@ static void performance(void)
gettimeofday(&end, NULL);
linear[count != 2] = count * loop / elapsed(&start, &end);
- printf("Upload rate for %d linear surfaces: %7.3fMiB/s\n",
- count, linear[count != 2]);
+ igt_info("Upload rate for %d linear surfaces: %7.3fMiB/s\n", count, linear[count != 2]);
for (n = 0; n < count; n++)
gem_set_tiling(fd, handle[n], I915_TILING_X, 1024);
@@ -95,8 +94,7 @@ static void performance(void)
gettimeofday(&end, NULL);
tiled[count != 2] = count * loop / elapsed(&start, &end);
- printf("Upload rate for %d tiled surfaces: %7.3fMiB/s\n",
- count, tiled[count != 2]);
+ igt_info("Upload rate for %d tiled surfaces: %7.3fMiB/s\n", count, tiled[count != 2]);
for (n = 0; n < count; n++) {
munmap(ptr[n], OBJECT_SIZE);
@@ -215,8 +213,7 @@ static void thread_performance(unsigned mask)
gettimeofday(&end, NULL);
linear[count != 2] = nthreads * loops / elapsed(&start, &end) / (OBJECT_SIZE / 4096);
- printf("%s rate for %d linear surfaces, %d threads: %7.3fMiB/s\n",
- direction_string(mask), count, nthreads, linear[count != 2]);
+ igt_info("%s rate for %d linear surfaces, %d threads: %7.3fMiB/s\n", direction_string(mask), count, nthreads, linear[count != 2]);
for (n = 0; n < count; n++)
gem_set_tiling(fd, handle[n], I915_TILING_X, 1024);
@@ -237,8 +234,7 @@ static void thread_performance(unsigned mask)
gettimeofday(&end, NULL);
tiled[count != 2] = nthreads * loops / elapsed(&start, &end) / (OBJECT_SIZE / 4096);
- printf("%s rate for %d tiled surfaces, %d threads: %7.3fMiB/s\n",
- direction_string(mask), count, nthreads, tiled[count != 2]);
+ igt_info("%s rate for %d tiled surfaces, %d threads: %7.3fMiB/s\n", direction_string(mask), count, nthreads, tiled[count != 2]);
for (n = 0; n < count; n++) {
munmap(ptr[n], OBJECT_SIZE);
@@ -300,8 +296,7 @@ static void thread_contention(void)
gettimeofday(&end, NULL);
linear[count != 2] = count * loops / elapsed(&start, &end) / (OBJECT_SIZE / 4096);
- printf("Contended upload rate for %d threads: %7.3fMiB/s\n",
- count, linear[count != 2]);
+ igt_info("Contended upload rate for %d threads: %7.3fMiB/s\n", count, linear[count != 2]);
for (n = 0; n < count; n++)
gem_set_tiling(fd, threads[n].handle, I915_TILING_X, 1024);
@@ -314,8 +309,7 @@ static void thread_contention(void)
gettimeofday(&end, NULL);
tiled[count != 2] = count * loops / elapsed(&start, &end) / (OBJECT_SIZE / 4096);
- printf("Contended upload rate for %d threads: %7.3fMiB/s\n",
- count, tiled[count != 2]);
+ igt_info("Contended upload rate for %d threads: %7.3fMiB/s\n", count, tiled[count != 2]);
for (n = 0; n < count; n++) {
gem_close(fd, threads[n].handle);
diff --git a/tests/gem_reg_read.c b/tests/gem_reg_read.c
index 4220d69f..d3e68d9f 100644
--- a/tests/gem_reg_read.c
+++ b/tests/gem_reg_read.c
@@ -44,10 +44,8 @@ static uint64_t timer_query(int fd)
struct local_drm_i915_reg_read reg_read;
reg_read.offset = 0x2358;
- if (drmIoctl(fd, REG_READ_IOCTL, &reg_read)) {
- perror("positive test case failed: ");
- igt_fail(1);
- }
+ igt_fail_on_f(drmIoctl(fd, REG_READ_IOCTL, &reg_read),
+ "positive test case failed: ");
return reg_read.val;
}
diff --git a/tests/gem_render_linear_blits.c b/tests/gem_render_linear_blits.c
index fd7c2be2..f8474863 100644
--- a/tests/gem_render_linear_blits.c
+++ b/tests/gem_render_linear_blits.c
@@ -109,7 +109,7 @@ int main(int argc, char **argv)
if (count == 0)
count = 3 * gem_aperture_size(fd) / SIZE / 2;
else if (count < 2) {
- fprintf(stderr, "count must be >= 2\n");
+ igt_warn("count must be >= 2\n");
return 1;
}
diff --git a/tests/gem_render_tiled_blits.c b/tests/gem_render_tiled_blits.c
index 8b74e2b4..f63c57e3 100644
--- a/tests/gem_render_tiled_blits.c
+++ b/tests/gem_render_tiled_blits.c
@@ -131,7 +131,7 @@ int main(int argc, char **argv)
if (count == 0)
count = 3 * gem_aperture_size(fd) / SIZE / 2;
else if (count < 2) {
- fprintf(stderr, "count must be >= 2\n");
+ igt_warn("count must be >= 2\n");
return 1;
}
diff --git a/tests/gem_ring_sync_copy.c b/tests/gem_ring_sync_copy.c
index 768d02d0..e33b384c 100644
--- a/tests/gem_ring_sync_copy.c
+++ b/tests/gem_ring_sync_copy.c
@@ -310,7 +310,7 @@ static void run_test(data_t *data, enum ring r1, enum ring r2, enum test test)
bo_check(data, b, 0xc);
break;
default:
- abort();
+ igt_fail(1);
}
r1_ops->busy_fini(data);
diff --git a/tests/gem_seqno_wrap.c b/tests/gem_seqno_wrap.c
index fa38f1f2..1ca89236 100644
--- a/tests/gem_seqno_wrap.c
+++ b/tests/gem_seqno_wrap.c
@@ -157,8 +157,7 @@ static void render_copyfunc(struct igt_buf *src,
intel_batchbuffer_flush(batch_3d);
} else {
if (!warned) {
- printf("No render copy found for this gen, "
- "test is shallow!\n");
+ igt_info("No render copy found for this gen, ""test is shallow!\n");
warned = 1;
}
igt_assert(dst->bo);
@@ -290,12 +289,12 @@ static int run_cmd(char *s)
int i;
r = wordexp(s, &wexp, 0);
if (r != 0) {
- printf("can't parse %s\n", s);
+ igt_info("can't parse %s\n", s);
return r;
}
for(i = 0; i < wexp.we_wordc; i++)
- printf("argv[%d] = %s\n", i, wexp.we_wordv[i]);
+ igt_info("argv[%d] = %s\n", i, wexp.we_wordv[i]);
pid = fork();
@@ -303,14 +302,12 @@ static int run_cmd(char *s)
char path[PATH_MAX];
char full_path[PATH_MAX];
- if (getcwd(path, PATH_MAX) == NULL)
- perror("getcwd");
+ igt_warn_on_f(getcwd(path, PATH_MAX) == NULL, "getcwd");
igt_assert(snprintf(full_path, PATH_MAX, "%s/%s", path, wexp.we_wordv[0]) > 0);
r = execv(full_path, wexp.we_wordv);
- if (r == -1)
- perror("execv failed");
+ igt_warn_on_f(r == -1, "execv failed");
} else {
int waitcount = options.timeout;
@@ -318,14 +315,12 @@ static int run_cmd(char *s)
r = waitpid(pid, &status, WNOHANG);
if (r == pid) {
if(WIFEXITED(status)) {
- if (WEXITSTATUS(status))
- fprintf(stderr,
- "child returned with %d\n",
- WEXITSTATUS(status));
+ igt_warn_on_f(WEXITSTATUS(status),
+ "child returned with %d\n", WEXITSTATUS(status));
return WEXITSTATUS(status);
}
} else if (r != 0) {
- perror("waitpid");
+ igt_warn("waitpid");
return -errno;
}
@@ -369,7 +364,7 @@ static int __read_seqno(uint32_t *seqno)
r = read(fh, buf, sizeof(buf) - 1);
close(fh);
if (r < 0) {
- perror("read");
+ igt_warn("read");
return -errno;
}
@@ -382,7 +377,7 @@ static int __read_seqno(uint32_t *seqno)
errno = 0;
tmp = strtoul(p, NULL, 0);
if (tmp == ULONG_MAX && errno) {
- perror("strtoul");
+ igt_warn("strtoul");
return -errno;
}
@@ -439,7 +434,7 @@ static int write_seqno(uint32_t seqno)
return r;
if (rb != seqno) {
- printf("seqno readback differs rb:0x%x vs w:0x%x\n", rb, seqno);
+ igt_info("seqno readback differs rb:0x%x vs w:0x%x\n", rb, seqno);
return -1;
}
@@ -518,16 +513,16 @@ static void background_run_once(void)
static void print_usage(const char *s)
{
- printf("%s: [OPTION]...\n", s);
- printf(" where options are:\n");
- printf(" -b --background run in background inducing wraps\n");
- printf(" -c --cmd=cmdstring use cmdstring to cross wrap\n");
- printf(" -n --rounds=num run num times across wrap boundary, 0 == forever\n");
- printf(" -t --timeout=sec set timeout to wait for testrun to sec seconds\n");
- printf(" -d --dontwrap don't wrap just run the test\n");
- printf(" -p --prewrap=n set seqno to WRAP - n for each testrun\n");
- printf(" -r --norandom dont randomize prewrap space\n");
- printf(" -i --buffers number of buffers to copy\n");
+ igt_info("%s: [OPTION]...\n", s);
+ igt_info(" where options are:\n");
+ igt_info(" -b --background run in background inducing wraps\n");
+ igt_info(" -c --cmd=cmdstring use cmdstring to cross wrap\n");
+ igt_info(" -n --rounds=num run num times across wrap boundary, 0 == forever\n");
+ igt_info(" -t --timeout=sec set timeout to wait for testrun to sec seconds\n");
+ igt_info(" -d --dontwrap don't wrap just run the test\n");
+ igt_info(" -p --prewrap=n set seqno to WRAP - n for each testrun\n");
+ igt_info(" -r --norandom dont randomize prewrap space\n");
+ igt_info(" -i --buffers number of buffers to copy\n");
igt_fail(-1);
}
@@ -560,50 +555,47 @@ static void parse_options(int argc, char **argv)
switch(c) {
case 'b':
options.background = 1;
- printf("running in background inducing wraps\n");
+ igt_info("running in background inducing wraps\n");
break;
case 'd':
options.dontwrap = 1;
- printf("won't wrap after testruns\n");
+ igt_info("won't wrap after testruns\n");
break;
case 'n':
options.rounds = atoi(optarg);
- printf("running %d rounds\n", options.rounds);
+ igt_info("running %d rounds\n", options.rounds);
break;
case 'c':
strncpy(options.cmd, optarg, sizeof(options.cmd) - 1);
options.cmd[sizeof(options.cmd) - 1] = 0;
- printf("cmd set to %s\n", options.cmd);
+ igt_info("cmd set to %s\n", options.cmd);
break;
case 'i':
options.buffers = atoi(optarg);
- printf("buffers %d\n", options.buffers);
+ igt_info("buffers %d\n", options.buffers);
break;
case 't':
options.timeout = atoi(optarg);
if (options.timeout == 0)
options.timeout = 10;
- printf("setting timeout to %d seconds\n",
- options.timeout);
+ igt_info("setting timeout to %d seconds\n", options.timeout);
break;
case 'r':
options.random = 0;
break;
case 'p':
options.prewrap_space = atoi(optarg);
- printf("prewrap set to %d (0x%x)\n",
- options.prewrap_space, UINT32_MAX -
- options.prewrap_space);
+ igt_info("prewrap set to %d (0x%x)\n", options.prewrap_space, UINT32_MAX - options.prewrap_space);
break;
default:
- printf("unkown command options\n");
+ igt_info("unkown command options\n");
print_usage(argv[0]);
break;
}
}
if (optind < argc) {
- printf("unkown command options\n");
+ igt_info("unkown command options\n");
print_usage(argv[0]);
}
}
diff --git a/tests/gem_stress.c b/tests/gem_stress.c
index df2cf250..d46c643b 100644
--- a/tests/gem_stress.c
+++ b/tests/gem_stress.c
@@ -223,18 +223,15 @@ static void cpucpy2d(uint32_t *src, unsigned src_stride, unsigned src_x, unsigne
+ i*options.tile_size + j;
uint32_t tmp = src[src_ofs];
if (tmp != expect) {
- printf("mismatch at tile %i pos %i, read %i, expected %i, diff %i\n",
- logical_tile_no, i*options.tile_size + j, tmp, expect, (int) tmp - expect);
- if (options.trace_tile >= 0 && options.fail)
- igt_fail(1);
+ igt_info("mismatch at tile %i pos %i, read %i, expected %i, diff %i\n", logical_tile_no, i * options.tile_size + j, tmp, expect, (int)tmp - expect);
+ igt_fail_on(options.trace_tile >= 0 && options.fail);
failed++;
}
/* when not aborting, correct any errors */
dst[dst_ofs] = expect;
}
}
- if (failed && options.fail)
- igt_fail(1);
+ igt_fail_on(failed && options.fail);
if (failed > stats.max_failed_reads)
stats.max_failed_reads = failed;
@@ -370,35 +367,35 @@ static void next_copyfunc(int tile)
{
if (fence_storm) {
if (tile == options.trace_tile)
- printf(" using fence storm\n");
+ igt_info(" using fence storm\n");
return;
}
if (copyfunc_seq % 61 == 0
&& options.forced_tiling != I915_TILING_NONE) {
if (tile == options.trace_tile)
- printf(" using fence storm\n");
+ igt_info(" using fence storm\n");
fence_storm = num_fences;
copyfunc = blitter_copyfunc;
} else if (copyfunc_seq % 17 == 0) {
if (tile == options.trace_tile)
- printf(" using cpu\n");
+ igt_info(" using cpu\n");
copyfunc = cpu_copyfunc;
} else if (copyfunc_seq % 19 == 0) {
if (tile == options.trace_tile)
- printf(" using prw\n");
+ igt_info(" using prw\n");
copyfunc = prw_copyfunc;
} else if (copyfunc_seq % 3 == 0 && options.use_render) {
if (tile == options.trace_tile)
- printf(" using render\n");
+ igt_info(" using render\n");
copyfunc = render_copyfunc;
} else if (options.use_blt){
if (tile == options.trace_tile)
- printf(" using blitter\n");
+ igt_info(" using blitter\n");
copyfunc = blitter_copyfunc;
} else if (options.use_render){
if (tile == options.trace_tile)
- printf(" using render\n");
+ igt_info(" using render\n");
copyfunc = render_copyfunc;
} else {
copyfunc = cpu_copyfunc;
@@ -563,9 +560,7 @@ static void init_set(unsigned set)
buffers[set][i].stride);
if (options.trace_tile != -1 && i == options.trace_tile/options.tiles_per_buf)
- printf("changing buffer %i containing tile %i: tiling %i, stride %i\n", i,
- options.trace_tile,
- buffers[set][i].tiling, buffers[set][i].stride);
+ igt_info("changing buffer %i containing tile %i: tiling %i, stride %i\n", i, options.trace_tile, buffers[set][i].tiling, buffers[set][i].stride);
}
}
@@ -602,9 +597,7 @@ static void copy_tiles(unsigned *permutation)
tile2xy(dst_buf, dst_tile, &dst_x, &dst_y);
if (options.trace_tile == i)
- printf("copying tile %i from %i (%i, %i) to %i (%i, %i)", i,
- tile_permutation[i], src_buf_idx, src_tile,
- permutation[idx], dst_buf_idx, dst_tile);
+ igt_info("copying tile %i from %i (%i, %i) to %i (%i, %i)", i, tile_permutation[i], src_buf_idx, src_tile, permutation[idx], dst_buf_idx, dst_tile);
if (options.no_hw) {
cpucpy2d(src_buf->data,
@@ -681,21 +674,20 @@ static void parse_options(int argc, char **argv)
switch(c) {
case 'd':
options.no_hw = 1;
- printf("no-hw debug mode\n");
+ igt_info("no-hw debug mode\n");
break;
case 'S':
options.use_signal_helper = 0;
- printf("disabling that pesky nuisance who keeps interrupting us\n");
+ igt_info("disabling that pesky nuisance who keeps interrupting us\n");
break;
case 's':
tmp = atoi(optarg);
if (tmp < options.tile_size*8192)
- printf("scratch buffer size needs to be at least %i\n",
- options.tile_size*8192);
+ igt_info("scratch buffer size needs to be at least %i\n", options.tile_size * 8192);
else if (tmp & (tmp - 1)) {
- printf("scratch buffer size needs to be a power-of-two\n");
+ igt_info("scratch buffer size needs to be a power-of-two\n");
} else {
- printf("fixed scratch buffer size to %u\n", tmp);
+ igt_info("fixed scratch buffer size to %u\n", tmp);
options.scratch_buf_size = tmp;
sanitize_tiles_per_buf();
}
@@ -703,78 +695,78 @@ static void parse_options(int argc, char **argv)
case 'g':
tmp = atoi(optarg);
if (tmp < 0 || tmp > 10)
- printf("gpu busy load needs to be bigger than 0 and smaller than 10\n");
+ igt_info("gpu busy load needs to be bigger than 0 and smaller than 10\n");
else {
- printf("gpu busy load factor set to %i\n", tmp);
+ igt_info("gpu busy load factor set to %i\n", tmp);
gpu_busy_load = options.gpu_busy_load = tmp;
}
break;
case 'c':
options.num_buffers = atoi(optarg);
- printf("buffer count set to %i\n", options.num_buffers);
+ igt_info("buffer count set to %i\n", options.num_buffers);
break;
case 't':
options.trace_tile = atoi(optarg);
- printf("tracing tile %i\n", options.trace_tile);
+ igt_info("tracing tile %i\n", options.trace_tile);
break;
case 'r':
options.use_render = 0;
- printf("disabling render copy\n");
+ igt_info("disabling render copy\n");
break;
case 'b':
options.use_blt = 0;
- printf("disabling blt copy\n");
+ igt_info("disabling blt copy\n");
break;
case 'u':
options.forced_tiling = I915_TILING_NONE;
- printf("disabling tiling\n");
+ igt_info("disabling tiling\n");
break;
case 'x':
if (options.use_cpu_maps) {
- printf("tiling not possible with cpu maps\n");
+ igt_info("tiling not possible with cpu maps\n");
} else {
options.forced_tiling = I915_TILING_X;
- printf("using only X-tiling\n");
+ igt_info("using only X-tiling\n");
}
break;
case 'm':
options.use_cpu_maps = 1;
options.forced_tiling = I915_TILING_NONE;
- printf("disabling tiling\n");
+ igt_info("disabling tiling\n");
break;
case 'o':
options.total_rounds = atoi(optarg);
- printf("total rounds %i\n", options.total_rounds);
+ igt_info("total rounds %i\n", options.total_rounds);
break;
case 'f':
options.fail = 0;
- printf("not failing when detecting errors\n");
+ igt_info("not failing when detecting errors\n");
break;
case 'p':
options.tiles_per_buf = atoi(optarg);
- printf("tiles per buffer %i\n", options.tiles_per_buf);
+ igt_info("tiles per buffer %i\n", options.tiles_per_buf);
break;
case DUCTAPE:
options.ducttape = 0;
- printf("applying duct-tape\n");
+ igt_info("applying duct-tape\n");
break;
case TILESZ:
options.tile_size = atoi(optarg);
sanitize_tiles_per_buf();
- printf("til size %i\n", options.tile_size);
+ igt_info("til size %i\n", options.tile_size);
break;
case CHCK_RENDER:
options.check_render_cpyfn = 1;
- printf("checking render copy function\n");
+ igt_info("checking render copy function\n");
break;
default:
- printf("unkown command options\n");
+ igt_info("unkown command options\n");
break;
}
}
if (optind < argc)
- printf("unkown command options\n");
+ igt_info("unkown command options\n");
/* actually 32767, according to docs, but that kills our nice pot calculations. */
options.max_dimension = 16*1024;
@@ -784,8 +776,7 @@ static void parse_options(int argc, char **argv)
else
options.max_dimension = 8192;
}
- printf("Limiting buffer to %dx%d\n",
- options.max_dimension, options.max_dimension);
+ igt_info("Limiting buffer to %dx%d\n", options.max_dimension, options.max_dimension);
}
static void init(void)
@@ -798,7 +789,7 @@ static void init(void)
tmp = tmp > 256*(1024*1024) ? 256*(1024*1024) : tmp;
num_buffers = 2 * tmp / options.scratch_buf_size / 3;
num_buffers /= 2;
- printf("using %u buffers\n", num_buffers);
+ igt_info("using %u buffers\n", num_buffers);
} else
num_buffers = options.num_buffers;
@@ -862,8 +853,7 @@ static void check_render_copyfunc(void)
ptr = (uint32_t*)((char *)dst.data + dx*4 + (dy+j) * dst.stride);
for (i = 0; i < options.tile_size; i++)
if (ptr[i] != j * options.tile_size + i) {
- printf("render copyfunc mismatch at (%d, %d): found %d, expected %d\n",
- i, j, ptr[i], j*options.tile_size + i);
+ igt_info("render copyfunc mismatch at (%d, %d): found %d, expected %d\n", i, j, ptr[i], j * options.tile_size + i);
}
}
}
@@ -898,10 +888,10 @@ int main(int argc, char **argv)
fan_out();
for (i = 0; i < options.total_rounds; i++) {
- printf("round %i\n", i);
+ igt_info("round %i\n", i);
if (i % 64 == 63) {
fan_in_and_check();
- printf("everything correct after %i rounds\n", i + 1);
+ igt_info("everything correct after %i rounds\n", i + 1);
}
target_set = (current_set + 1) & 1;
@@ -924,8 +914,7 @@ int main(int argc, char **argv)
fan_in_and_check();
- fprintf(stdout, "num failed tiles %u, max incoherent bytes %zd\n",
- stats.num_failed, stats.max_failed_reads*sizeof(uint32_t));
+ igt_info("num failed tiles %u, max incoherent bytes %zd\n", stats.num_failed, stats.max_failed_reads * sizeof(uint32_t));
intel_batchbuffer_free(batch);
drm_intel_bufmgr_destroy(bufmgr);
diff --git a/tests/kms_fence_pin_leak.c b/tests/kms_fence_pin_leak.c
index d3ca132f..ef2e6872 100644
--- a/tests/kms_fence_pin_leak.c
+++ b/tests/kms_fence_pin_leak.c
@@ -173,7 +173,7 @@ static bool run_single_test(data_t *data, enum pipe pipe, igt_output_t *output)
igt_plane_set_fb(primary, &fb[!(i&1)]);
igt_display_commit(display);
- printf(".");
+ igt_info(".");
fflush(stdout);
}
@@ -184,7 +184,7 @@ static bool run_single_test(data_t *data, enum pipe pipe, igt_output_t *output)
igt_remove_fb(data->drm_fd, &fb[1]);
igt_remove_fb(data->drm_fd, &fb[0]);
- printf("\n");
+ igt_info("\n");
return true;
}
diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c
index c2c12d11..006db08f 100644
--- a/tests/kms_psr_sink_crc.c
+++ b/tests/kms_psr_sink_crc.c
@@ -269,8 +269,8 @@ static bool psr_sink_support(data_t *data)
igt_require(file);
ret = fscanf(file, "Sink_Support: %s\n", str);
- if (ret == 0)
- igt_skip("i915_edp_psr_status format not supported by this test case\n");
+ igt_skip_on_f(ret == 0,
+ "i915_edp_psr_status format not supported by this test case\n");
fclose(file);
return strcmp(str, "yes") == 0;
@@ -381,7 +381,7 @@ static void test_crc(data_t *data)
ptr = gem_mmap__gtt(data->drm_fd, handle, 4096, PROT_WRITE);
gem_set_domain(data->drm_fd, handle,
I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
- fprintf(stdout, "Sleeping for 10 sec...\n");
+ igt_info("Sleeping for 10 sec...\n");
sleep(10);
memset(ptr, 0xff, 4);
munmap(ptr, 4096);
@@ -390,12 +390,12 @@ static void test_crc(data_t *data)
ptr = gem_mmap__gtt(data->drm_fd, handle, 4096, PROT_WRITE);
gem_set_domain(data->drm_fd, handle,
I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
- fprintf(stdout, "Sleeping for 10 sec...\n");
+ igt_info("Sleeping for 10 sec...\n");
sleep(10);
fill_blt(data, handle, 0xff);
igt_assert(wait_psr_entry(data, 10));
get_sink_crc(data, ref_crc);
- fprintf(stdout, "Sleeping for 10 sec...\n");
+ igt_info("Sleeping for 10 sec...\n");
sleep(10);
memset(ptr, 0xff, 4);
munmap(ptr, 4096);
@@ -404,12 +404,12 @@ static void test_crc(data_t *data)
ptr = gem_mmap__cpu(data->drm_fd, handle, 4096, PROT_WRITE);
gem_set_domain(data->drm_fd, handle,
I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU);
- fprintf(stdout, "Sleeping for 10 sec...\n");
+ igt_info("Sleeping for 10 sec...\n");
sleep(10);
fill_blt(data, handle, 0xff);
igt_assert(wait_psr_entry(data, 10));
get_sink_crc(data, ref_crc);
- fprintf(stdout, "Sleeping for 10 sec...\n");
+ igt_info("Sleeping for 10 sec...\n");
sleep(10);
memset(ptr, 0xff, 4);
munmap(ptr, 4096);
diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index 9ed3ff66..6d8fe3ad 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -118,45 +118,36 @@ static void dump_connectors_fd(int drmfd)
drmModeRes *mode_resources = drmModeGetResources(drmfd);
if (!mode_resources) {
- fprintf(stderr, "drmModeGetResources failed: %s\n",
- strerror(errno));
+ igt_warn("drmModeGetResources failed: %s\n", strerror(errno));
return;
}
- printf("Connectors:\n");
- printf("id\tencoder\tstatus\t\ttype\tsize (mm)\tmodes\n");
+ igt_info("Connectors:\n");
+ igt_info("id\tencoder\tstatus\t\ttype\tsize (mm)\tmodes\n");
for (i = 0; i < mode_resources->count_connectors; i++) {
drmModeConnector *connector;
connector = drmModeGetConnector(drmfd, mode_resources->connectors[i]);
if (!connector) {
- fprintf(stderr, "could not get connector %i: %s\n",
- mode_resources->connectors[i], strerror(errno));
+ igt_warn("could not get connector %i: %s\n", mode_resources->connectors[i], strerror(errno));
continue;
}
- printf("%d\t%d\t%s\t%s\t%dx%d\t\t%d\n",
- connector->connector_id,
- connector->encoder_id,
- kmstest_connector_status_str(connector->connection),
- kmstest_connector_type_str(connector->connector_type),
- connector->mmWidth, connector->mmHeight,
- connector->count_modes);
+ igt_info("%d\t%d\t%s\t%s\t%dx%d\t\t%d\n", connector->connector_id, connector->encoder_id, kmstest_connector_status_str(connector->connection), kmstest_connector_type_str(connector->connector_type), connector->mmWidth, connector->mmHeight, connector->count_modes);
if (!connector->count_modes)
continue;
- printf(" modes:\n");
- printf(" name refresh (Hz) hdisp hss hse htot vdisp "
- "vss vse vtot flags type clock\n");
+ igt_info(" modes:\n");
+ igt_info(" name refresh (Hz) hdisp hss hse htot vdisp ""vss vse vtot flags type clock\n");
for (j = 0; j < connector->count_modes; j++){
- fprintf(stdout, "[%d]", j );
+ igt_info("[%d]", j);
kmstest_dump_mode(&connector->modes[j]);
}
drmModeFreeConnector(connector);
}
- printf("\n");
+ igt_info("\n");
drmModeFreeResources(mode_resources);
}
@@ -166,27 +157,22 @@ static void dump_crtcs_fd(int drmfd)
int i;
drmModeRes *mode_resources = drmModeGetResources(drmfd);
- printf("CRTCs:\n");
- printf("id\tfb\tpos\tsize\n");
+ igt_info("CRTCs:\n");
+ igt_info("id\tfb\tpos\tsize\n");
for (i = 0; i < mode_resources->count_crtcs; i++) {
drmModeCrtc *crtc;
crtc = drmModeGetCrtc(drmfd, mode_resources->crtcs[i]);
if (!crtc) {
- fprintf(stderr, "could not get crtc %i: %s\n",
- mode_resources->crtcs[i], strerror(errno));
+ igt_warn("could not get crtc %i: %s\n", mode_resources->crtcs[i], strerror(errno));
continue;
}
- printf("%d\t%d\t(%d,%d)\t(%dx%d)\n",
- crtc->crtc_id,
- crtc->buffer_id,
- crtc->x, crtc->y,
- crtc->width, crtc->height);
+ igt_info("%d\t%d\t(%d,%d)\t(%dx%d)\n", crtc->crtc_id, crtc->buffer_id, crtc->x, crtc->y, crtc->width, crtc->height);
kmstest_dump_mode(&crtc->mode);
drmModeFreeCrtc(crtc);
}
- printf("\n");
+ igt_info("\n");
drmModeFreeResources(mode_resources);
}
@@ -343,8 +329,8 @@ static void set_single(void)
sigemptyset(&sa.sa_mask);
- if (sigaction(sigs[0], &sa, NULL) == -1)
- perror("Could not set signal handler");
+ igt_warn_on_f(sigaction(sigs[0], &sa, NULL) == -1,
+ "Could not set signal handler");
}
static void
@@ -384,13 +370,11 @@ set_mode(struct connector *c)
paint_output_info(c, &fb_info[current_fb]);
paint_color_key(&fb_info[current_fb]);
- fprintf(stdout, "CRTC(%u):[%d]",c->crtc, j);
+ igt_info("CRTC(%u):[%d]", c->crtc, j);
kmstest_dump_mode(&c->mode);
if (drmModeSetCrtc(drm_fd, c->crtc, fb_id, 0, 0,
&c->id, 1, &c->mode)) {
- fprintf(stderr, "failed to set mode (%dx%d@%dHz): %s\n",
- width, height, c->mode.vrefresh,
- strerror(errno));
+ igt_warn("failed to set mode (%dx%d@%dHz): %s\n", width, height, c->mode.vrefresh, strerror(errno));
continue;
}
@@ -541,12 +525,8 @@ static void do_set_stereo_mode(struct connector *c)
fb_id = create_stereo_fb(&c->mode, &fb_info);
- if (drmModeSetCrtc(drm_fd, c->crtc, fb_id, 0, 0,
- &c->id, 1, &c->mode)) {
- fprintf(stderr, "failed to set mode (%dx%d@%dHz): %s\n",
- width, height, c->mode.vrefresh,
- strerror(errno));
- }
+ igt_warn_on_f(drmModeSetCrtc(drm_fd, c->crtc, fb_id, 0, 0, &c->id, 1, &c->mode),
+ "failed to set mode (%dx%d@%dHz): %s\n", width, height, c->mode.vrefresh, strerror(errno));
}
static void
@@ -570,7 +550,7 @@ set_stereo_mode(struct connector *c)
if (!(c->mode.flags & DRM_MODE_FLAG_3D_MASK))
continue;
- fprintf(stdout, "CRTC(%u): [%d]", c->crtc, i);
+ igt_info("CRTC(%u): [%d]", c->crtc, i);
kmstest_dump_mode(&c->mode);
do_set_stereo_mode(c);
@@ -607,8 +587,7 @@ int update_display(void)
resources = drmModeGetResources(drm_fd);
if (!resources) {
- fprintf(stderr, "drmModeGetResources failed: %s\n",
- strerror(errno));
+ igt_warn("drmModeGetResources failed: %s\n", strerror(errno));
return 0;
}
@@ -675,22 +654,22 @@ static char optstr[] = "3hiaf:s:d:p:mrto:j:";
static void __attribute__((noreturn)) usage(char *name)
{
- fprintf(stdout, "usage: %s [-hiasdpmtf]\n", name);
- fprintf(stdout, "\t-i\tdump info\n");
- fprintf(stdout, "\t-a\ttest all modes\n");
- fprintf(stdout, "\t-s\t<duration>\tsleep between each mode test\n");
- fprintf(stdout, "\t-d\t<depth>\tbit depth of scanout buffer\n");
- fprintf(stdout, "\t-p\t<planew,h>,<crtcx,y>,<crtcw,h> test overlay plane\n");
- fprintf(stdout, "\t-m\ttest the preferred mode\n");
- fprintf(stdout, "\t-3\ttest all 3D modes\n");
- fprintf(stdout, "\t-t\tuse a tiled framebuffer\n");
- fprintf(stdout, "\t-j\tdo dpms off, optional arg to select dpms leve (1-3)\n");
- fprintf(stdout, "\t-r\tprint a QR code on the screen whose content is \"pass\" for the automatic test\n");
- fprintf(stdout, "\t-o\t<id of the display>,<number of the mode>\tonly test specified mode on the specified display\n");
- fprintf(stdout, "\t-f\t<clock MHz>,<hdisp>,<hsync-start>,<hsync-end>,<htotal>,\n");
- fprintf(stdout, "\t\t<vdisp>,<vsync-start>,<vsync-end>,<vtotal>\n");
- fprintf(stdout, "\t\ttest force mode\n");
- fprintf(stdout, "\tDefault is to test all modes.\n");
+ igt_info("usage: %s [-hiasdpmtf]\n", name);
+ igt_info("\t-i\tdump info\n");
+ igt_info("\t-a\ttest all modes\n");
+ igt_info("\t-s\t<duration>\tsleep between each mode test\n");
+ igt_info("\t-d\t<depth>\tbit depth of scanout buffer\n");
+ igt_info("\t-p\t<planew,h>,<crtcx,y>,<crtcw,h> test overlay plane\n");
+ igt_info("\t-m\ttest the preferred mode\n");
+ igt_info("\t-3\ttest all 3D modes\n");
+ igt_info("\t-t\tuse a tiled framebuffer\n");
+ igt_info("\t-j\tdo dpms off, optional arg to select dpms leve (1-3)\n");
+ igt_info("\t-r\tprint a QR code on the screen whose content is \"pass\" for the automatic test\n");
+ igt_info("\t-o\t<id of the display>,<number of the mode>\tonly test specified mode on the specified display\n");
+ igt_info("\t-f\t<clock MHz>,<hdisp>,<hsync-start>,<hsync-end>,<htotal>,\n");
+ igt_info("\t\t<vdisp>,<vsync-start>,<vsync-end>,<vtotal>\n");
+ igt_info("\t\ttest force mode\n");
+ igt_info("\tDefault is to test all modes.\n");
exit(0);
}
@@ -797,7 +776,7 @@ int main(int argc, char **argv)
break;
case 'd':
depth = atoi(optarg);
- fprintf(stdout, "using depth %d\n", depth);
+ igt_info("using depth %d\n", depth);
break;
case 'p':
if (sscanf(optarg, "%d,%d,%d,%d,%d,%d", &plane_width,
@@ -843,7 +822,7 @@ int main(int argc, char **argv)
if (test_stereo_modes &&
drmSetClientCap(drm_fd, DRM_CLIENT_CAP_STEREO_3D, 1) < 0) {
- fprintf(stderr, "DRM_CLIENT_CAP_STEREO_3D failed\n");
+ igt_warn("DRM_CLIENT_CAP_STEREO_3D failed\n");
goto out_close;
}
@@ -856,26 +835,26 @@ int main(int argc, char **argv)
mainloop = g_main_loop_new(NULL, FALSE);
if (!mainloop) {
- fprintf(stderr, "failed to create glib mainloop\n");
+ igt_warn("failed to create glib mainloop\n");
ret = -1;
goto out_close;
}
if (!testdisplay_setup_hotplug()) {
- fprintf(stderr, "failed to initialize hotplug support\n");
+ igt_warn("failed to initialize hotplug support\n");
goto out_mainloop;
}
stdinchannel = g_io_channel_unix_new(0);
if (!stdinchannel) {
- fprintf(stderr, "failed to create stdin GIO channel\n");
+ igt_warn("failed to create stdin GIO channel\n");
goto out_hotplug;
}
ret = g_io_add_watch(stdinchannel, G_IO_IN | G_IO_ERR, input_event,
NULL);
if (ret < 0) {
- fprintf(stderr, "failed to add watch on stdin GIO channel\n");
+ igt_warn("failed to add watch on stdin GIO channel\n");
goto out_stdio;
}
diff --git a/tests/testdisplay_hotplug.c b/tests/testdisplay_hotplug.c
index 3f80dc73..6e33ef31 100644
--- a/tests/testdisplay_hotplug.c
+++ b/tests/testdisplay_hotplug.c
@@ -30,6 +30,8 @@
#include "config.h"
#endif
+#include "igt_core.h"
+
#if HAVE_UDEV
#include <libudev.h>
static struct udev_monitor *uevent_monitor;
@@ -69,13 +71,13 @@ gboolean testdisplay_setup_hotplug(void)
udev = udev_new();
if (!udev) {
- fprintf(stderr, "failed to create udev object\n");
+ igt_warn("failed to create udev object\n");
goto out;
}
uevent_monitor = udev_monitor_new_from_netlink(udev, "udev");
if (!uevent_monitor) {
- fprintf(stderr, "failed to create udev event monitor\n");
+ igt_warn("failed to create udev event monitor\n");
goto out;
}
@@ -83,27 +85,27 @@ gboolean testdisplay_setup_hotplug(void)
"drm",
"drm_minor");
if (ret < 0) {
- fprintf(stderr, "failed to filter for drm events\n");
+ igt_warn("failed to filter for drm events\n");
goto out;
}
ret = udev_monitor_enable_receiving(uevent_monitor);
if (ret < 0) {
- fprintf(stderr, "failed to enable udev event reception\n");
+ igt_warn("failed to enable udev event reception\n");
goto out;
}
udevchannel =
g_io_channel_unix_new(udev_monitor_get_fd(uevent_monitor));
if (!udevchannel) {
- fprintf(stderr, "failed to create udev GIO channel\n");
+ igt_warn("failed to create udev GIO channel\n");
goto out;
}
ret = g_io_add_watch(udevchannel, G_IO_IN | G_IO_ERR, hotplug_event,
udev);
if (ret < 0) {
- fprintf(stderr, "failed to add watch on udev GIO channel\n");
+ igt_warn("failed to add watch on udev GIO channel\n");
goto out;
}
@@ -126,7 +128,7 @@ void testdisplay_cleanup_hotplug(void)
#else
gboolean testdisplay_setup_hotplug(void)
{
- fprintf(stderr, "no hotplug support on this platform\n");
+ igt_warn("no hotplug support on this platform\n");
return TRUE;
}