Skip to contentSkip to conversation

test/kms_plane_lowres: Fix display_commit_mode() so it returns the crc

PATCH In review Maarten Lankhorst 4 participants 5 messages Dec 13, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test/kms_plane_lowres: Fix display_commit_mode() so it returns the crc

From: Arkadiusz Hiler <[email protected]>

Compiler complained on crc_lowres and crc_hires2 being uninitialized and indeed, display_commit_mode() seems to have intention of retruning the value through the parameter that is only a single pointer.

This couses only the local copy of the pointer, the one inside display_commit_mode(), to be overwritten.

Let's fix that!

Also add missing hires crc comparison (M. Kahola).

v2: make display_commit_mode return just the last CRC
v3: Don't do memory allocations, it's hard. (Maarten)
v4: Use igt_pipe_crc_collect_crc() instead, cleans up crc handling a lot.

---
 tests/kms_plane_lowres.c | 36 ++++++++++++------------------------
 1 file changed, 12 insertions(+), 24 deletions(-)
tests/kms_plane_lowres.c +12 -24
index 85d3145de4b6..c224a1bf7026 100644
@@ -125,17 +125,12 @@ test_fini(data_t *data, igt_output_t *output, enum pipe pipe)
 	data->fb = NULL;
 }
 
-static int
+static void
 display_commit_mode(igt_display_t *display, igt_pipe_crc_t *pipe_crc,
-		    enum pipe pipe, int flags, igt_crc_t *crc)
+		    enum pipe pipe, int flags, igt_crc_t *out_crc)
 {
 	char buf[256];
-	struct drm_event *e = (void *)buf;
-	unsigned int vblank_start, vblank_stop;
-	int n, ret;
-
-	vblank_start = kmstest_get_vblank(display->drm_fd, pipe,
-					  DRM_VBLANK_NEXTONMISS);
+	int ret;
 
 	ret = igt_display_try_commit_atomic(display, flags, NULL);
 	igt_skip_on(ret != 0);
@@ -144,14 +139,7 @@ display_commit_mode(igt_display_t *display, igt_pipe_crc_t *pipe_crc,
 	ret = read(display->drm_fd, buf, sizeof(buf));
 	igt_assert(ret >= 0);
 
-	vblank_stop = kmstest_get_vblank(display->drm_fd, pipe, 0);
-	igt_assert_eq(e->type, DRM_EVENT_FLIP_COMPLETE);
-	igt_reset_timeout();
-
-	n = igt_pipe_crc_get_crcs(pipe_crc, vblank_stop - vblank_start, &crc);
-	igt_assert_eq(n, vblank_stop - vblank_start);
-
-	return n;
+	igt_pipe_crc_collect_crc(pipe_crc, out_crc);
 }
 
 static void
@@ -218,11 +206,11 @@ static void
 test_plane_position_with_output(data_t *data, enum pipe pipe,
 				igt_output_t *output, uint64_t modifier)
 {
-	igt_crc_t *crc_hires1, *crc_hires2;
-	igt_crc_t *crc_lowres;
+	igt_crc_t crc_hires1, crc_hires2;
+	igt_crc_t crc_lowres;
 	drmModeModeInfo mode_lowres;
 	drmModeModeInfo *mode1, *mode2, *mode3;
-	int ret, n;
+	int ret;
 	int flags = DRM_MODE_PAGE_FLIP_EVENT | DRM_MODE_ATOMIC_ALLOW_MODESET;
 	igt_pipe_crc_t *pipe_crc;
 
@@ -237,10 +225,8 @@ test_plane_position_with_output(data_t *data, enum pipe pipe,
 	igt_skip_on(ret != 0);
 
 	pipe_crc = igt_pipe_crc_new(data->drm_fd, pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
-	igt_pipe_crc_start(pipe_crc);
 
-	n = igt_pipe_crc_get_crcs(pipe_crc, 1, &crc_hires1);
-	igt_assert_eq(1, n);
+	igt_pipe_crc_collect_crc(pipe_crc, &crc_hires1);
 
 	igt_assert_plane_visible(data->drm_fd, pipe, true);
 
@@ -252,7 +238,7 @@ test_plane_position_with_output(data_t *data, enum pipe pipe,
 
 	check_mode(&mode_lowres, mode2);
 
-	display_commit_mode(&data->display, pipe_crc, pipe, flags, crc_lowres);
+	display_commit_mode(&data->display, pipe_crc, pipe, flags, &crc_lowres);
 
 	igt_assert_plane_visible(data->drm_fd, pipe, false);
 
@@ -264,10 +250,12 @@ test_plane_position_with_output(data_t *data, enum pipe pipe,
 
 	check_mode(mode1, mode3);
 
-	display_commit_mode(&data->display, pipe_crc, pipe, flags, crc_hires2);
+	display_commit_mode(&data->display, pipe_crc, pipe, flags, &crc_hires2);
 
 	igt_assert_plane_visible(data->drm_fd, pipe, true);
 
+	igt_assert_crc_equal(&crc_hires1, &crc_hires2);
+
 	igt_pipe_crc_stop(pipe_crc);
 	igt_pipe_crc_free(pipe_crc);
 
Signature · 6 lines
2.15.1

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

✓ Fi.CI.BAT: success for test/kms_plane_lowres: Fix display_commit_mode() so it returns the crc (rev4)

== Series Details ==

== Series Details ==

Series: test/kms_plane_lowres: Fix display_commit_mode() so it returns the crc (rev4)
URL : https://patchwork.freedesktop.org/series/34749/
State : success

== Summary ==

IGT patchset tested on top of latest successful build 74407418720ff7a9de7caabec05d4c3afe9a5c51 igt/kms_flip: Allow very large bo to fail pageflips with E2BIG

with latest DRM-Tip kernel build CI_DRM_3503
8874c0f95698 drm-tip: 2017y-12m-12d-21h-34m-33s UTC integration manifest

No testlist changes.

Test gem_mmap_gtt:

        Subgroup basic-small-bo-tiledx:
                pass       -> FAIL       (fi-gdg-551) fdo#102575

fdo#102575 https://bugs.freedesktop.org/show_bug.cgi?id=102575

fi-bdw-5557u     total:288  pass:267  dwarn:0   dfail:0   fail:0   skip:21  time:438s
fi-bdw-gvtdvm    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:444s
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:382s
fi-bsw-n3050     total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  time:516s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:281s
fi-bxt-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:506s
fi-bxt-j4205     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:508s
fi-byt-j1900     total:288  pass:253  dwarn:0   dfail:0   fail:0   skip:35  time:487s
fi-byt-n2820     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:475s
fi-elk-e7500     total:224  pass:163  dwarn:15  dfail:0   fail:0   skip:45 
fi-gdg-551       total:288  pass:178  dwarn:1   dfail:0   fail:1   skip:108 time:271s
fi-glk-1         total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:542s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:375s
fi-hsw-4770r     total:288  pass:224  dwarn:0   dfail:0   fail:0   skip:64  time:260s
fi-ilk-650       total:288  pass:228  dwarn:0   dfail:0   fail:0   skip:60  time:391s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:479s
fi-ivb-3770      total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:449s
fi-kbl-7500u     total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:493s
fi-kbl-7560u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:528s
fi-kbl-7567u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:473s
fi-kbl-r         total:288  pass:260  dwarn:1   dfail:0   fail:0   skip:27  time:536s
fi-pnv-d510      total:288  pass:222  dwarn:1   dfail:0   fail:0   skip:65  time:592s
fi-skl-6260u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:453s
fi-skl-6600u     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:546s
fi-skl-6700hq    total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:572s
fi-skl-6700k     total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:513s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:494s
fi-skl-gvtdvm    total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:444s
fi-snb-2520m     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:550s
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:419s
Blacklisted hosts:
fi-cfl-s2        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:602s
fi-cnl-y         total:216  pass:195  dwarn:0   dfail:0   fail:0   skip:20 
fi-glk-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:489s

== Logs ==

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

Reviewed-by on v1 1/1
#2 lore raw
In reply to Maarten Lankhorst
Quoted 14 lines · Maarten Lankhorst

From: Arkadiusz Hiler <[email protected]>

Compiler complained on crc_lowres and crc_hires2 being uninitialized and indeed, display_commit_mode() seems to have intention of retruning
the value through the parameter that is only a single pointer.

This couses only the local copy of the pointer, the one inside display_commit_mode(), to be overwritten.

Let's fix that!

Also add missing hires crc comparison (M. Kahola).

Quoted 7 lines

v2: make display_commit_mode return just the last CRC
v3: Don't do memory allocations, it's hard. (Maarten)
v4: Use igt_pipe_crc_collect_crc() instead, cleans up crc handling a lot.

Cc Mika Kahola <[email protected]>
Cc Maarten Lankhorst <[email protected]>

With typo s/couses/causes/ fixed this is

Quoted 111 lines

---
 tests/kms_plane_lowres.c | 36 ++++++++++++------------------------

 1 file changed, 12 insertions(+), 24 deletions(-)
tests/kms_plane_lowres.c +0 -0
index 85d3145de4b6..c224a1bf7026 100644
@@ -125,17 +125,12 @@ test_fini(data_t *data, igt_output_t *output,
 enum pipe pipe)
  	data->fb = NULL;
  }

tests/kms_plane_lowres.c +1 -1
-static int
+static void

 display_commit_mode(igt_display_t *display, igt_pipe_crc_t *pipe_crc,

tests/kms_plane_lowres.c +1 -1
-		    enum pipe pipe, int flags, igt_crc_t *crc)
+		    enum pipe pipe, int flags, igt_crc_t *out_crc)

 {
  char buf[256];

tests/kms_plane_lowres.c +1 -6
-	struct drm_event *e = (void *)buf;
-	unsigned int vblank_start, vblank_stop;
-	int n, ret;
-
-	vblank_start = kmstest_get_vblank(display->drm_fd, pipe,
-					  DRM_VBLANK_NEXTONMISS);
+	int ret;


  ret = igt_display_try_commit_atomic(display, flags, NULL); igt_skip_on(ret != 0);

tests/kms_plane_lowres.c +0 -0
@@ -144,14 +139,7 @@ display_commit_mode(igt_display_t *display,
 igt_pipe_crc_t *pipe_crc,
  	ret = read(display->drm_fd, buf, sizeof(buf));
  	igt_assert(ret >= 0);

tests/kms_plane_lowres.c +0 -5
-	vblank_stop = kmstest_get_vblank(display->drm_fd, pipe, 0);
-	igt_assert_eq(e->type, DRM_EVENT_FLIP_COMPLETE);
-	igt_reset_timeout();
-
-	n = igt_pipe_crc_get_crcs(pipe_crc, vblank_stop -

vblank_start, &crc);

tests/kms_plane_lowres.c +1 -3
-	igt_assert_eq(n, vblank_stop - vblank_start);
-
-	return n;
+	igt_pipe_crc_collect_crc(pipe_crc, out_crc);

 }

 static void

tests/kms_plane_lowres.c +0 -0
@@ -218,11 +206,11 @@ static void
  test_plane_position_with_output(data_t *data, enum pipe pipe,

  igt_output_t *output, uint64_t modifier)
 {

tests/kms_plane_lowres.c +2 -2
-	igt_crc_t *crc_hires1, *crc_hires2;
-	igt_crc_t *crc_lowres;
+	igt_crc_t crc_hires1, crc_hires2;
+	igt_crc_t crc_lowres;

  drmModeModeInfo mode_lowres;
  drmModeModeInfo *mode1, *mode2, *mode3;

tests/kms_plane_lowres.c +1 -1
-	int ret, n;
+	int ret;

  int flags = DRM_MODE_PAGE_FLIP_EVENT |
DRM_MODE_ATOMIC_ALLOW_MODESET;
  igt_pipe_crc_t *pipe_crc;

tests/kms_plane_lowres.c +0 -0
@@ -237,10 +225,8 @@ test_plane_position_with_output(data_t *data,
 enum pipe pipe,
  	igt_skip_on(ret != 0);


  pipe_crc = igt_pipe_crc_new(data->drm_fd, pipe, INTEL_PIPE_CRC_SOURCE_AUTO);

tests/kms_plane_lowres.c +0 -1
-	igt_pipe_crc_start(pipe_crc);

tests/kms_plane_lowres.c +1 -2
-	n = igt_pipe_crc_get_crcs(pipe_crc, 1, &crc_hires1);
-	igt_assert_eq(1, n);
+	igt_pipe_crc_collect_crc(pipe_crc, &crc_hires1);


  igt_assert_plane_visible(data->drm_fd, pipe, true);

tests/kms_plane_lowres.c +0 -0
@@ -252,7 +238,7 @@ test_plane_position_with_output(data_t *data,
 enum pipe pipe,


  check_mode(&mode_lowres, mode2);

tests/kms_plane_lowres.c +0 -1
-	display_commit_mode(&data->display, pipe_crc, pipe, flags,

crc_lowres);

tests/kms_plane_lowres.c +1 -0
+	display_commit_mode(&data->display, pipe_crc, pipe, flags,

&crc_lowres);

  igt_assert_plane_visible(data->drm_fd, pipe, false);

tests/kms_plane_lowres.c +0 -0
@@ -264,10 +250,12 @@ test_plane_position_with_output(data_t *data,
 enum pipe pipe,


  check_mode(mode1, mode3);

tests/kms_plane_lowres.c +0 -1
-	display_commit_mode(&data->display, pipe_crc, pipe, flags,

crc_hires2);

tests/kms_plane_lowres.c +1 -0
+	display_commit_mode(&data->display, pipe_crc, pipe, flags,

&crc_hires2);

  igt_assert_plane_visible(data->drm_fd, pipe, true);

tests/kms_plane_lowres.c +2 -0
+	igt_assert_crc_equal(&crc_hires1, &crc_hires2);
+

  igt_pipe_crc_stop(pipe_crc);
  igt_pipe_crc_free(pipe_crc);

Signature · 6 lines
Mika Kahola - Intel OTC

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

✗ Fi.CI.IGT: warning for test/kms_plane_lowres: Fix display_commit_mode() so it returns the crc (rev4)

In reply to Maarten Lankhorst
== Series Details ==

== Series Details ==

Series: test/kms_plane_lowres: Fix display_commit_mode() so it returns the crc (rev4)
URL : https://patchwork.freedesktop.org/series/34749/
State : warning

== Summary ==

Test pm_rc6_residency:

        Subgroup rc6-accuracy:
                pass       -> SKIP       (shard-snb)
Test gem_tiled_swapping:
        Subgroup non-threaded:
                incomplete -> PASS       (shard-snb) fdo#104009
Test gem_pwrite:
        Subgroup huge-gtt-backwards:
                incomplete -> PASS       (shard-hsw) fdo#104218
Test gem_softpin:
        Subgroup noreloc-s4:
                fail       -> SKIP       (shard-snb) fdo#103375
Test kms_frontbuffer_tracking:
        Subgroup fbc-1p-offscren-pri-shrfb-draw-render:
                pass       -> FAIL       (shard-snb) fdo#101623 +1

fdo#104009 https://bugs.freedesktop.org/show_bug.cgi?id=104009
fdo#104218 https://bugs.freedesktop.org/show_bug.cgi?id=104218
fdo#103375 https://bugs.freedesktop.org/show_bug.cgi?id=103375
fdo#101623 https://bugs.freedesktop.org/show_bug.cgi?id=101623

shard-hsw        total:2712 pass:1537 dwarn:1   dfail:0   fail:10  skip:1164 time:9509s
shard-snb        total:2712 pass:1307 dwarn:1   dfail:0   fail:12  skip:1392 time:8071s
Blacklisted hosts:
shard-apl        total:2712 pass:1688 dwarn:1   dfail:0   fail:22  skip:1001 time:13952s
shard-kbl        total:2712 pass:1808 dwarn:1   dfail:0   fail:24  skip:879 time:11134s

== Logs ==

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

#4 lore raw

Re: ✗ Fi.CI.IGT: warning for test/kms_plane_lowres: Fix display_commit_mode() so it returns the crc (rev4)

Quoted 9 lines · Patchwork

== Series Details ==

Series: test/kms_plane_lowres: Fix display_commit_mode() so it returns the crc (rev4)
URL : https://patchwork.freedesktop.org/series/34749/
State : warning

== Summary ==

Test pm_rc6_residency:

Quoted 14 lines
        Subgroup rc6-accuracy:
                pass       -> SKIP       (shard-snb)
Test gem_tiled_swapping:
        Subgroup non-threaded:
                incomplete -> PASS       (shard-snb) fdo#104009
Test gem_pwrite:
        Subgroup huge-gtt-backwards:
                incomplete -> PASS       (shard-hsw) fdo#104218
Test gem_softpin:
        Subgroup noreloc-s4:
                fail       -> SKIP       (shard-snb) fdo#103375
Test kms_frontbuffer_tracking:
        Subgroup fbc-1p-offscren-pri-shrfb-draw-render:
                pass       -> FAIL       (shard-snb) fdo#101623 +1

Okay, finally it's all green on kms_plane_lowres and the tests does what it was intended to do.

Thanks for improving on the original patch, the feedback and the reviews.

This is now merged with the typos corrected.

Signature · 6 lines
Cheers,
Arek
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx