Skip to contentSkip to conversation

Fix a bunch of printf types

PATCH In review [email protected] 5 participants 27 messages Dec 14, 2015 – Dec 16, 2015 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/7 Fix a bunch of printf types

From: Ville Syrjälä <[email protected]>

igt_kms.c: In function ‘igt_crtc_set_background’:
igt_kms.c:1940:2: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
LOG(display, "%s.%d: crtc_set_background(%lu)\n",
^
intel_firmware_decode.c: In function ‘csr_open’:
intel_firmware_decode.c:169:2: warning: format ‘%zd’ expects argument of type ‘signed size_t’, but argument 3 has type ‘__off_t’ [-Wformat=]
printf("Firmware: %s (%zd bytes)\n", filename, st.st_size);
^
intel_gpu_top.c: In function ‘main’:
intel_gpu_top.c:683:10: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint64_t’ [-Wformat=]

          stats[i] - last_stats[i]);
          ^

hsw_compute_wrpll.c: In function ‘main’:
hsw_compute_wrpll.c:644:3: warning: format ‘%li’ expects argument of type ‘long int’, but argument 7 has type ‘long long int’ [-Wformat=]
igt_fail_on_f(ref->r2 != r2 || ref->n2 != n2 || ref->p != p,
^
gem_gtt_hog.c: In function ‘__real_main155’:
gem_gtt_hog.c:177:2: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘unsigned int’ [-Wformat=]
igt_info("Time to execute %lu children: %7.3fms\n",
^
kms_flip.c: In function ‘run_test_step’:
kms_flip.c:985:3: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 10 has type ‘__time_t’ [-Wformat=]
igt_assert_f(end - start > 0.9 * frame_time(o) &&
^
kms_flip.c:985:3: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 11 has type ‘__suseconds_t’ [-Wformat=] kms_frontbuffer_tracking.c: In function ‘setup_sink_crc’:
kms_frontbuffer_tracking.c:1364:3: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘ssize_t’ [-Wformat=]
igt_info("Unexpected sink CRC error, rc=:%ld errno:%d %s\n",
^

---
 lib/igt_kms.c                    |  2 +-
 tests/gem_gtt_hog.c              |  2 +-
 tests/kms_flip.c                 | 20 ++++++++++----------
 tests/kms_frontbuffer_tracking.c |  2 +-
 tools/hsw_compute_wrpll.c        |  2 +-
 tools/intel_firmware_decode.c    |  3 ++-
 tools/intel_gpu_top.c            |  2 +-
 7 files changed, 17 insertions(+), 16 deletions(-)
lib/igt_kms.c +1 -1
index 5d5a95c20106..497118afe52a 100644
@@ -1937,7 +1937,7 @@ void igt_crtc_set_background(igt_pipe_t *pipe, uint64_t background)
 {
 	igt_display_t *display = pipe->display;
 
-	LOG(display, "%s.%d: crtc_set_background(%lu)\n",
+	LOG(display, "%s.%d: crtc_set_background(%"PRIx64")\n",
 	    kmstest_pipe_name(pipe->pipe),
 	    pipe->pipe, background);
 
tests/gem_gtt_hog.c +1 -1
index 7ca7d12d96f1..365b43ee44ab 100644
@@ -174,6 +174,6 @@ igt_simple_main
 	igt_waitchildren();
 	gettimeofday(&end, NULL);
 
-	igt_info("Time to execute %lu children:		%7.3fms\n",
+	igt_info("Time to execute %zu children:		%7.3fms\n",
 		 ARRAY_SIZE(children), elapsed(&start, &end) / 1000);
 }
tests/kms_flip.c +10 -10
index a3acc3dd28e8..750a1882dc3c 100644
@@ -132,11 +132,11 @@ struct event_state {
 static void dump_event_state(const struct event_state *es)
 {
 	igt_debug("name = %s\n"
-		  "last_ts = %lu.%lu usec\n"
-		  "last_received_ts = %lu.%lu usec\n"
+		  "last_ts = %ld.%ld usec\n"
+		  "last_received_ts = %ld.%ld usec\n"
 		  "last_seq = %u\n"
-		  "current_ts = %lu.%lu usec\n"
-		  "current_received_ts = %lu.%lu usec\n"
+		  "current_ts = %ld.%ld usec\n"
+		  "current_received_ts = %ld.%ld usec\n"
 		  "current_seq = %u\n"
 		  "count = %u\n"
 		  "seq_step = %d\n",
@@ -644,8 +644,8 @@ static void check_state(struct test_output *o, struct event_state *es)
 	timersub(&es->current_ts, &es->current_received_ts, &diff);
 	if (!analog_tv_connector(o)) {
 		igt_assert_f(diff.tv_sec < 0 || (diff.tv_sec == 0 && diff.tv_usec <= 2000),
-			     "%s ts delayed for too long: %is, %iusec\n",
-			     es->name, (int)diff.tv_sec, (int)diff.tv_usec);
+			     "%s ts delayed for too long: %lds, %ldusec\n",
+			     es->name, diff.tv_sec, diff.tv_usec);
 
 	}
 
@@ -655,9 +655,9 @@ static void check_state(struct test_output *o, struct event_state *es)
 	timersub(&es->current_ts, &es->last_received_ts, &diff);
 	igt_assert_f(timercmp(&es->last_received_ts, &es->current_ts, <),
 		     "%s ts before the %s was issued!\n"
-		     "timerdiff %is, %ius\n",
+		     "timerdiff %lds, %ldusec\n",
 		     es->name, es->name,
-		     (int) diff.tv_sec, (int) diff.tv_usec);
+		     diff.tv_sec, diff.tv_usec);
 
 	/* check only valid if no modeset happens in between, that increments by
 	 * (1 << 23) on each step. This bounding matches the one in
@@ -688,8 +688,8 @@ static void check_state(struct test_output *o, struct event_state *es)
 
 		igt_assert_f(fabs((((double) diff.tv_usec) - usec_interflip) /
 				  usec_interflip) <= 0.005,
-			     "inter-%s ts jitter: %is, %ius\n",
-			     es->name, (int) diff.tv_sec, (int) diff.tv_usec);
+			     "inter-%s ts jitter: %lds, %ldusec\n",
+			     es->name, diff.tv_sec, diff.tv_usec);
 
 		igt_assert_f(es->current_seq == es->last_seq + o->seq_step,
 			     "unexpected %s seq %u, expected %u\n",
tests/kms_frontbuffer_tracking.c +1 -1
index 23c2b0658474..e7acc7cabbed 100644
@@ -1361,7 +1361,7 @@ static void setup_sink_crc(void)
 	else if (rc == SINK_CRC_SIZE)
 		sink_crc.supported = true;
 	else
-		igt_info("Unexpected sink CRC error, rc=:%ld errno:%d %s\n",
+		igt_info("Unexpected sink CRC error, rc=:%zd errno:%d %s\n",
 			 rc, errno_, strerror(errno_));
 }
 
tools/hsw_compute_wrpll.c +1 -1
index e27cc349e630..6c85c07c77c4 100644
@@ -642,7 +642,7 @@ int main(void)
 
 		wrpll_compute_rnp(ref->clock, &r2, &n2, &p);
 		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);
+			      "Computed value differs for %"PRId64" 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;
tools/intel_firmware_decode.c +2 -1
index ae6e02c4566c..61ce3a531165 100644
@@ -25,6 +25,7 @@
  */
 
 #include <fcntl.h>
+#include <inttypes.h>
 #include <stdio.h>
 #include <stdint.h>
 #include <stdlib.h>
@@ -166,7 +167,7 @@ static void csr_open(csr_t *ctx, const char *filename)
 			 ctx->fd, 0);
 	igt_fail_on_f(ctx->base == MAP_FAILED, "Couldn't mmap %s\n", filename);
 
-	printf("Firmware: %s (%zd bytes)\n", filename, st.st_size);
+	printf("Firmware: %s (%"PRId64" bytes)\n", filename, (int64_t)st.st_size);
 
 	ctx->css_header = (struct intel_css_header *)ctx->base;
 	ctx->package_header = (struct intel_package_header *)
tools/intel_gpu_top.c +1 -1
index b5cfda043dd9..4f327c6daf6b 100644
@@ -679,7 +679,7 @@ int main(int argc, char **argv)
 
 			for (i = 0; i < MAX_NUM_TOP_BITS; i++) {
 				if (i < STATS_COUNT && HAS_STATS_REGS(devid)) {
-					fprintf(output, "%lu\t",
+					fprintf(output, "%"PRIu64"\t",
 						   stats[i] - last_stats[i]);
 					last_stats[i] = stats[i];
 				}
Signature · 6 lines
2.4.10

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

PATCH 2/7 tests/gem_mmap_gtt: Deal with tile sizes on gen2/3

From: Ville Syrjälä <[email protected]>

Gen2/3 platforms have some unusual tile dimensions. Account for them to make the test work correctly.

---
 tests/gem_mmap_gtt.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
tests/gem_mmap_gtt.c +17 -3
index 4d146426535b..b9c413b6160b 100644
@@ -253,6 +253,18 @@ test_write_gtt(int fd)
 	munmap(src, OBJECT_SIZE);
 }
 
+static int tile_width(uint32_t devid, int tiling)
+{
+	if (intel_gen(devid) == 2)
+		return 128;
+	else if (tiling == I915_TILING_X)
+		return 512;
+	else if (IS_915(devid))
+		return 512;
+	else
+		return 128;
+}
+
 static void
 test_huge_bo(int fd, int huge, int tiling)
 {
@@ -261,7 +273,8 @@ test_huge_bo(int fd, int huge, int tiling)
 	char *tiled_pattern;
 	char *linear_pattern;
 	uint64_t size, last_offset;
-	int pitch = tiling == I915_TILING_Y ? 128 : 512;
+	uint32_t devid = intel_get_drm_devid(fd);
+	int pitch = tile_width(devid, tiling);
 	int i;
 
 	switch (huge) {
@@ -327,6 +340,7 @@ test_huge_bo(int fd, int huge, int tiling)
 static void
 test_huge_copy(int fd, int huge, int tiling_a, int tiling_b)
 {
+	uint32_t devid = intel_get_drm_devid(fd);
 	uint64_t huge_object_size, i;
 	uint32_t bo, *pattern_a, *pattern_b;
 	char *a, *b;
@@ -357,7 +371,7 @@ test_huge_copy(int fd, int huge, int tiling_a, int tiling_b)
 
 	bo = gem_create(fd, huge_object_size);
 	if (tiling_a)
-		igt_require(__gem_set_tiling(fd, bo, tiling_a, tiling_a == I915_TILING_Y ? 128 : 512) == 0);
+		igt_require(__gem_set_tiling(fd, bo, tiling_a, tile_width(devid, tiling_a)) == 0);
 	a = __gem_mmap__gtt(fd, bo, huge_object_size, PROT_READ | PROT_WRITE);
 	igt_require(a);
 	gem_close(fd, bo);
@@ -367,7 +381,7 @@ test_huge_copy(int fd, int huge, int tiling_a, int tiling_b)
 
 	bo = gem_create(fd, huge_object_size);
 	if (tiling_b)
-		igt_require(__gem_set_tiling(fd, bo, tiling_b, tiling_b == I915_TILING_Y ? 128 : 512) == 0);
+		igt_require(__gem_set_tiling(fd, bo, tiling_b, tile_width(devid, tiling_b)) == 0);
 	b = __gem_mmap__gtt(fd, bo, huge_object_size, PROT_READ | PROT_WRITE);
 	igt_require(b);
 	gem_close(fd, bo);
Signature · 6 lines
2.4.10

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

Re: [PATCH i-g-t 2/7] tests/gem_mmap_gtt: Deal with tile sizes on gen2/3

Quoted 4 lines · On Mon, Dec 14, 2015 at 10:15:51PM +0200, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Gen2/3 platforms have some unusual tile dimensions. Account for them to make the test work correctly.

iirc, for the purposes of the test, we could just set the stride to 512 and be done with it. The idea behind the test is to simply require a fence register and then since we compare the same tiling pattern in both, the actual tiling is irrevelant. (I wonder if using different strides is of any value, not sure that it is - it doesn't change any code paths).
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

Re: [PATCH i-g-t 2/7] tests/gem_mmap_gtt: Deal with tile sizes on gen2/3

Quoted 6 lines · Chris Wilson
Quoted 4 lines · On Mon, Dec 14, 2015 at 10:15:51PM +0200, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Gen2/3 platforms have some unusual tile dimensions. Account for them to make the test work correctly.

Quoted 6 lines

iirc, for the purposes of the test, we could just set the stride to 512 and be done with it. The idea behind the test is to simply require a fence register and then since we compare the same tiling pattern in both, the actual tiling is irrevelant. (I wonder if using different strides is of any value, not sure that it is - it doesn't change any code paths).

Well, it definitely didn't work with 512 for the X tiled.

Let's see. 512 bytes is four tiles horizontally on gen2, but we only allocate two tiles for the object (4k). Then we walk over the mapping meaning we first hit 128 bytes of the first tile, then 128 bytes of the second tile. Then we walk into oblivion, which I suppose means the scratch page. So we do that until we've written 4k bytes, meaning we only manage to write something to the top halves of the two tiles we actually allocated.

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

Re: [PATCH i-g-t 2/7] tests/gem_mmap_gtt: Deal with tile sizes on gen2/3

In reply to [email protected]

2015-12-14 18:15 GMT-02:00 <[email protected]>:

Quoted 20 lines

From: Ville Syrjälä <[email protected]>

Gen2/3 platforms have some unusual tile dimensions. Account for them to make the test work correctly.

---
 tests/gem_mmap_gtt.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
tests/gem_mmap_gtt.c +2 -0
index 4d146426535b..b9c413b6160b 100644
@@ -253,6 +253,18 @@ test_write_gtt(int fd)
        munmap(src, OBJECT_SIZE);
 }
 
+static int tile_width(uint32_t devid, int tiling)
+{

tests/gem_mmap_gtt.c test_write_gtt(int fd) · line 267

Quoted 10 lines
tests/gem_mmap_gtt.c +10 -0
+       if (intel_gen(devid) == 2)
+               return 128;
+       else if (tiling == I915_TILING_X)
+               return 512;
+       else if (IS_915(devid))
+               return 512;
+       else
+               return 128;
+}
+

Would this be useful: http://patchwork.freedesktop.org/patch/66846/ ? I mean, we could export some subfunction out of the original patch.

Quoted 46 lines
tests/gem_mmap_gtt.c +5 -4
 static void
 test_huge_bo(int fd, int huge, int tiling)
 {
@@ -261,7 +273,8 @@ test_huge_bo(int fd, int huge, int tiling)
        char *tiled_pattern;
        char *linear_pattern;
        uint64_t size, last_offset;
-       int pitch = tiling == I915_TILING_Y ? 128 : 512;
+       uint32_t devid = intel_get_drm_devid(fd);
+       int pitch = tile_width(devid, tiling);
        int i;
 
        switch (huge) {
@@ -327,6 +340,7 @@ test_huge_bo(int fd, int huge, int tiling)
 static void
 test_huge_copy(int fd, int huge, int tiling_a, int tiling_b)
 {
+       uint32_t devid = intel_get_drm_devid(fd);
        uint64_t huge_object_size, i;
        uint32_t bo, *pattern_a, *pattern_b;
        char *a, *b;
@@ -357,7 +371,7 @@ test_huge_copy(int fd, int huge, int tiling_a, int tiling_b)
 
        bo = gem_create(fd, huge_object_size);
        if (tiling_a)
-               igt_require(__gem_set_tiling(fd, bo, tiling_a, tiling_a == I915_TILING_Y ? 128 : 512) == 0);
+               igt_require(__gem_set_tiling(fd, bo, tiling_a, tile_width(devid, tiling_a)) == 0);
        a = __gem_mmap__gtt(fd, bo, huge_object_size, PROT_READ | PROT_WRITE);
        igt_require(a);
        gem_close(fd, bo);
@@ -367,7 +381,7 @@ test_huge_copy(int fd, int huge, int tiling_a, int tiling_b)
 
        bo = gem_create(fd, huge_object_size);
        if (tiling_b)
-               igt_require(__gem_set_tiling(fd, bo, tiling_b, tiling_b == I915_TILING_Y ? 128 : 512) == 0);
+               igt_require(__gem_set_tiling(fd, bo, tiling_b, tile_width(devid, tiling_b)) == 0);
        b = __gem_mmap__gtt(fd, bo, huge_object_size, PROT_READ | PROT_WRITE);
        igt_require(b);
        gem_close(fd, bo);
--

2.4.10

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 5 lines
Paulo Zanoni
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

Re: [PATCH i-g-t 2/7] tests/gem_mmap_gtt: Deal with tile sizes on gen2/3

Quoted 19 lines · Paulo Zanoni

2015-12-14 18:15 GMT-02:00 <[email protected]>:

Quoted 18 lines

From: Ville Syrjälä <[email protected]>

Gen2/3 platforms have some unusual tile dimensions. Account for them to make the test work correctly.

---
 tests/gem_mmap_gtt.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
tests/gem_mmap_gtt.c +0 -0
index 4d146426535b..b9c413b6160b 100644
@@ -253,6 +253,18 @@ test_write_gtt(int fd)
        munmap(src, OBJECT_SIZE);
 }
 
Quoted 15 lines

tests/gem_mmap_gtt.c test_write_gtt(int fd) · line 267

Quoted 12 lines
tests/gem_mmap_gtt.c +12 -0
+static int tile_width(uint32_t devid, int tiling)
+{
+       if (intel_gen(devid) == 2)
+               return 128;
+       else if (tiling == I915_TILING_X)
+               return 512;
+       else if (IS_915(devid))
+               return 512;
+       else
+               return 128;
+}
+

Would this be useful: http://patchwork.freedesktop.org/patch/66846/ ? I mean, we could export some subfunction out of the original patch.

I suppose we might try to consolidate. One snag is that for display stuff we want to use the modifiers, but I'm not sure we want to pollute any fence stuff with those.

BTW your Yf width is not correct for 8/64 bpp (width*height != 4k).

Quoted 52 lines
Quoted 47 lines
tests/gem_mmap_gtt.c +5 -4
 static void
 test_huge_bo(int fd, int huge, int tiling)
 {
@@ -261,7 +273,8 @@ test_huge_bo(int fd, int huge, int tiling)
        char *tiled_pattern;
        char *linear_pattern;
        uint64_t size, last_offset;
-       int pitch = tiling == I915_TILING_Y ? 128 : 512;
+       uint32_t devid = intel_get_drm_devid(fd);
+       int pitch = tile_width(devid, tiling);
        int i;
 
        switch (huge) {
@@ -327,6 +340,7 @@ test_huge_bo(int fd, int huge, int tiling)
 static void
 test_huge_copy(int fd, int huge, int tiling_a, int tiling_b)
 {
+       uint32_t devid = intel_get_drm_devid(fd);
        uint64_t huge_object_size, i;
        uint32_t bo, *pattern_a, *pattern_b;
        char *a, *b;
@@ -357,7 +371,7 @@ test_huge_copy(int fd, int huge, int tiling_a, int tiling_b)
 
        bo = gem_create(fd, huge_object_size);
        if (tiling_a)
-               igt_require(__gem_set_tiling(fd, bo, tiling_a, tiling_a == I915_TILING_Y ? 128 : 512) == 0);
+               igt_require(__gem_set_tiling(fd, bo, tiling_a, tile_width(devid, tiling_a)) == 0);
        a = __gem_mmap__gtt(fd, bo, huge_object_size, PROT_READ | PROT_WRITE);
        igt_require(a);
        gem_close(fd, bo);
@@ -367,7 +381,7 @@ test_huge_copy(int fd, int huge, int tiling_a, int tiling_b)
 
        bo = gem_create(fd, huge_object_size);
        if (tiling_b)
-               igt_require(__gem_set_tiling(fd, bo, tiling_b, tiling_b == I915_TILING_Y ? 128 : 512) == 0);
+               igt_require(__gem_set_tiling(fd, bo, tiling_b, tile_width(devid, tiling_b)) == 0);
        b = __gem_mmap__gtt(fd, bo, huge_object_size, PROT_READ | PROT_WRITE);
        igt_require(b);
        gem_close(fd, bo);
--

2.4.10

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

Re: [PATCH i-g-t 2/7] tests/gem_mmap_gtt: Deal with tile sizes on gen2/3

2015-12-15 19:08 GMT-02:00 Ville Syrjälä <[email protected]>:

Quoted 36 lines · Paulo Zanoni
Quoted 19 lines

2015-12-14 18:15 GMT-02:00 <[email protected]>:

Quoted 18 lines

From: Ville Syrjälä <[email protected]>

Gen2/3 platforms have some unusual tile dimensions. Account for them to make the test work correctly.

---
 tests/gem_mmap_gtt.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
tests/gem_mmap_gtt.c +0 -0
index 4d146426535b..b9c413b6160b 100644
@@ -253,6 +253,18 @@ test_write_gtt(int fd)
        munmap(src, OBJECT_SIZE);
 }
 
Quoted 15 lines

tests/gem_mmap_gtt.c test_write_gtt(int fd) · line 267

Quoted 12 lines
tests/gem_mmap_gtt.c +12 -0
+static int tile_width(uint32_t devid, int tiling)
+{
+       if (intel_gen(devid) == 2)
+               return 128;
+       else if (tiling == I915_TILING_X)
+               return 512;
+       else if (IS_915(devid))
+               return 512;
+       else
+               return 128;
+}
+

Would this be useful: http://patchwork.freedesktop.org/patch/66846/ ? I mean, we could export some subfunction out of the original patch.

Quoted 5 lines

I suppose we might try to consolidate. One snag is that for display stuff we want to use the modifiers, but I'm not sure we want to pollute any fence stuff with those.

BTW your Yf width is not correct for 8/64 bpp (width*height != 4k).

Hmmm, so I guess we need to discover if the Kernel's i915_tiling_ok() needs to be fixed.

Quoted 57 lines
Quoted 44 lines
Quoted 44 lines
tests/gem_mmap_gtt.c +5 -4
 static void
 test_huge_bo(int fd, int huge, int tiling)
 {
@@ -261,7 +273,8 @@ test_huge_bo(int fd, int huge, int tiling)
        char *tiled_pattern;
        char *linear_pattern;
        uint64_t size, last_offset;
-       int pitch = tiling == I915_TILING_Y ? 128 : 512;
+       uint32_t devid = intel_get_drm_devid(fd);
+       int pitch = tile_width(devid, tiling);
        int i;
 
        switch (huge) {
@@ -327,6 +340,7 @@ test_huge_bo(int fd, int huge, int tiling)
 static void
 test_huge_copy(int fd, int huge, int tiling_a, int tiling_b)
 {
+       uint32_t devid = intel_get_drm_devid(fd);
        uint64_t huge_object_size, i;
        uint32_t bo, *pattern_a, *pattern_b;
        char *a, *b;
@@ -357,7 +371,7 @@ test_huge_copy(int fd, int huge, int tiling_a, int tiling_b)
 
        bo = gem_create(fd, huge_object_size);
        if (tiling_a)
-               igt_require(__gem_set_tiling(fd, bo, tiling_a, tiling_a == I915_TILING_Y ? 128 : 512) == 0);
+               igt_require(__gem_set_tiling(fd, bo, tiling_a, tile_width(devid, tiling_a)) == 0);
        a = __gem_mmap__gtt(fd, bo, huge_object_size, PROT_READ | PROT_WRITE);
        igt_require(a);
        gem_close(fd, bo);
@@ -367,7 +381,7 @@ test_huge_copy(int fd, int huge, int tiling_a, int tiling_b)
 
        bo = gem_create(fd, huge_object_size);
        if (tiling_b)
-               igt_require(__gem_set_tiling(fd, bo, tiling_b, tiling_b == I915_TILING_Y ? 128 : 512) == 0);
+               igt_require(__gem_set_tiling(fd, bo, tiling_b, tile_width(devid, tiling_b)) == 0);
        b = __gem_mmap__gtt(fd, bo, huge_object_size, PROT_READ | PROT_WRITE);
        igt_require(b);
        gem_close(fd, bo);
--

2.4.10

Quoted 9 lines
Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Paulo Zanoni

--
Ville Syrjälä
Intel OTC

Signature · 5 lines
Paulo Zanoni
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

Re: [PATCH i-g-t 2/7] tests/gem_mmap_gtt: Deal with tile sizes on gen2/3

Quoted 37 lines · Paulo Zanoni

2015-12-15 19:08 GMT-02:00 Ville Syrjälä <[email protected]>:

Quoted 36 lines · Paulo Zanoni
Quoted 34 lines

2015-12-14 18:15 GMT-02:00 <[email protected]>:

Quoted 20 lines

From: Ville Syrjälä <[email protected]>

Gen2/3 platforms have some unusual tile dimensions. Account for them to make the test work correctly.

---
 tests/gem_mmap_gtt.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
tests/gem_mmap_gtt.c +2 -0
index 4d146426535b..b9c413b6160b 100644
@@ -253,6 +253,18 @@ test_write_gtt(int fd)
        munmap(src, OBJECT_SIZE);
 }
 
+static int tile_width(uint32_t devid, int tiling)
+{

tests/gem_mmap_gtt.c test_write_gtt(int fd) · line 267

Quoted 10 lines
tests/gem_mmap_gtt.c +10 -0
+       if (intel_gen(devid) == 2)
+               return 128;
+       else if (tiling == I915_TILING_X)
+               return 512;
+       else if (IS_915(devid))
+               return 512;
+       else
+               return 128;
+}
+

Would this be useful: http://patchwork.freedesktop.org/patch/66846/ ? I mean, we could export some subfunction out of the original patch.

Quoted 8 lines
Quoted 5 lines

I suppose we might try to consolidate. One snag is that for display stuff we want to use the modifiers, but I'm not sure we want to pollute any fence stuff with those.

BTW your Yf width is not correct for 8/64 bpp (width*height != 4k).

Hmmm, so I guess we need to discover if the Kernel's i915_tiling_ok() needs to be fixed.

No. That functions is all about fences. Fences and Yf don't mix.

Quoted 63 lines
Quoted 58 lines
Quoted 45 lines
Quoted 45 lines
tests/gem_mmap_gtt.c +5 -4
 static void
 test_huge_bo(int fd, int huge, int tiling)
 {
@@ -261,7 +273,8 @@ test_huge_bo(int fd, int huge, int tiling)
        char *tiled_pattern;
        char *linear_pattern;
        uint64_t size, last_offset;
-       int pitch = tiling == I915_TILING_Y ? 128 : 512;
+       uint32_t devid = intel_get_drm_devid(fd);
+       int pitch = tile_width(devid, tiling);
        int i;
 
        switch (huge) {
@@ -327,6 +340,7 @@ test_huge_bo(int fd, int huge, int tiling)
 static void
 test_huge_copy(int fd, int huge, int tiling_a, int tiling_b)
 {
+       uint32_t devid = intel_get_drm_devid(fd);
        uint64_t huge_object_size, i;
        uint32_t bo, *pattern_a, *pattern_b;
        char *a, *b;
@@ -357,7 +371,7 @@ test_huge_copy(int fd, int huge, int tiling_a, int tiling_b)
 
        bo = gem_create(fd, huge_object_size);
        if (tiling_a)
-               igt_require(__gem_set_tiling(fd, bo, tiling_a, tiling_a == I915_TILING_Y ? 128 : 512) == 0);
+               igt_require(__gem_set_tiling(fd, bo, tiling_a, tile_width(devid, tiling_a)) == 0);
        a = __gem_mmap__gtt(fd, bo, huge_object_size, PROT_READ | PROT_WRITE);
        igt_require(a);
        gem_close(fd, bo);
@@ -367,7 +381,7 @@ test_huge_copy(int fd, int huge, int tiling_a, int tiling_b)
 
        bo = gem_create(fd, huge_object_size);
        if (tiling_b)
-               igt_require(__gem_set_tiling(fd, bo, tiling_b, tiling_b == I915_TILING_Y ? 128 : 512) == 0);
+               igt_require(__gem_set_tiling(fd, bo, tiling_b, tile_width(devid, tiling_b)) == 0);
        b = __gem_mmap__gtt(fd, bo, huge_object_size, PROT_READ | PROT_WRITE);
        igt_require(b);
        gem_close(fd, bo);
--

2.4.10

Quoted 9 lines
Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Paulo Zanoni

--
Ville Syrjälä
Intel OTC

Signature · 1 line
Paulo Zanoni
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw

PATCH 3/7 tests/gem_mmap_gtt: Add progress indicators

In reply to [email protected]

From: Ville Syrjälä <[email protected]>

Some of the copy tests take a while, so let the user know how far along we are via a progress indicator.

---
 tests/gem_mmap_gtt.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
tests/gem_mmap_gtt.c +9 -2
index b9c413b6160b..3a64a6fdc342 100644
@@ -376,8 +376,10 @@ test_huge_copy(int fd, int huge, int tiling_a, int tiling_b)
 	igt_require(a);
 	gem_close(fd, bo);
 
-	for (i = 0; i < huge_object_size / PAGE_SIZE; i++)
+	for (i = 0; i < huge_object_size / PAGE_SIZE; i++) {
 		memcpy(a + PAGE_SIZE*i, pattern_a, PAGE_SIZE);
+		igt_progress("Writing a ", i, huge_object_size / PAGE_SIZE);
+	}
 
 	bo = gem_create(fd, huge_object_size);
 	if (tiling_b)
@@ -386,14 +388,17 @@ test_huge_copy(int fd, int huge, int tiling_a, int tiling_b)
 	igt_require(b);
 	gem_close(fd, bo);
 
-	for (i = 0; i < huge_object_size / PAGE_SIZE; i++)
+	for (i = 0; i < huge_object_size / PAGE_SIZE; i++) {
 		memcpy(b + PAGE_SIZE*i, pattern_b, PAGE_SIZE);
+		igt_progress("Writing b ", i, huge_object_size / PAGE_SIZE);
+	}
 
 	for (i = 0; i < huge_object_size / PAGE_SIZE; i++) {
 		if (i & 1)
 			memcpy(a + i *PAGE_SIZE, b + i*PAGE_SIZE, PAGE_SIZE);
 		else
 			memcpy(b + i *PAGE_SIZE, a + i*PAGE_SIZE, PAGE_SIZE);
+		igt_progress("Copying a<->b ", i, huge_object_size / PAGE_SIZE);
 	}
 
 	for (i = 0; i < huge_object_size / PAGE_SIZE; i++) {
@@ -401,6 +406,7 @@ test_huge_copy(int fd, int huge, int tiling_a, int tiling_b)
 			igt_assert(memcmp(pattern_b, a + PAGE_SIZE*i, PAGE_SIZE) == 0);
 		else
 			igt_assert(memcmp(pattern_a, a + PAGE_SIZE*i, PAGE_SIZE) == 0);
+		igt_progress("Checking a ", i, huge_object_size / PAGE_SIZE);
 	}
 	munmap(a, huge_object_size);
 
@@ -409,6 +415,7 @@ test_huge_copy(int fd, int huge, int tiling_a, int tiling_b)
 			igt_assert(memcmp(pattern_b, b + PAGE_SIZE*i, PAGE_SIZE) == 0);
 		else
 			igt_assert(memcmp(pattern_a, b + PAGE_SIZE*i, PAGE_SIZE) == 0);
+		igt_progress("Checking b ", i, huge_object_size / PAGE_SIZE);
 	}
 	munmap(b, huge_object_size);
 
Signature · 6 lines
2.4.10

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

PATCH 4/7 tests/gem_mmap_gtt: Make the small-bo tiling tests work on old platforms

In reply to [email protected]

From: Ville Syrjälä <[email protected]>

Several factors conspire against us when trying to execute the tiled small-bo tests:
- pre-gen4 require power of two fences, with natural alignment
- the entire gtt may be mappable
- we put a guard page at the end of gtt

What all that means is that when we try to use a tiled object half the size of the mappable area, we can only fit it in the first half of the gtt. That leads to a SIGBUS when we try to fault in the object when there's already something (eg. fbdev) occupying the first half of gtt.

So in order to make the tests run on old machines, let's further halve the object size when things look too tight.

---
 tests/gem_mmap_gtt.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
tests/gem_mmap_gtt.c +12 -0
index 3a64a6fdc342..5c3bafcc38ba 100644
@@ -280,6 +280,18 @@ test_huge_bo(int fd, int huge, int tiling)
 	switch (huge) {
 	case -1:
 		size = gem_mappable_aperture_size() / 2;
+
+		/* Power of two fence size, natural fence
+		 * alignment, and the guard page at the end
+		 * gtt means that if the entire gtt is
+		 * mappable, we can't usually fit in a tiled
+		 * object half the size of the gtt. Let's use
+		 * a quarter size one instead.
+		 */
+		if (tiling &&
+		    intel_gen(intel_get_drm_devid(fd)) < 4 &&
+		    size >= gem_aperture_size(fd) / 2)
+			size /= 2;
 		break;
 	case 0:
 		size = gem_mappable_aperture_size() + PAGE_SIZE;
Signature · 6 lines
2.4.10

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

Re: [PATCH i-g-t 4/7] tests/gem_mmap_gtt: Make the small-bo tiling tests work on old platforms

Quoted 8 lines · On Mon, Dec 14, 2015 at 10:15:53PM +0200, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Several factors conspire against us when trying to execute the tiled small-bo tests:
- pre-gen4 require power of two fences, with natural alignment
- the entire gtt may be mappable
- we put a guard page at the end of gtt

Quoted 8 lines

What all that means is that when we try to use a tiled object half the size of the mappable area, we can only fit it in the first half of the gtt. That leads to a SIGBUS when we try to fault in the object when there's already something (eg. fbdev) occupying the first half of gtt.

So in order to make the tests run on old machines, let's further halve the object size when things look too tight.

That defeats the point of the test. The idea is to have the two objects that just don't fit, but only just.
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#11 lore raw

Re: [PATCH i-g-t 4/7] tests/gem_mmap_gtt: Make the small-bo tiling tests work on old platforms

Quoted 15 lines · Chris Wilson
Quoted 14 lines · On Mon, Dec 14, 2015 at 10:15:53PM +0200, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Several factors conspire against us when trying to execute the tiled small-bo tests:
- pre-gen4 require power of two fences, with natural alignment
- the entire gtt may be mappable
- we put a guard page at the end of gtt

What all that means is that when we try to use a tiled object half the size of the mappable area, we can only fit it in the first half of the gtt. That leads to a SIGBUS when we try to fault in the object when there's already something (eg. fbdev) occupying the first half of gtt.

Quoted 5 lines
Quoted 2 lines

So in order to make the tests run on old machines, let's further halve the object size when things look too tight.

That defeats the point of the test. The idea is to have the two objects that just don't fit, but only just.

i.e. the test is meant to show that the kernel heuristics for using partial vma do not prevent the page-fault-of-doom. -Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#12 lore raw

Re: [PATCH i-g-t 4/7] tests/gem_mmap_gtt: Make the small-bo tiling tests work on old platforms

Quoted 16 lines · Chris Wilson
Quoted 15 lines · Chris Wilson
Quoted 14 lines · On Mon, Dec 14, 2015 at 10:15:53PM +0200, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Several factors conspire against us when trying to execute the tiled small-bo tests:
- pre-gen4 require power of two fences, with natural alignment
- the entire gtt may be mappable
- we put a guard page at the end of gtt

What all that means is that when we try to use a tiled object half the size of the mappable area, we can only fit it in the first half of the gtt. That leads to a SIGBUS when we try to fault in the object when there's already something (eg. fbdev) occupying the first half of gtt.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

So in order to make the tests run on old machines, let's further halve the object size when things look too tight.

That defeats the point of the test. The idea is to have the two objects that just don't fit, but only just.

i.e. the test is meant to show that the kernel heuristics for using partial vma do not prevent the page-fault-of-doom.

So just skip then?

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

Re: [PATCH i-g-t 4/7] tests/gem_mmap_gtt: Make the small-bo tiling tests work on old platforms

Quoted 20 lines · Ville Syrjälä
Quoted 19 lines · Chris Wilson
Quoted 18 lines · Chris Wilson
Quoted 16 lines · On Mon, Dec 14, 2015 at 10:15:53PM +0200, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Several factors conspire against us when trying to execute the tiled small-bo tests:
- pre-gen4 require power of two fences, with natural alignment
- the entire gtt may be mappable
- we put a guard page at the end of gtt

What all that means is that when we try to use a tiled object half the size of the mappable area, we can only fit it in the first half of the gtt. That leads to a SIGBUS when we try to fault in the object when there's already something (eg. fbdev) occupying the first half of gtt.

So in order to make the tests run on old machines, let's further halve the object size when things look too tight.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

That defeats the point of the test. The idea is to have the two objects that just don't fit, but only just.

i.e. the test is meant to show that the kernel heuristics for using partial vma do not prevent the page-fault-of-doom.

So just skip then?

The kernel has a bug that partial vma was supposed to address. In theory it can strike at any time (although userspace has a similar approach to try and not tempt fate). And other than a getparm "bug fixed", there won't be an ABI change for userspace to take note of.

I have ~237 patches ahead of my "make partial-vma actually work" fix. :| -Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#14 lore raw

Re: [PATCH i-g-t 4/7] tests/gem_mmap_gtt: Make the small-bo tiling tests work on old platforms

Quoted 24 lines · Chris Wilson
Quoted 23 lines · Ville Syrjälä
Quoted 22 lines · Chris Wilson
Quoted 20 lines · Chris Wilson
Quoted 8 lines · On Mon, Dec 14, 2015 at 10:15:53PM +0200, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Several factors conspire against us when trying to execute the tiled small-bo tests:
- pre-gen4 require power of two fences, with natural alignment
- the entire gtt may be mappable
- we put a guard page at the end of gtt

Quoted 8 lines

What all that means is that when we try to use a tiled object half the size of the mappable area, we can only fit it in the first half of the gtt. That leads to a SIGBUS when we try to fault in the object when there's already something (eg. fbdev) occupying the first half of gtt.

So in order to make the tests run on old machines, let's further halve the object size when things look too tight.

That defeats the point of the test. The idea is to have the two objects that just don't fit, but only just.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

i.e. the test is meant to show that the kernel heuristics for using partial vma do not prevent the page-fault-of-doom.

So just skip then?

The kernel has a bug that partial vma was supposed to address.

I'm not sure partial vma has any benefit in this case. Sure, you could them mmap the thing but unless we teach the GPU to also use partial mappings it won't do any good since we just can't fit the thing into the gtt.

Quoted 10 lines

In theory
it can strike at any time (although userspace has a similar approach to try and not tempt fate). And other than a getparm "bug fixed", there won't be an ABI change for userspace to take note of.

I have ~237 patches ahead of my "make partial-vma actually work" fix. :| -Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#15 lore raw

Re: [PATCH i-g-t 4/7] tests/gem_mmap_gtt: Make the small-bo tiling tests work on old platforms

Quoted 28 lines · Ville Syrjälä
Quoted 27 lines · Chris Wilson
Quoted 26 lines · Ville Syrjälä
Quoted 24 lines · Chris Wilson
Quoted 15 lines · Chris Wilson
Quoted 14 lines · On Mon, Dec 14, 2015 at 10:15:53PM +0200, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Several factors conspire against us when trying to execute the tiled small-bo tests:
- pre-gen4 require power of two fences, with natural alignment
- the entire gtt may be mappable
- we put a guard page at the end of gtt

What all that means is that when we try to use a tiled object half the size of the mappable area, we can only fit it in the first half of the gtt. That leads to a SIGBUS when we try to fault in the object when there's already something (eg. fbdev) occupying the first half of gtt.

Quoted 5 lines
Quoted 2 lines

So in order to make the tests run on old machines, let's further halve the object size when things look too tight.

That defeats the point of the test. The idea is to have the two objects that just don't fit, but only just.

i.e. the test is meant to show that the kernel heuristics for using partial vma do not prevent the page-fault-of-doom.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

So just skip then?

The kernel has a bug that partial vma was supposed to address.

I'm not sure partial vma has any benefit in this case. Sure, you could them mmap the thing but unless we teach the GPU to also use partial mappings it won't do any good since we just can't fit the thing into the gtt.

For gen2, not being able to fit into mappable is an issue for the GPU as well, sure. But for userspace being oblivious and *always* being able to use mmaping of a bo, it is a big deal. (Being oblivious helps with robustness in the stack, X/display-server-de-jour should not die just because of a resource conflict - now X should catch the fault and handle it, give or take bugs, avoiding that error path entirely is even better.)

Using "sparse" resources so that we can arbitrary sized objects is something I'd like. But we have so much "whole-object-at-once" baked into the code, it will be a challenge.
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#16 lore raw

Re: [PATCH i-g-t 4/7] tests/gem_mmap_gtt: Make the small-bo tiling tests work on old platforms

Quoted 38 lines · Chris Wilson
Quoted 28 lines · Ville Syrjälä
Quoted 27 lines · Chris Wilson
Quoted 26 lines · Ville Syrjälä
Quoted 24 lines · Chris Wilson
Quoted 15 lines · Chris Wilson
Quoted 14 lines · On Mon, Dec 14, 2015 at 10:15:53PM +0200, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Several factors conspire against us when trying to execute the tiled small-bo tests:
- pre-gen4 require power of two fences, with natural alignment
- the entire gtt may be mappable
- we put a guard page at the end of gtt

What all that means is that when we try to use a tiled object half the size of the mappable area, we can only fit it in the first half of the gtt. That leads to a SIGBUS when we try to fault in the object when there's already something (eg. fbdev) occupying the first half of gtt.

Quoted 5 lines
Quoted 2 lines

So in order to make the tests run on old machines, let's further halve the object size when things look too tight.

That defeats the point of the test. The idea is to have the two objects that just don't fit, but only just.

i.e. the test is meant to show that the kernel heuristics for using partial vma do not prevent the page-fault-of-doom.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

So just skip then?

The kernel has a bug that partial vma was supposed to address.

I'm not sure partial vma has any benefit in this case. Sure, you could them mmap the thing but unless we teach the GPU to also use partial mappings it won't do any good since we just can't fit the thing into the gtt.

Quoted 6 lines

For gen2, not being able to fit into mappable is an issue for the GPU as well, sure. But for userspace being oblivious and *always* being able to use mmaping of a bo, it is a big deal. (Being oblivious helps with robustness in the stack, X/display-server-de-jour should not die just because of a resource conflict - now X should catch the fault and handle it, give or take bugs, avoiding that error path entirely is even better.)

Yeah, I suppose it would be nice not to SIGBUS even if userspace is trying something a bit crazy. It would just get an error later from execbuf when trying to use the bo with the GPU. So I guess the right fix would be to fall back to partial vma if we fail to bind the full vma.

Quoted 8 lines

Using "sparse" resources so that we can arbitrary sized objects is something I'd like. But we have so much "whole-object-at-once" baked into the code, it will be a challenge.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#17 lore raw

Re: [PATCH i-g-t 4/7] tests/gem_mmap_gtt: Make the small-bo tiling tests work on old platforms

Quoted 46 lines · Ville Syrjälä
Quoted 38 lines · Chris Wilson
Quoted 28 lines · Ville Syrjälä
Quoted 27 lines · Chris Wilson
Quoted 26 lines · Ville Syrjälä
Quoted 24 lines · Chris Wilson
Quoted 15 lines · Chris Wilson
Quoted 14 lines · On Mon, Dec 14, 2015 at 10:15:53PM +0200, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Several factors conspire against us when trying to execute the tiled small-bo tests:
- pre-gen4 require power of two fences, with natural alignment
- the entire gtt may be mappable
- we put a guard page at the end of gtt

What all that means is that when we try to use a tiled object half the size of the mappable area, we can only fit it in the first half of the gtt. That leads to a SIGBUS when we try to fault in the object when there's already something (eg. fbdev) occupying the first half of gtt.

Quoted 5 lines
Quoted 2 lines

So in order to make the tests run on old machines, let's further halve the object size when things look too tight.

That defeats the point of the test. The idea is to have the two objects that just don't fit, but only just.

i.e. the test is meant to show that the kernel heuristics for using partial vma do not prevent the page-fault-of-doom.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

So just skip then?

The kernel has a bug that partial vma was supposed to address.

I'm not sure partial vma has any benefit in this case. Sure, you could them mmap the thing but unless we teach the GPU to also use partial mappings it won't do any good since we just can't fit the thing into the gtt.

Quoted 6 lines

For gen2, not being able to fit into mappable is an issue for the GPU as well, sure. But for userspace being oblivious and *always* being able to use mmaping of a bo, it is a big deal. (Being oblivious helps with robustness in the stack, X/display-server-de-jour should not die just because of a resource conflict - now X should catch the fault and handle it, give or take bugs, avoiding that error path entirely is even better.)

Quoted 5 lines

Yeah, I suppose it would be nice not to SIGBUS even if userspace is trying something a bit crazy. It would just get an error later from execbuf when trying to use the bo with the GPU. So I guess the right fix would be to fall back to partial vma if we fail to bind the full vma.

Hmm, actaully no. This was about tiled objects, and we don't do tiled+partial at all currently. Would need to teach the code to do that first.

Quoted 17 lines
Quoted 9 lines

Using "sparse" resources so that we can arbitrary sized objects is something I'd like. But we have so much "whole-object-at-once" baked into the code, it will be a challenge.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#18 lore raw

Re: [PATCH i-g-t 4/7] tests/gem_mmap_gtt: Make the small-bo tiling tests work on old platforms

Quoted 53 lines · Ville Syrjälä
Quoted 46 lines · Ville Syrjälä
Quoted 38 lines · Chris Wilson
Quoted 28 lines · Ville Syrjälä
Quoted 27 lines · Chris Wilson
Quoted 26 lines · Ville Syrjälä
Quoted 24 lines · Chris Wilson
Quoted 15 lines · Chris Wilson
Quoted 14 lines · On Mon, Dec 14, 2015 at 10:15:53PM +0200, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Several factors conspire against us when trying to execute the tiled small-bo tests:
- pre-gen4 require power of two fences, with natural alignment
- the entire gtt may be mappable
- we put a guard page at the end of gtt

What all that means is that when we try to use a tiled object half the size of the mappable area, we can only fit it in the first half of the gtt. That leads to a SIGBUS when we try to fault in the object when there's already something (eg. fbdev) occupying the first half of gtt.

Quoted 5 lines
Quoted 2 lines

So in order to make the tests run on old machines, let's further halve the object size when things look too tight.

That defeats the point of the test. The idea is to have the two objects that just don't fit, but only just.

i.e. the test is meant to show that the kernel heuristics for using partial vma do not prevent the page-fault-of-doom.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

So just skip then?

The kernel has a bug that partial vma was supposed to address.

I'm not sure partial vma has any benefit in this case. Sure, you could them mmap the thing but unless we teach the GPU to also use partial mappings it won't do any good since we just can't fit the thing into the gtt.

Quoted 6 lines

For gen2, not being able to fit into mappable is an issue for the GPU as well, sure. But for userspace being oblivious and *always* being able to use mmaping of a bo, it is a big deal. (Being oblivious helps with robustness in the stack, X/display-server-de-jour should not die just because of a resource conflict - now X should catch the fault and handle it, give or take bugs, avoiding that error path entirely is even better.)

Quoted 5 lines

Yeah, I suppose it would be nice not to SIGBUS even if userspace is trying something a bit crazy. It would just get an error later from execbuf when trying to use the bo with the GPU. So I guess the right fix would be to fall back to partial vma if we fail to bind the full vma.

Quoted 3 lines

Hmm, actaully no. This was about tiled objects, and we don't do tiled+partial at all currently. Would need to teach the code to do that first.

It's is one and the same fix ;) (Ok, same patchset!) -Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#19 lore raw

Re: [PATCH i-g-t 4/7] tests/gem_mmap_gtt: Make the small-bo tiling tests work on old platforms

Quoted 54 lines · Chris Wilson
Quoted 53 lines · Ville Syrjälä
Quoted 51 lines · Ville Syrjälä
Quoted 38 lines · Chris Wilson
Quoted 28 lines · Ville Syrjälä
Quoted 27 lines · Chris Wilson
Quoted 26 lines · Ville Syrjälä
Quoted 24 lines · Chris Wilson
Quoted 15 lines · Chris Wilson
Quoted 14 lines · On Mon, Dec 14, 2015 at 10:15:53PM +0200, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Several factors conspire against us when trying to execute the tiled small-bo tests:
- pre-gen4 require power of two fences, with natural alignment
- the entire gtt may be mappable
- we put a guard page at the end of gtt

What all that means is that when we try to use a tiled object half the size of the mappable area, we can only fit it in the first half of the gtt. That leads to a SIGBUS when we try to fault in the object when there's already something (eg. fbdev) occupying the first half of gtt.

Quoted 5 lines
Quoted 2 lines

So in order to make the tests run on old machines, let's further halve the object size when things look too tight.

That defeats the point of the test. The idea is to have the two objects that just don't fit, but only just.

i.e. the test is meant to show that the kernel heuristics for using partial vma do not prevent the page-fault-of-doom.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

So just skip then?

The kernel has a bug that partial vma was supposed to address.

I'm not sure partial vma has any benefit in this case. Sure, you could them mmap the thing but unless we teach the GPU to also use partial mappings it won't do any good since we just can't fit the thing into the gtt.

Quoted 6 lines

For gen2, not being able to fit into mappable is an issue for the GPU as well, sure. But for userspace being oblivious and *always* being able to use mmaping of a bo, it is a big deal. (Being oblivious helps with robustness in the stack, X/display-server-de-jour should not die just because of a resource conflict - now X should catch the fault and handle it, give or take bugs, avoiding that error path entirely is even better.)

Yeah, I suppose it would be nice not to SIGBUS even if userspace is trying something a bit crazy. It would just get an error later from execbuf when trying to use the bo with the GPU. So I guess the right fix would be to fall back to partial vma if we fail to bind the full vma.

Quoted 5 lines
Quoted 3 lines

Hmm, actaully no. This was about tiled objects, and we don't do tiled+partial at all currently. Would need to teach the code to do that first.

It's is one and the same fix ;) (Ok, same patchset!)

Yeah the problem is that partial views are stuck half-implemented, and seem to not move forward.

I'd just skip on gen2/3 tbh.
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#20 lore raw

Re: [PATCH i-g-t 4/7] tests/gem_mmap_gtt: Make the small-bo tiling tests work on old platforms

Quoted 59 lines · Daniel Vetter
Quoted 58 lines · Chris Wilson
Quoted 56 lines · Ville Syrjälä
Quoted 46 lines · Ville Syrjälä
Quoted 38 lines · Chris Wilson
Quoted 28 lines · Ville Syrjälä
Quoted 27 lines · Chris Wilson
Quoted 26 lines · Ville Syrjälä
Quoted 24 lines · Chris Wilson
Quoted 15 lines · Chris Wilson
Quoted 14 lines · On Mon, Dec 14, 2015 at 10:15:53PM +0200, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Several factors conspire against us when trying to execute the tiled small-bo tests:
- pre-gen4 require power of two fences, with natural alignment
- the entire gtt may be mappable
- we put a guard page at the end of gtt

What all that means is that when we try to use a tiled object half the size of the mappable area, we can only fit it in the first half of the gtt. That leads to a SIGBUS when we try to fault in the object when there's already something (eg. fbdev) occupying the first half of gtt.

Quoted 5 lines
Quoted 2 lines

So in order to make the tests run on old machines, let's further halve the object size when things look too tight.

That defeats the point of the test. The idea is to have the two objects that just don't fit, but only just.

i.e. the test is meant to show that the kernel heuristics for using partial vma do not prevent the page-fault-of-doom.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

So just skip then?

The kernel has a bug that partial vma was supposed to address.

I'm not sure partial vma has any benefit in this case. Sure, you could them mmap the thing but unless we teach the GPU to also use partial mappings it won't do any good since we just can't fit the thing into the gtt.

Quoted 6 lines

For gen2, not being able to fit into mappable is an issue for the GPU as well, sure. But for userspace being oblivious and *always* being able to use mmaping of a bo, it is a big deal. (Being oblivious helps with robustness in the stack, X/display-server-de-jour should not die just because of a resource conflict - now X should catch the fault and handle it, give or take bugs, avoiding that error path entirely is even better.)

Quoted 5 lines

Yeah, I suppose it would be nice not to SIGBUS even if userspace is trying something a bit crazy. It would just get an error later from execbuf when trying to use the bo with the GPU. So I guess the right fix would be to fall back to partial vma if we fail to bind the full vma.

Hmm, actaully no. This was about tiled objects, and we don't do tiled+partial at all currently. Would need to teach the code to do that first.

Quoted 6 lines
Quoted 1 line

It's is one and the same fix ;) (Ok, same patchset!)

Yeah the problem is that partial views are stuck half-implemented, and seem to not move forward.

I'd just skip on gen2/3 tbh.

Oh, this is small-bo. Sorry for the digression. medium-bo is to exploit the page-fault-of-doom. small-bo is the one that is meant to always work.

In that context, reducing the size of the small bo (just not to a single page!) would be fine. And tiny-bo can be one page!
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#21 lore raw

PATCH 5/7 lib/debugfs: Read the crc frame counter as hex

In reply to [email protected]

From: Ville Syrjälä <[email protected]>

With the kernel fixed to dump out the crc frame counts in hex, we must follow suit.

---
 lib/igt_debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/igt_debugfs.c +1 -1
index 2c3b1cfe2370..5e71f50d7326 100644
@@ -484,7 +484,7 @@ static bool pipe_crc_init_from_string(igt_crc_t *crc, const char *line)
 	int n;
 
 	crc->n_words = 5;
-	n = sscanf(line, "%8u %8x %8x %8x %8x %8x", &crc->frame, &crc->crc[0],
+	n = sscanf(line, "%8x %8x %8x %8x %8x %8x", &crc->frame, &crc->crc[0],
 		   &crc->crc[1], &crc->crc[2], &crc->crc[3], &crc->crc[4]);
 	return n == 6;
 }
Signature · 6 lines
2.4.10

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

Re: [PATCH i-g-t 5/7] lib/debugfs: Read the crc frame counter as hex

Quoted 21 lines

-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf Of [email protected]
Sent: Monday, December 14, 2015 8:16 PM
To: [email protected]
Subject: [Intel-gfx] [PATCH i-g-t 5/7] lib/debugfs: Read the crc frame counter as hex

From: Ville Syrjälä <[email protected]>

With the kernel fixed to dump out the crc frame counts in hex, we must follow suit.

---
lib/igt_debugfs.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)

lib/igt_debugfs.c static bool pipe_crc_init_from_string(igt_crc_t *crc, const char *line) · line 487

Quoted 5 lines
lib/igt_debugfs.c +1 -1
@@ -484,7 +484,7 @@ static bool pipe_crc_init_from_string(igt_crc_t *crc, const char *line)
 	int n;
 
 	crc->n_words = 5;
-	n = sscanf(line, "%8u %8x %8x %8x %8x %8x", &crc->frame, &crc->crc[0],
+	n = sscanf(line, "%8x %8x %8x %8x %8x %8x", &crc->frame, &crc->crc[0],

What will happen for kernels that have not been 'fixed'? Android is always behind drm_nightly. Is there any way of knowing whether this value is in hex or decimal and read it accordingly? What tests will be affected if this is wrong?

//Derek

Quoted 11 lines
lib/igt_debugfs.c +0 -1
 		   &crc->crc[1], &crc->crc[2], &crc->crc[3], &crc->crc[4]);
 	return n == 6;
 }
--

2.4.10

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#23 lore raw

Re: [PATCH i-g-t 5/7] lib/debugfs: Read the crc frame counter as hex

Quoted 23 lines · Derek J
Quoted 23 lines

-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf Of [email protected]
Sent: Monday, December 14, 2015 8:16 PM
To: [email protected]
Subject: [Intel-gfx] [PATCH i-g-t 5/7] lib/debugfs: Read the crc frame counter as hex

From: Ville Syrjälä <[email protected]>

With the kernel fixed to dump out the crc frame counts in hex, we must follow suit.

---
lib/igt_debugfs.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
lib/igt_debugfs.c +0 -0
@@ -484,7 +484,7 @@ static bool pipe_crc_init_from_string(igt_crc_t *crc, const char *line)
 	int n;
 
Quoted 5 lines

lib/igt_debugfs.c static bool pipe_crc_init_from_string(igt_crc_t *crc, const char *line) · line 487

Quoted 3 lines
lib/igt_debugfs.c +1 -1
 	crc->n_words = 5;
-	n = sscanf(line, "%8u %8x %8x %8x %8x %8x", &crc->frame, &crc->crc[0],
+	n = sscanf(line, "%8x %8x %8x %8x %8x %8x", &crc->frame, &crc->crc[0],

What will happen for kernels that have not been 'fixed'? Android is always behind drm_nightly. Is there any way of knowing whether this value is in hex or decimal and read it accordingly? What tests will be affected if this is wrong?

You might know if it's hex if the number happes to have a-f in it. Othwerwise you can't tell since we don't use a 0x prefix.

Another option is to fix the size assumptions about the string on both kernel and igt side.

And a third option would be to have the kernel return 'count & 0xffffff' which would fit in the 8 characters allotted. igt wouldn't need to be changed in this case. That might actually make some sense since on gen3/4 the hw frame counter is only 24 bits. If userspace would have to deal with wraparound it could just assume that it occurs at 2^24. Actually now that I think about the current tests are probably broken if the counter wraps sooner than 2^32. But since the interface can't even carry such large frame counter numbers the test will simply fail in other ways until the kernel gets fixed.

Quoted 14 lines

//Derek

Quoted 11 lines
lib/igt_debugfs.c +0 -1
 		   &crc->crc[1], &crc->crc[2], &crc->crc[3], &crc->crc[4]);
 	return n == 6;
 }
--

2.4.10

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

PATCH 6/7 tests/kms_flip: Increase TEST_TS_CONT max seq difference to 150

In reply to [email protected]

From: Ville Syrjälä <[email protected]>

During suspend tests we can exceed the current 100 frame difference in sequence numbers. Bump the limit to 150 frames.

---
 tests/kms_flip.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/kms_flip.c +2 -2
index 750a1882dc3c..0dae83046b20 100644
@@ -674,9 +674,9 @@ static void check_state(struct test_output *o, struct event_state *es)
 		igt_assert_f(es->current_seq - es->last_seq >= 0,
 			     "unexpected %s seq %u, should be >= %u\n",
 			     es->name, es->current_seq, es->last_seq);
-		igt_assert_f(es->current_seq - es->last_seq <= 100,
+		igt_assert_f(es->current_seq - es->last_seq <= 150,
 			     "unexpected %s seq %u, should be < %u\n",
-			     es->name, es->current_seq, es->last_seq + 100);
+			     es->name, es->current_seq, es->last_seq + 150);
 
 		igt_debug("testing ts continuity: Current frame %u, old frame %u\n",
 			  es->current_seq, es->last_seq);
Signature · 6 lines
2.4.10

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

Re: [PATCH i-g-t 6/7] tests/kms_flip: Increase TEST_TS_CONT max seq difference to 150

Quoted 6 lines · On Mon, Dec 14, 2015 at 10:15:55PM +0200, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

During suspend tests we can exceed the current 100 frame difference in sequence numbers. Bump the limit to 150 frames.

I'd bump a lot more tbh, or maybe check for system suspend/resume and then bump to 1000, otherwise leave at 100.
-Daniel

Quoted 27 lines
---
 tests/kms_flip.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/kms_flip.c +2 -2
index 750a1882dc3c..0dae83046b20 100644
@@ -674,9 +674,9 @@ static void check_state(struct test_output *o, struct event_state *es)
 		igt_assert_f(es->current_seq - es->last_seq >= 0,
 			     "unexpected %s seq %u, should be >= %u\n",
 			     es->name, es->current_seq, es->last_seq);
-		igt_assert_f(es->current_seq - es->last_seq <= 100,
+		igt_assert_f(es->current_seq - es->last_seq <= 150,
 			     "unexpected %s seq %u, should be < %u\n",
-			     es->name, es->current_seq, es->last_seq + 100);
+			     es->name, es->current_seq, es->last_seq + 150);
 
 		igt_debug("testing ts continuity: Current frame %u, old frame %u\n",
 			  es->current_seq, es->last_seq);
Signature · 6 lines
2.4.10

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#26 lore raw

PATCH 7/7 tests/kms_pipe_crc_basic: Use igt_assert_eq() to see the failing frame counts

In reply to [email protected]

From: Ville Syrjälä <[email protected]>

Use igt_assert_eq() to compare the frame numbers during the frame sequence tests so that we'll see exactly what the bad frame counts are when the test fails.

---
 tests/kms_pipe_crc_basic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/kms_pipe_crc_basic.c +1 -1
index a3292c225203..bfb14780fa72 100644
@@ -176,7 +176,7 @@ test_read_crc_for_output(data_t *data, int pipe, igt_output_t *output,
 
 		if (flags & TEST_SEQUENCE)
 			for (j = 0; j < (N_CRCS - 1); j++)
-				igt_assert(crcs[j].frame + 1 == crcs[j + 1].frame);
+				igt_assert_eq(crcs[j].frame + 1, crcs[j + 1].frame);
 
 		free(crcs);
 		igt_pipe_crc_free(pipe_crc);
Signature · 6 lines
2.4.10

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx