Skip to contentSkip to conversation

tests/perf: Fix a bunch of warnings on 32-bit systems

PATCH In review Thierry Reding 5 participants 14 messages Oct 12, 2017 – Oct 17, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/7 tests/perf: Fix a bunch of warnings on 32-bit systems

From: Thierry Reding <[email protected]>

Data types are defined differently on 32-bit systems, causing gcc to complain about printf format specifiers not matching the size of the variables passed in. Use PRIu64 and %zu where appropriate.

---
 tests/perf.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)
tests/perf.c +16 -16
index ad62319e1bbc..a161c45d7009 100644
@@ -932,25 +932,25 @@ accumulator_print(struct accumulator *accumulator, const char *title)
 
 	igt_debug("%s:\n", title);
 	if (intel_gen(devid) >= 8) {
-		igt_debug("\ttime delta = %lu\n", deltas[idx++]);
-		igt_debug("\tclock cycle delta = %lu\n", deltas[idx++]);
+		igt_debug("\ttime delta = %"PRIu64"\n", deltas[idx++]);
+		igt_debug("\tclock cycle delta = %"PRIu64"\n", deltas[idx++]);
 
 		for (int i = 0; i < format.n_a40; i++)
-			igt_debug("\tA%u = %lu\n", i, deltas[idx++]);
+			igt_debug("\tA%u = %"PRIu64"\n", i, deltas[idx++]);
 	} else {
-		igt_debug("\ttime delta = %lu\n", deltas[idx++]);
+		igt_debug("\ttime delta = %"PRIu64"\n", deltas[idx++]);
 	}
 
 	for (int i = 0; i < format.n_a; i++) {
 		int a_id = format.first_a + i;
-		igt_debug("\tA%u = %lu\n", a_id, deltas[idx++]);
+		igt_debug("\tA%u = %"PRIu64"\n", a_id, deltas[idx++]);
 	}
 
 	for (int i = 0; i < format.n_a; i++)
-		igt_debug("\tB%u = %lu\n", i, deltas[idx++]);
+		igt_debug("\tB%u = %"PRIu64"\n", i, deltas[idx++]);
 
 	for (int i = 0; i < format.n_c; i++)
-		igt_debug("\tC%u = %lu\n", i, deltas[idx++]);
+		igt_debug("\tC%u = %"PRIu64"\n", i, deltas[idx++]);
 }
 
 /* The TestOa metric set is designed so */
@@ -2126,7 +2126,7 @@ test_oa_exponents(void)
 						}
 
 						igt_debug(" > report ts=%u"
-							  " ts_delta_last=%8u ts_delta_last_periodic=%8u is_timer=%i ctx_id=%8x gpu_ticks=%u period=%.2f A0=%lu A%i=%lu\n",
+							  " ts_delta_last=%8u ts_delta_last_periodic=%8u is_timer=%i ctx_id=%8x gpu_ticks=%u period=%.2f A0=%"PRIu64" A%i=%"PRIu64"\n",
 							  rpt[1],
 							  (last != NULL) ? (rpt[1] - last[1]) : 0,
 							  (last_periodic != NULL) ? (rpt[1] - last_periodic[1]) : 0,
@@ -2796,7 +2796,7 @@ test_buffer_fill(void)
 
 		do_ioctl(stream_fd, I915_PERF_IOCTL_DISABLE, 0);
 
-		igt_debug("fill_duration = %luns, oa_exponent = %u\n",
+		igt_debug("fill_duration = %"PRIu64"ns, oa_exponent = %u\n",
 			  fill_duration, oa_exponent);
 
 		do_ioctl(stream_fd, I915_PERF_IOCTL_ENABLE, 0);
@@ -2813,7 +2813,7 @@ test_buffer_fill(void)
 		 */
 		while (((last_timestamp - first_timestamp) * oa_period) < (fill_duration / 2)) {
 
-			igt_debug("dts=%u elapsed=%lu duration=%lu\n",
+			igt_debug("dts=%u elapsed=%"PRIu64" duration=%"PRIu64"\n",
 				  last_timestamp - first_timestamp,
 				  (last_timestamp - first_timestamp) * oa_period,
 				  fill_duration / 2);
@@ -2881,7 +2881,7 @@ test_buffer_fill(void)
 
 		do_ioctl(stream_fd, I915_PERF_IOCTL_DISABLE, 0);
 
-		igt_debug("%f < %lu < %f\n",
+		igt_debug("%f < %zu < %f\n",
 			  report_size * n_full_oa_reports * 0.45,
 			  n_periodic_reports * report_size,
 			  report_size * n_full_oa_reports * 0.55);
@@ -3032,7 +3032,7 @@ test_enable_disable(void)
 
 		do_ioctl(stream_fd, I915_PERF_IOCTL_DISABLE, 0);
 
-		igt_debug("%f < %lu < %f\n",
+		igt_debug("%f < %zu < %f\n",
 			  report_size * n_full_oa_reports * 0.45,
 			  n_periodic_reports * report_size,
 			  report_size * n_full_oa_reports * 0.55);
@@ -3783,7 +3783,7 @@ gen8_test_single_ctx_render_target_writes_a_counter(void)
 
 			memset(accumulator.deltas, 0, sizeof(accumulator.deltas));
 			accumulate_reports(&accumulator, report0_32, report1_32);
-			igt_debug("total: A0 = %lu, A21 = %lu, A26 = %lu\n",
+			igt_debug("total: A0 = %"PRIu64", A21 = %"PRIu64", A26 = %"PRIu64"\n",
 				  accumulator.deltas[2 + 0], /* skip timestamp + clock cycles */
 				  accumulator.deltas[2 + 21],
 				  accumulator.deltas[2 + 26]);
@@ -3905,7 +3905,7 @@ gen8_test_single_ctx_render_target_writes_a_counter(void)
 				if (lprev) {
 					memset(laccumulator.deltas, 0, sizeof(laccumulator.deltas));
 					accumulate_reports(&laccumulator, lprev, report);
-					igt_debug("    deltas: A0=%lu A21=%lu, A26=%lu\n",
+					igt_debug("    deltas: A0=%"PRIu64" A21=%"PRIu64", A26=%"PRIu64"\n",
 						  laccumulator.deltas[2 + 0], /* skip timestamp + clock cycles */
 						  laccumulator.deltas[2 + 21],
 						  laccumulator.deltas[2 + 26]);
@@ -3946,7 +3946,7 @@ gen8_test_single_ctx_render_target_writes_a_counter(void)
 
 				if (!skip_reason) {
 					accumulate_reports(&accumulator, prev, report);
-					igt_debug(" -> Accumulated deltas A0=%lu A21=%lu, A26=%lu\n",
+					igt_debug(" -> Accumulated deltas A0=%"PRIu64" A21=%"PRIu64", A26=%"PRIu64"\n",
 						  accumulator.deltas[2 + 0], /* skip timestamp + clock cycles */
 						  accumulator.deltas[2 + 21],
 						  accumulator.deltas[2 + 26]);
@@ -3974,7 +3974,7 @@ gen8_test_single_ctx_render_target_writes_a_counter(void)
 				}
 			}
 
-			igt_debug("n samples written = %ld/%lu (%ix%i)\n",
+			igt_debug("n samples written = %"PRIu64"/%"PRIu64" (%ix%i)\n",
 				  accumulator.deltas[2 + 21],/* skip timestamp + clock cycles */
 				  accumulator.deltas[2 + 26],
 				  width, height);
Signature · 6 lines
2.14.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

PATCH 2/7 tools/aubdump: Avoid ISO C90 warning

From: Thierry Reding <[email protected]>

GCC will warn about ISO C90 forbidding to mix declarations and code. Declare the variable at the beginning of the function to suppress the warning.

---
 tools/aubdump.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/aubdump.c +2 -1
index 1aeff5f4532c..6ba3cb66256e 100644
@@ -407,6 +407,7 @@ dump_execbuffer2(int fd, struct drm_i915_gem_execbuffer2 *execbuffer2)
 	uint32_t offset = gtt_size();
 	struct drm_i915_gem_exec_object2 *obj;
 	struct bo *bo, *batch_bo;
+	int batch_index;
 	void *data;
 
 	/* We can't do this at open time as we're not yet authenticated. */
@@ -460,7 +461,7 @@ dump_execbuffer2(int fd, struct drm_i915_gem_execbuffer2 *execbuffer2)
 		fail_if(bo->map == MAP_FAILED, "intel_aubdump: bo mmap failed\n");
 	}
 
-	int batch_index = (execbuffer2->flags & I915_EXEC_BATCH_FIRST) ? 0 :
+	batch_index = (execbuffer2->flags & I915_EXEC_BATCH_FIRST) ? 0 :
 			  execbuffer2->buffer_count - 1;
 	batch_bo = get_bo(exec_objects[batch_index].handle);
 	for (uint32_t i = 0; i < execbuffer2->buffer_count; i++) {
Signature · 6 lines
2.14.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

PATCH 3/7 lib: Fix compilation on non-x86

In reply to Thierry Reding

From: Thierry Reding <[email protected]>

The meson build avoids the failure by excluding the igt_x86.c file from the compilation. autotools being what they are don't support that in an easy way, so just use the preprocessor to avoid the duplicate function definitions.

Since igt_x86.c will now be ignored for non-x86 builds, the meson work- around can be removed.

---
 lib/igt_x86.c   | 2 ++
 lib/igt_x86.h   | 2 +-
 lib/meson.build | 5 +----
 3 files changed, 4 insertions(+), 5 deletions(-)
lib/igt_x86.c +2 -0
index 0f0963ced044..0ed3c6f1d356 100644
@@ -93,6 +93,7 @@
 
 #define has_YMM 0x1
 
+#if defined(__x86_64__) || defined(__i386__)
 unsigned igt_x86_features(void)
 {
 	unsigned max = __get_cpuid_max(BASIC_CPUID, 0);
@@ -172,3 +173,4 @@ char *igt_x86_features_to_string(unsigned features, char *line)
 
 	return ret;
 }
+#endif
lib/igt_x86.h +1 -1
index d6dcfa108331..27b7f0fd5837 100644
@@ -40,7 +40,7 @@
 #define AVX	0x80
 #define AVX2	0x100
 
-#if defined(__x86_64__)
+#if defined(__x86_64__) || defined(__i386__)
 unsigned igt_x86_features(void);
 char *igt_x86_features_to_string(unsigned features, char *line);
 #else
lib/meson.build +1 -4
index 42919eef52a8..e89d4bdf8278 100644
@@ -56,6 +56,7 @@ lib_sources = [
 	'igt_stats.c',
 	'igt_sysfs.c',
 	'igt_vgem.c',
+	'igt_x86.c',
 	'instdone.c',
 	'intel_batchbuffer.c',
 	'intel_chipset.c',
@@ -88,10 +89,6 @@ lib_sources = [
 	'igt_kmod.c',
 ]
 
-if ['x86', 'x86_64'].contains(host_machine.cpu_family())
-    lib_sources += 'igt_x86.c'
-endif
-
 lib_deps = [
 	cairo,
 	glib,
Signature · 6 lines
2.14.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

PATCH 4/7 lib/drmtest: Fix typo

In reply to Thierry Reding

From: Thierry Reding <[email protected]>

"other" was misspelled as "otehr". Fix it.

---
 lib/drmtest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/drmtest.c +1 -1
index 8a07152c701a..24a5ea0f6a0f 100644
@@ -355,7 +355,7 @@ static const char *chipset_to_str(int chipset)
 	case DRIVER_ANY:
 		return "any";
 	default:
-		return "otehr";
+		return "other";
 	}
 }
 
Signature · 6 lines
2.14.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

PATCH 5/7 lib/drmtest: Support nouveau

In reply to Thierry Reding

From: Thierry Reding <[email protected]>

Add a driver definition for nouveau and wire up all the necessary pieces to identify its devices.

---
 lib/drmtest.c | 14 ++++++++++++--
 lib/drmtest.h |  1 +
 2 files changed, 13 insertions(+), 2 deletions(-)
lib/drmtest.c +12 -2
index 24a5ea0f6a0f..f46419ec36cf 100644
@@ -80,7 +80,7 @@ static int __get_drm_device_name(int fd, char *name)
 	drm_version_t version;
 
 	memset(&version, 0, sizeof(version));
-	version.name_len = 4;
+	version.name_len = 8;
 	version.name = name;
 
 	if (!drmIoctl(fd, DRM_IOCTL_VERSION, &version)){
@@ -92,7 +92,7 @@ static int __get_drm_device_name(int fd, char *name)
 
 static bool __is_device(int fd, const char *expect)
 {
-	char name[5] = "";
+	char name[9] = "";
 
 	if (__get_drm_device_name(fd, name))
 		return false;
@@ -125,6 +125,11 @@ static bool is_amd_device(int fd)
 	return __is_device(fd, "amdg");
 }
 
+static bool is_nouveau_device(int fd)
+{
+	return __is_device(fd, "nouveau");
+}
+
 static bool has_known_intel_chipset(int fd)
 {
 	struct drm_i915_getparam gp;
@@ -277,6 +282,9 @@ int __drm_open_driver(int chipset)
 		if (chipset & DRIVER_AMDGPU && is_amd_device(fd))
 			return fd;
 
+		if (chipset & DRIVER_NOUVEAU && is_nouveau_device(fd))
+			return fd;
+
 		/* Only VGEM-specific tests should be run on VGEM */
 		if (chipset == DRIVER_ANY && !is_vgem_device(fd))
 			return fd;
@@ -352,6 +360,8 @@ static const char *chipset_to_str(int chipset)
 		return "virtio";
 	case DRIVER_AMDGPU:
 		return "amdgpu";
+	case DRIVER_NOUVEAU:
+		return "nouveau";
 	case DRIVER_ANY:
 		return "any";
 	default:
lib/drmtest.h +1 -0
index a86799d54834..e54e1b6756af 100644
@@ -43,6 +43,7 @@
 #define DRIVER_VGEM	(1 << 2)
 #define DRIVER_VIRTIO	(1 << 3)
 #define DRIVER_AMDGPU	(1 << 4)
+#define DRIVER_NOUVEAU	(1 << 5)
 /*
  * Exclude DRVER_VGEM from DRIVER_ANY since if you run on a system
  * with vgem as well as a supported driver, you can end up with a
Signature · 6 lines
2.14.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw

PATCH 6/7 lib/drmtest: Support Tegra

In reply to Thierry Reding

From: Thierry Reding <[email protected]>

Add a driver definition for Tegra and wire up all the necessary pieces to identify its devices.

---
 lib/drmtest.c | 10 ++++++++++
 lib/drmtest.h |  1 +
 2 files changed, 11 insertions(+)
lib/drmtest.c +10 -0
index f46419ec36cf..e05f88d4a887 100644
@@ -130,6 +130,11 @@ static bool is_nouveau_device(int fd)
 	return __is_device(fd, "nouveau");
 }
 
+static bool is_tegra_device(int fd)
+{
+	return __is_device(fd, "tegra");
+}
+
 static bool has_known_intel_chipset(int fd)
 {
 	struct drm_i915_getparam gp;
@@ -285,6 +290,9 @@ int __drm_open_driver(int chipset)
 		if (chipset & DRIVER_NOUVEAU && is_nouveau_device(fd))
 			return fd;
 
+		if (chipset & DRIVER_TEGRA && is_tegra_device(fd))
+			return fd;
+
 		/* Only VGEM-specific tests should be run on VGEM */
 		if (chipset == DRIVER_ANY && !is_vgem_device(fd))
 			return fd;
@@ -362,6 +370,8 @@ static const char *chipset_to_str(int chipset)
 		return "amdgpu";
 	case DRIVER_NOUVEAU:
 		return "nouveau";
+	case DRIVER_TEGRA:
+		return "tegra";
 	case DRIVER_ANY:
 		return "any";
 	default:
lib/drmtest.h +1 -0
index e54e1b6756af..bdb938ffd9ab 100644
@@ -44,6 +44,7 @@
 #define DRIVER_VIRTIO	(1 << 3)
 #define DRIVER_AMDGPU	(1 << 4)
 #define DRIVER_NOUVEAU	(1 << 5)
+#define DRIVER_TEGRA	(1 << 6)
 /*
  * Exclude DRVER_VGEM from DRIVER_ANY since if you run on a system
  * with vgem as well as a supported driver, you can end up with a
Signature · 6 lines
2.14.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#9 lore raw

PATCH 7/7 lib/drmtest: Allow the test device to be overridden

In reply to Thierry Reding

From: Thierry Reding <[email protected]>

On setups where the device to be tested is not the first one, allow users to override it using the IGT_DEVICE environment variable.

---
 lib/drmtest.c | 91 ++++++++++++++++++++++++++++++++++++-----------------------
 1 file changed, 56 insertions(+), 35 deletions(-)
lib/drmtest.c +56 -35
index e05f88d4a887..1d814734162c 100644
@@ -245,6 +245,47 @@ static int modprobe(const char *driver)
 	return igt_kmod_load(driver, "");
 }
 
+static int __drm_open_device(const char *device, int chipset)
+{
+	int fd;
+
+	fd = open(device, O_RDWR);
+	if (fd == -1)
+		return fd;
+
+	if (chipset & DRIVER_INTEL && is_i915_device(fd) &&
+	    has_known_intel_chipset(fd))
+		return fd;
+
+	if (chipset & DRIVER_VC4 &&
+	    is_vc4_device(fd))
+		return fd;
+
+	if (chipset & DRIVER_VGEM &&
+	    is_vgem_device(fd))
+		return fd;
+
+	if (chipset & DRIVER_VIRTIO &&
+	    is_virtio_device(fd))
+		return fd;
+
+	if (chipset & DRIVER_AMDGPU && is_amd_device(fd))
+		return fd;
+
+	if (chipset & DRIVER_NOUVEAU && is_nouveau_device(fd))
+		return fd;
+
+	if (chipset & DRIVER_TEGRA && is_tegra_device(fd))
+		return fd;
+
+	/* Only VGEM-specific tests should be run on VGEM */
+	if (chipset == DRIVER_ANY && !is_vgem_device(fd))
+		return fd;
+
+	close(fd);
+	return -1;
+}
+
 /**
  * __drm_open_driver:
  * @chipset: OR'd flags for each chipset to search, eg. #DRIVER_INTEL
@@ -256,48 +297,25 @@ static int modprobe(const char *driver)
  */
 int __drm_open_driver(int chipset)
 {
+	char *name = getenv("IGT_DEVICE");
+
+	if (name)
+		return __drm_open_device(name, chipset);
+
 	if (chipset & DRIVER_VGEM)
 		modprobe("vgem");
 
 	for (int i = 0; i < 16; i++) {
-		char name[80];
-		int fd;
+		int fd, ret;
 
-		sprintf(name, "/dev/dri/card%u", i);
-		fd = open(name, O_RDWR);
-		if (fd == -1)
-			continue;
-
-		if (chipset & DRIVER_INTEL && is_i915_device(fd) &&
-		    has_known_intel_chipset(fd))
-			return fd;
-
-		if (chipset & DRIVER_VC4 &&
-		    is_vc4_device(fd))
-			return fd;
-
-		if (chipset & DRIVER_VGEM &&
-		    is_vgem_device(fd))
-			return fd;
-
-		if (chipset & DRIVER_VIRTIO &&
-		    is_virtio_device(fd))
-			return fd;
-
-		if (chipset & DRIVER_AMDGPU && is_amd_device(fd))
-			return fd;
-
-		if (chipset & DRIVER_NOUVEAU && is_nouveau_device(fd))
-			return fd;
+		ret = asprintf(&name, "/dev/dri/card%u", i);
+		igt_assert(ret != -1);
 
-		if (chipset & DRIVER_TEGRA && is_tegra_device(fd))
-			return fd;
+		fd = __drm_open_device(name, chipset);
+		free(name);
 
-		/* Only VGEM-specific tests should be run on VGEM */
-		if (chipset == DRIVER_ANY && !is_vgem_device(fd))
+		if (fd >= 0)
 			return fd;
-
-		close(fd);
 	}
 
 	return -1;
@@ -305,9 +323,12 @@ int __drm_open_driver(int chipset)
 
 static int __drm_open_driver_render(int chipset)
 {
-	char *name;
+	char *name = getenv("IGT_DEVICE");
 	int i, fd;
 
+	if (name)
+		return __drm_open_device(name, chipset);
+
 	for (i = 128; i < (128 + 16); i++) {
 		int ret;
 
Signature · 6 lines
2.14.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/7
#10 lore raw
In reply to Thierry Reding

Thanks!

Quoted 121 lines · Thierry Reding

From: Thierry Reding <[email protected]>

Data types are defined differently on 32-bit systems, causing gcc to complain about printf format specifiers not matching the size of the variables passed in. Use PRIu64 and %zu where appropriate.

---
  tests/perf.c | 32 ++++++++++++++++----------------
  1 file changed, 16 insertions(+), 16 deletions(-)
tests/perf.c +15 -15
index ad62319e1bbc..a161c45d7009 100644
@@ -932,25 +932,25 @@ accumulator_print(struct accumulator *accumulator, const char *title)
 
  	igt_debug("%s:\n", title);
  	if (intel_gen(devid) >= 8) {
-		igt_debug("\ttime delta = %lu\n", deltas[idx++]);
-		igt_debug("\tclock cycle delta = %lu\n", deltas[idx++]);
+		igt_debug("\ttime delta = %"PRIu64"\n", deltas[idx++]);
+		igt_debug("\tclock cycle delta = %"PRIu64"\n", deltas[idx++]);
 
  		for (int i = 0; i < format.n_a40; i++)
-			igt_debug("\tA%u = %lu\n", i, deltas[idx++]);
+			igt_debug("\tA%u = %"PRIu64"\n", i, deltas[idx++]);
  	} else {
-		igt_debug("\ttime delta = %lu\n", deltas[idx++]);
+		igt_debug("\ttime delta = %"PRIu64"\n", deltas[idx++]);
  	}
 
  	for (int i = 0; i < format.n_a; i++) {
  		int a_id = format.first_a + i;
-		igt_debug("\tA%u = %lu\n", a_id, deltas[idx++]);
+		igt_debug("\tA%u = %"PRIu64"\n", a_id, deltas[idx++]);
  	}
 
  	for (int i = 0; i < format.n_a; i++)
-		igt_debug("\tB%u = %lu\n", i, deltas[idx++]);
+		igt_debug("\tB%u = %"PRIu64"\n", i, deltas[idx++]);
 
  	for (int i = 0; i < format.n_c; i++)
-		igt_debug("\tC%u = %lu\n", i, deltas[idx++]);
+		igt_debug("\tC%u = %"PRIu64"\n", i, deltas[idx++]);
  }
 
  /* The TestOa metric set is designed so */
@@ -2126,7 +2126,7 @@ test_oa_exponents(void)
  						}
 
  						igt_debug(" > report ts=%u"
-							  " ts_delta_last=%8u ts_delta_last_periodic=%8u is_timer=%i ctx_id=%8x gpu_ticks=%u period=%.2f A0=%lu A%i=%lu\n",
+							  " ts_delta_last=%8u ts_delta_last_periodic=%8u is_timer=%i ctx_id=%8x gpu_ticks=%u period=%.2f A0=%"PRIu64" A%i=%"PRIu64"\n",
  							  rpt[1],
  							  (last != NULL) ? (rpt[1] - last[1]) : 0,
  							  (last_periodic != NULL) ? (rpt[1] - last_periodic[1]) : 0,
@@ -2796,7 +2796,7 @@ test_buffer_fill(void)
 
  		do_ioctl(stream_fd, I915_PERF_IOCTL_DISABLE, 0);
 
-		igt_debug("fill_duration = %luns, oa_exponent = %u\n",
+		igt_debug("fill_duration = %"PRIu64"ns, oa_exponent = %u\n",
  			  fill_duration, oa_exponent);
 
  		do_ioctl(stream_fd, I915_PERF_IOCTL_ENABLE, 0);
@@ -2813,7 +2813,7 @@ test_buffer_fill(void)
  		 */
  		while (((last_timestamp - first_timestamp) * oa_period) < (fill_duration / 2)) {
 
-			igt_debug("dts=%u elapsed=%lu duration=%lu\n",
+			igt_debug("dts=%u elapsed=%"PRIu64" duration=%"PRIu64"\n",
  				  last_timestamp - first_timestamp,
  				  (last_timestamp - first_timestamp) * oa_period,
  				  fill_duration / 2);
@@ -2881,7 +2881,7 @@ test_buffer_fill(void)
 
  		do_ioctl(stream_fd, I915_PERF_IOCTL_DISABLE, 0);
 
-		igt_debug("%f < %lu < %f\n",
+		igt_debug("%f < %zu < %f\n",
  			  report_size * n_full_oa_reports * 0.45,
  			  n_periodic_reports * report_size,
  			  report_size * n_full_oa_reports * 0.55);
@@ -3032,7 +3032,7 @@ test_enable_disable(void)
 
  		do_ioctl(stream_fd, I915_PERF_IOCTL_DISABLE, 0);
 
-		igt_debug("%f < %lu < %f\n",
+		igt_debug("%f < %zu < %f\n",
  			  report_size * n_full_oa_reports * 0.45,
  			  n_periodic_reports * report_size,
  			  report_size * n_full_oa_reports * 0.55);
@@ -3783,7 +3783,7 @@ gen8_test_single_ctx_render_target_writes_a_counter(void)
 
  			memset(accumulator.deltas, 0, sizeof(accumulator.deltas));
  			accumulate_reports(&accumulator, report0_32, report1_32);
-			igt_debug("total: A0 = %lu, A21 = %lu, A26 = %lu\n",
+			igt_debug("total: A0 = %"PRIu64", A21 = %"PRIu64", A26 = %"PRIu64"\n",
  				  accumulator.deltas[2 + 0], /* skip timestamp + clock cycles */
  				  accumulator.deltas[2 + 21],
  				  accumulator.deltas[2 + 26]);
@@ -3905,7 +3905,7 @@ gen8_test_single_ctx_render_target_writes_a_counter(void)
  				if (lprev) {
  					memset(laccumulator.deltas, 0, sizeof(laccumulator.deltas));
  					accumulate_reports(&laccumulator, lprev, report);
-					igt_debug("    deltas: A0=%lu A21=%lu, A26=%lu\n",
+					igt_debug("    deltas: A0=%"PRIu64" A21=%"PRIu64", A26=%"PRIu64"\n",
  						  laccumulator.deltas[2 + 0], /* skip timestamp + clock cycles */
  						  laccumulator.deltas[2 + 21],
  						  laccumulator.deltas[2 + 26]);
@@ -3946,7 +3946,7 @@ gen8_test_single_ctx_render_target_writes_a_counter(void)
 
  				if (!skip_reason) {
  					accumulate_reports(&accumulator, prev, report);
-					igt_debug(" -> Accumulated deltas A0=%lu A21=%lu, A26=%lu\n",
+					igt_debug(" -> Accumulated deltas A0=%"PRIu64" A21=%"PRIu64", A26=%"PRIu64"\n",
  						  accumulator.deltas[2 + 0], /* skip timestamp + clock cycles */
  						  accumulator.deltas[2 + 21],
  						  accumulator.deltas[2 + 26]);

tests/perf.c gen8_test_single_ctx_render_target_writes_a_counter(void) · line 3980

Quoted 8 lines
tests/perf.c +1 -1
@@ -3974,7 +3974,7 @@ gen8_test_single_ctx_render_target_writes_a_counter(void)
  				}
  			}
 
-			igt_debug("n samples written = %ld/%lu (%ix%i)\n",
+			igt_debug("n samples written = %"PRIu64"/%"PRIu64" (%ix%i)\n",
  				  accumulator.deltas[2 + 21],/* skip timestamp + clock cycles */
  				  accumulator.deltas[2 + 26],
  				  width, height);

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reviewed-by on v1 1/7
#11 lore raw
In reply to Thierry Reding
Quoted 5 lines · Thierry Reding

From: Thierry Reding <[email protected]>

Data types are defined differently on 32-bit systems, causing gcc to complain about printf format specifiers not matching the size of the variables passed in. Use PRIu64 and %zu where appropriate.

I periodically fix these but someone keeps sneaking in new ones :( Would be nice if ci actually made sure no new warnings get added..

Based on a quick glance this looks good so

Quoted 131 lines
---
 tests/perf.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)
tests/perf.c +16 -16
index ad62319e1bbc..a161c45d7009 100644
@@ -932,25 +932,25 @@ accumulator_print(struct accumulator *accumulator, const char *title)
 
 	igt_debug("%s:\n", title);
 	if (intel_gen(devid) >= 8) {
-		igt_debug("\ttime delta = %lu\n", deltas[idx++]);
-		igt_debug("\tclock cycle delta = %lu\n", deltas[idx++]);
+		igt_debug("\ttime delta = %"PRIu64"\n", deltas[idx++]);
+		igt_debug("\tclock cycle delta = %"PRIu64"\n", deltas[idx++]);
 
 		for (int i = 0; i < format.n_a40; i++)
-			igt_debug("\tA%u = %lu\n", i, deltas[idx++]);
+			igt_debug("\tA%u = %"PRIu64"\n", i, deltas[idx++]);
 	} else {
-		igt_debug("\ttime delta = %lu\n", deltas[idx++]);
+		igt_debug("\ttime delta = %"PRIu64"\n", deltas[idx++]);
 	}
 
 	for (int i = 0; i < format.n_a; i++) {
 		int a_id = format.first_a + i;
-		igt_debug("\tA%u = %lu\n", a_id, deltas[idx++]);
+		igt_debug("\tA%u = %"PRIu64"\n", a_id, deltas[idx++]);
 	}
 
 	for (int i = 0; i < format.n_a; i++)
-		igt_debug("\tB%u = %lu\n", i, deltas[idx++]);
+		igt_debug("\tB%u = %"PRIu64"\n", i, deltas[idx++]);
 
 	for (int i = 0; i < format.n_c; i++)
-		igt_debug("\tC%u = %lu\n", i, deltas[idx++]);
+		igt_debug("\tC%u = %"PRIu64"\n", i, deltas[idx++]);
 }
 
 /* The TestOa metric set is designed so */
@@ -2126,7 +2126,7 @@ test_oa_exponents(void)
 						}
 
 						igt_debug(" > report ts=%u"
-							  " ts_delta_last=%8u ts_delta_last_periodic=%8u is_timer=%i ctx_id=%8x gpu_ticks=%u period=%.2f A0=%lu A%i=%lu\n",
+							  " ts_delta_last=%8u ts_delta_last_periodic=%8u is_timer=%i ctx_id=%8x gpu_ticks=%u period=%.2f A0=%"PRIu64" A%i=%"PRIu64"\n",
 							  rpt[1],
 							  (last != NULL) ? (rpt[1] - last[1]) : 0,
 							  (last_periodic != NULL) ? (rpt[1] - last_periodic[1]) : 0,
@@ -2796,7 +2796,7 @@ test_buffer_fill(void)
 
 		do_ioctl(stream_fd, I915_PERF_IOCTL_DISABLE, 0);
 
-		igt_debug("fill_duration = %luns, oa_exponent = %u\n",
+		igt_debug("fill_duration = %"PRIu64"ns, oa_exponent = %u\n",
 			  fill_duration, oa_exponent);
 
 		do_ioctl(stream_fd, I915_PERF_IOCTL_ENABLE, 0);
@@ -2813,7 +2813,7 @@ test_buffer_fill(void)
 		 */
 		while (((last_timestamp - first_timestamp) * oa_period) < (fill_duration / 2)) {
 
-			igt_debug("dts=%u elapsed=%lu duration=%lu\n",
+			igt_debug("dts=%u elapsed=%"PRIu64" duration=%"PRIu64"\n",
 				  last_timestamp - first_timestamp,
 				  (last_timestamp - first_timestamp) * oa_period,
 				  fill_duration / 2);
@@ -2881,7 +2881,7 @@ test_buffer_fill(void)
 
 		do_ioctl(stream_fd, I915_PERF_IOCTL_DISABLE, 0);
 
-		igt_debug("%f < %lu < %f\n",
+		igt_debug("%f < %zu < %f\n",
 			  report_size * n_full_oa_reports * 0.45,
 			  n_periodic_reports * report_size,
 			  report_size * n_full_oa_reports * 0.55);
@@ -3032,7 +3032,7 @@ test_enable_disable(void)
 
 		do_ioctl(stream_fd, I915_PERF_IOCTL_DISABLE, 0);
 
-		igt_debug("%f < %lu < %f\n",
+		igt_debug("%f < %zu < %f\n",
 			  report_size * n_full_oa_reports * 0.45,
 			  n_periodic_reports * report_size,
 			  report_size * n_full_oa_reports * 0.55);
@@ -3783,7 +3783,7 @@ gen8_test_single_ctx_render_target_writes_a_counter(void)
 
 			memset(accumulator.deltas, 0, sizeof(accumulator.deltas));
 			accumulate_reports(&accumulator, report0_32, report1_32);
-			igt_debug("total: A0 = %lu, A21 = %lu, A26 = %lu\n",
+			igt_debug("total: A0 = %"PRIu64", A21 = %"PRIu64", A26 = %"PRIu64"\n",
 				  accumulator.deltas[2 + 0], /* skip timestamp + clock cycles */
 				  accumulator.deltas[2 + 21],
 				  accumulator.deltas[2 + 26]);
@@ -3905,7 +3905,7 @@ gen8_test_single_ctx_render_target_writes_a_counter(void)
 				if (lprev) {
 					memset(laccumulator.deltas, 0, sizeof(laccumulator.deltas));
 					accumulate_reports(&laccumulator, lprev, report);
-					igt_debug("    deltas: A0=%lu A21=%lu, A26=%lu\n",
+					igt_debug("    deltas: A0=%"PRIu64" A21=%"PRIu64", A26=%"PRIu64"\n",
 						  laccumulator.deltas[2 + 0], /* skip timestamp + clock cycles */
 						  laccumulator.deltas[2 + 21],
 						  laccumulator.deltas[2 + 26]);
@@ -3946,7 +3946,7 @@ gen8_test_single_ctx_render_target_writes_a_counter(void)
 
 				if (!skip_reason) {
 					accumulate_reports(&accumulator, prev, report);
-					igt_debug(" -> Accumulated deltas A0=%lu A21=%lu, A26=%lu\n",
+					igt_debug(" -> Accumulated deltas A0=%"PRIu64" A21=%"PRIu64", A26=%"PRIu64"\n",
 						  accumulator.deltas[2 + 0], /* skip timestamp + clock cycles */
 						  accumulator.deltas[2 + 21],
 						  accumulator.deltas[2 + 26]);
@@ -3974,7 +3974,7 @@ gen8_test_single_ctx_render_target_writes_a_counter(void)
 				}
 			}
 
-			igt_debug("n samples written = %ld/%lu (%ix%i)\n",
+			igt_debug("n samples written = %"PRIu64"/%"PRIu64" (%ix%i)\n",
 				  accumulator.deltas[2 + 21],/* skip timestamp + clock cycles */
 				  accumulator.deltas[2 + 26],
 				  width, height);
Signature · 6 lines
2.14.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 3/7
#3 lore raw

Re: [PATCH i-g-t 3/7] lib: Fix compilation on non-x86

In reply to Thierry Reding
Quoted 5 lines · Thierry Reding

From: Thierry Reding <[email protected]>

The meson build avoids the failure by excluding the igt_x86.c file from the compilation. autotools being what they are don't support that in an easy way,

There is some kind of build_x86 thing in autotools stuff.

But this looks OK to me as well so

Quoted 73 lines

so just use the preprocessor to avoid the duplicate function definitions.

Since igt_x86.c will now be ignored for non-x86 builds, the meson work- around can be removed.

---
 lib/igt_x86.c   | 2 ++
 lib/igt_x86.h   | 2 +-
 lib/meson.build | 5 +----
 3 files changed, 4 insertions(+), 5 deletions(-)
lib/igt_x86.c +2 -0
index 0f0963ced044..0ed3c6f1d356 100644
@@ -93,6 +93,7 @@
 
 #define has_YMM 0x1
 
+#if defined(__x86_64__) || defined(__i386__)
 unsigned igt_x86_features(void)
 {
 	unsigned max = __get_cpuid_max(BASIC_CPUID, 0);
@@ -172,3 +173,4 @@ char *igt_x86_features_to_string(unsigned features, char *line)
 
 	return ret;
 }
+#endif
lib/igt_x86.h +1 -1
index d6dcfa108331..27b7f0fd5837 100644
@@ -40,7 +40,7 @@
 #define AVX	0x80
 #define AVX2	0x100
 
-#if defined(__x86_64__)
+#if defined(__x86_64__) || defined(__i386__)
 unsigned igt_x86_features(void);
 char *igt_x86_features_to_string(unsigned features, char *line);
 #else
lib/meson.build +1 -4
index 42919eef52a8..e89d4bdf8278 100644
@@ -56,6 +56,7 @@ lib_sources = [
 	'igt_stats.c',
 	'igt_sysfs.c',
 	'igt_vgem.c',
+	'igt_x86.c',
 	'instdone.c',
 	'intel_batchbuffer.c',
 	'intel_chipset.c',
@@ -88,10 +89,6 @@ lib_sources = [
 	'igt_kmod.c',
 ]
 
-if ['x86', 'x86_64'].contains(host_machine.cpu_family())
-    lib_sources += 'igt_x86.c'
-endif
-
 lib_deps = [
 	cairo,
 	glib,
Signature · 6 lines
2.14.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

Re: [Intel-gfx] [PATCH i-g-t 3/7] lib: Fix compilation on non-x86

Quoted 8 lines · Ville Syrjälä
Quoted 5 lines · Thierry Reding

From: Thierry Reding <[email protected]>

The meson build avoids the failure by excluding the igt_x86.c file from the compilation. autotools being what they are don't support that in an easy way,

There is some kind of build_x86 thing in autotools stuff.

Indeed. I'm not sure it could be used, though, because the sources are listed in Makefile.sources which is also used by the Android build. I don't think it would understand the conditional.

Thierry

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#12 lore raw

✓ Fi.CI.BAT: success for series starting with [1/7] tests/perf: Fix a bunch of warnings on 32-bit systems

In reply to Thierry Reding
== Series Details ==

== Series Details ==

Series: series starting with [1/7] tests/perf: Fix a bunch of warnings on 32-bit systems
URL : https://patchwork.freedesktop.org/series/31818/
State : success

== Summary ==

IGT patchset tested on top of latest successful build 1fc20664fcbff058db365a2238a5bddfeff5325a meson: Make syncobj tests build

with latest DRM-Tip kernel build CI_DRM_3222
a869721e93a5 drm-tip: 2017y-10m-12d-08h-30m-31s UTC integration manifest

No testlist changes.

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:458s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:474s
fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:391s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:581s
fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:286s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:531s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:530s
fi-byt-j1900     total:289  pass:253  dwarn:1   dfail:0   fail:0   skip:35  time:540s
fi-byt-n2820     total:289  pass:249  dwarn:1   dfail:0   fail:0   skip:39  time:522s
fi-cfl-s         total:289  pass:253  dwarn:4   dfail:0   fail:0   skip:32  time:556s
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:434s
fi-gdg-551       total:289  pass:178  dwarn:1   dfail:0   fail:1   skip:109 time:274s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:598s
fi-hsw-4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:441s
fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:464s
fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:506s
fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:471s
fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:506s
fi-kbl-7567u     total:289  pass:265  dwarn:4   dfail:0   fail:0   skip:20  time:495s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:595s
fi-pnv-d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66  time:659s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:465s
fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:658s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:536s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:521s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:474s
fi-snb-2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:589s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:434s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_339/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#13 lore raw

✗ Fi.CI.IGT: failure for series starting with [1/7] tests/perf: Fix a bunch of warnings on 32-bit systems

In reply to Thierry Reding
== Series Details ==

== Series Details ==

Series: series starting with [1/7] tests/perf: Fix a bunch of warnings on 32-bit systems
URL : https://patchwork.freedesktop.org/series/31818/
State : failure

== Summary ==

Test kms_flip:

        Subgroup flip-vs-fences-interruptible:
                pass       -> FAIL       (shard-hsw) fdo#102946
Test kms_setmode:
        Subgroup basic:
                pass       -> FAIL       (shard-hsw) fdo#99912
Test prime_self_import:
        Subgroup reimport-vs-gem_close-race:
                fail       -> PASS       (shard-hsw) fdo#102655
        Subgroup export-vs-gem_close-race:
                pass       -> FAIL       (shard-hsw)
Test kms_frontbuffer_tracking:
        Subgroup fbc-1p-offscren-pri-shrfb-draw-mmap-wc:
                dmesg-warn -> PASS       (shard-hsw) fdo#102614 +1

fdo#102946 https://bugs.freedesktop.org/show_bug.cgi?id=102946
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
fdo#102655 https://bugs.freedesktop.org/show_bug.cgi?id=102655
fdo#102614 https://bugs.freedesktop.org/show_bug.cgi?id=102614

shard-hsw total:2500 pass:1404 dwarn:1 dfail:0 fail:11 skip:1084 time:9330s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_339/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw

Re: [PATCH i-g-t 3/7] lib: Fix compilation on non-x86

In reply to Thierry Reding

Quoting Thierry Reding (2017-10-12 14:29:39)

lib/igt_x86.h line 45

Quoted 12 lines
lib/igt_x86.h +1 -1
index d6dcfa108331..27b7f0fd5837 100644
@@ -40,7 +40,7 @@
 #define AVX    0x80
 #define AVX2   0x100
 
-#if defined(__x86_64__)
+#if defined(__x86_64__) || defined(__i386__)
 unsigned igt_x86_features(void);
 char *igt_x86_features_to_string(unsigned features, char *line);

This by itself is a build regression from 2a74ae550842. Would be nice to get this fixed irrespective of the meson fixes.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx