mirror of
				https://github.com/tiagovignatti/intel-gpu-tools.git
				synced 2025-11-04 12:07:12 +00:00 
			
		
		
		
	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:
		
							parent
							
								
									71ac5de5a4
								
							
						
					
					
						commit
						1649ef0d1f
					
				@ -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 */
 | 
			
		||||
 | 
			
		||||
@ -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);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -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;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user