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>
This commit is contained in:
Daniel Vetter 2014-08-26 15:26:21 +02:00
parent 71ac5de5a4
commit 1649ef0d1f
3 changed files with 29 additions and 38 deletions

View File

@ -233,7 +233,7 @@ void igt_progress(const char *header, uint64_t i, uint64_t total)
return; return;
if (i+1 >= total) { if (i+1 >= total) {
fprintf(stderr, "\r%s100%%\n", header); igt_warn("\r%s100%%\n", header);
return; return;
} }
@ -241,10 +241,9 @@ void igt_progress(const char *header, uint64_t i, uint64_t total)
divider = 1; divider = 1;
/* only bother updating about every 0.5% */ /* only bother updating about every 0.5% */
if (i % (total / divider) == 0 || i+1 >= total) { igt_warn_on_f(i % (total / divider) == 0 || i + 1 >= total,
fprintf(stderr, "\r%s%3llu%%", header, "\r%s%3llu%%", header,
(long long unsigned) i * 100 / total); (long long unsigned)i * 100 / total);
}
} }
/* mappable aperture trasher helper */ /* mappable aperture trasher helper */

View File

@ -200,10 +200,10 @@ bool igt_crc_is_null(igt_crc_t *crc)
int i; int i;
for (i = 0; i < crc->n_words; i++) { for (i = 0; i < crc->n_words; i++) {
if (crc->crc[i] == 0xffffffff) igt_warn_on_f(crc->crc[i] == 0xffffffff,
igt_warn("Suspicious CRC: it looks like the CRC " "Suspicious CRC: it looks like the CRC "
"read back was from a register in a powered " "read back was from a register in a powered "
"down well\n"); "down well\n");
if (crc->crc[i]) if (crc->crc[i])
return false; return false;
} }
@ -731,7 +731,7 @@ void igt_set_stop_rings(enum stop_ring_flags flags)
stop_rings_write(flags); stop_rings_write(flags);
current = igt_get_stop_rings(); current = igt_get_stop_rings();
if (current != flags) igt_warn_on_f(current != flags,
igt_warn("i915_ring_stop readback mismatch 0x%x vs 0x%x\n", "i915_ring_stop readback mismatch 0x%x vs 0x%x\n",
flags, current); flags, current);
} }

View File

@ -202,24 +202,15 @@ void kmstest_dump_mode(drmModeModeInfo *mode)
{ {
const char *stereo = mode_stereo_name(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", igt_info(" %s %d %d %d %d %d %d %d %d %d 0x%x 0x%x %d%s%s%s\n",
mode->name, mode->name, mode->vrefresh,
mode->vrefresh, mode->hdisplay, mode->hsync_start,
mode->hdisplay, mode->hsync_end, mode->htotal,
mode->hsync_start, mode->vdisplay, mode->vsync_start,
mode->hsync_end, mode->vsync_end, mode->vtotal,
mode->htotal, mode->flags, mode->type, mode->clock,
mode->vdisplay, stereo ? " (3D:" : "",
mode->vsync_start, stereo ? stereo : "", stereo ? ")" : "");
mode->vsync_end,
mode->vtotal,
mode->flags,
mode->type,
mode->clock,
stereo ? " (3D:" : "",
stereo ? stereo : "",
stereo ? ")" : "");
fflush(stdout);
} }
/** /**
@ -438,8 +429,8 @@ bool kmstest_get_connector_default_mode(int drm_fd, drmModeConnector *connector,
int i; int i;
if (!connector->count_modes) { if (!connector->count_modes) {
fprintf(stderr, "no modes for connector %d\n", igt_warn("no modes for connector %d\n",
connector->connector_id); connector->connector_id);
return false; return false;
} }
@ -476,7 +467,7 @@ bool kmstest_get_connector_config(int drm_fd, uint32_t connector_id,
resources = drmModeGetResources(drm_fd); resources = drmModeGetResources(drm_fd);
if (!resources) { if (!resources) {
perror("drmModeGetResources failed"); igt_warn("drmModeGetResources failed");
goto err1; goto err1;
} }
@ -489,13 +480,13 @@ bool kmstest_get_connector_config(int drm_fd, uint32_t connector_id,
goto err3; goto err3;
if (!connector->count_modes) { 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; goto err3;
} }
if (connector->connector_id != connector_id) { if (connector->connector_id != connector_id) {
fprintf(stderr, "connector id doesn't match (%d != %d)\n", igt_warn("connector id doesn't match (%d != %d)\n",
connector->connector_id, connector_id); connector->connector_id, connector_id);
goto err3; goto err3;
} }
@ -515,8 +506,9 @@ bool kmstest_get_connector_config(int drm_fd, uint32_t connector_id,
connector->encoders[j]); connector->encoders[j]);
if (!encoder) { if (!encoder) {
fprintf(stderr, "could not get encoder %d: %s\n", igt_warn("could not get encoder %d: %s\n",
resources->encoders[j], strerror(errno)); resources->encoders[j],
strerror(errno));
continue; continue;
} }