summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2014-08-26 15:26:21 +0200
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-08-26 21:29:14 +0200
commit1649ef0d1f5c0e4f995a437bd24f1574a8b5100f (patch)
tree50ecbd5332de79a325e5338c166c9c8a07ee7a8e /lib
parent71ac5de5a4473d20fb11cb454f62d8e5c90f020c (diff)
lib/igt_* Use igt macros in igt libaries
Except in igt_core since that would lead to some hilarious recursions. v2: Don't fflush any more, spotted by Chris. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'lib')
-rw-r--r--lib/igt_aux.c9
-rw-r--r--lib/igt_debugfs.c14
-rw-r--r--lib/igt_kms.c44
3 files changed, 29 insertions, 38 deletions
diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index 3357f1f0..5ddc8b61 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -233,7 +233,7 @@ void igt_progress(const char *header, uint64_t i, uint64_t total)
return;
if (i+1 >= total) {
- fprintf(stderr, "\r%s100%%\n", header);
+ igt_warn("\r%s100%%\n", header);
return;
}
@@ -241,10 +241,9 @@ void igt_progress(const char *header, uint64_t i, uint64_t total)
divider = 1;
/* only bother updating about every 0.5% */
- if (i % (total / divider) == 0 || i+1 >= total) {
- fprintf(stderr, "\r%s%3llu%%", header,
- (long long unsigned) i * 100 / total);
- }
+ igt_warn_on_f(i % (total / divider) == 0 || i + 1 >= total,
+ "\r%s%3llu%%", header,
+ (long long unsigned)i * 100 / total);
}
/* mappable aperture trasher helper */
diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index f6f509dd..123cf13e 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -200,10 +200,10 @@ bool igt_crc_is_null(igt_crc_t *crc)
int i;
for (i = 0; i < crc->n_words; i++) {
- if (crc->crc[i] == 0xffffffff)
- igt_warn("Suspicious CRC: it looks like the CRC "
- "read back was from a register in a powered "
- "down well\n");
+ igt_warn_on_f(crc->crc[i] == 0xffffffff,
+ "Suspicious CRC: it looks like the CRC "
+ "read back was from a register in a powered "
+ "down well\n");
if (crc->crc[i])
return false;
}
@@ -731,7 +731,7 @@ void igt_set_stop_rings(enum stop_ring_flags flags)
stop_rings_write(flags);
current = igt_get_stop_rings();
- if (current != flags)
- igt_warn("i915_ring_stop readback mismatch 0x%x vs 0x%x\n",
- flags, current);
+ igt_warn_on_f(current != flags,
+ "i915_ring_stop readback mismatch 0x%x vs 0x%x\n",
+ flags, current);
}
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index a414d960..d763013c 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -202,24 +202,15 @@ void kmstest_dump_mode(drmModeModeInfo *mode)
{
const char *stereo = mode_stereo_name(mode);
- printf(" %s %d %d %d %d %d %d %d %d %d 0x%x 0x%x %d%s%s%s\n",
- mode->name,
- mode->vrefresh,
- mode->hdisplay,
- mode->hsync_start,
- mode->hsync_end,
- mode->htotal,
- mode->vdisplay,
- mode->vsync_start,
- mode->vsync_end,
- mode->vtotal,
- mode->flags,
- mode->type,
- mode->clock,
- stereo ? " (3D:" : "",
- stereo ? stereo : "",
- stereo ? ")" : "");
- fflush(stdout);
+ igt_info(" %s %d %d %d %d %d %d %d %d %d 0x%x 0x%x %d%s%s%s\n",
+ mode->name, mode->vrefresh,
+ mode->hdisplay, mode->hsync_start,
+ mode->hsync_end, mode->htotal,
+ mode->vdisplay, mode->vsync_start,
+ mode->vsync_end, mode->vtotal,
+ mode->flags, mode->type, mode->clock,
+ stereo ? " (3D:" : "",
+ stereo ? stereo : "", stereo ? ")" : "");
}
/**
@@ -438,8 +429,8 @@ bool kmstest_get_connector_default_mode(int drm_fd, drmModeConnector *connector,
int i;
if (!connector->count_modes) {
- fprintf(stderr, "no modes for connector %d\n",
- connector->connector_id);
+ igt_warn("no modes for connector %d\n",
+ connector->connector_id);
return false;
}
@@ -476,7 +467,7 @@ bool kmstest_get_connector_config(int drm_fd, uint32_t connector_id,
resources = drmModeGetResources(drm_fd);
if (!resources) {
- perror("drmModeGetResources failed");
+ igt_warn("drmModeGetResources failed");
goto err1;
}
@@ -489,13 +480,13 @@ bool kmstest_get_connector_config(int drm_fd, uint32_t connector_id,
goto err3;
if (!connector->count_modes) {
- fprintf(stderr, "connector %d has no modes\n", connector_id);
+ igt_warn("connector %d has no modes\n", connector_id);
goto err3;
}
if (connector->connector_id != connector_id) {
- fprintf(stderr, "connector id doesn't match (%d != %d)\n",
- connector->connector_id, connector_id);
+ igt_warn("connector id doesn't match (%d != %d)\n",
+ connector->connector_id, connector_id);
goto err3;
}
@@ -515,8 +506,9 @@ bool kmstest_get_connector_config(int drm_fd, uint32_t connector_id,
connector->encoders[j]);
if (!encoder) {
- fprintf(stderr, "could not get encoder %d: %s\n",
- resources->encoders[j], strerror(errno));
+ igt_warn("could not get encoder %d: %s\n",
+ resources->encoders[j],
+ strerror(errno));
continue;
}