Skip to contentSkip to conversation

lib/igt_debugfs: Fix igt_pipe_get_crcs.

PATCH In review Maarten Lankhorst 4 participants 7 messages Feb 15, 2018 – Feb 20, 2018 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 lib/igt_debugfs: Fix igt_pipe_get_crcs.

read_crc returns an error instead of 0 on timeout now, so handle this correctly. This is a small error introduced in

commit 7d48c0252c384d18318de89c54817bdfe9c832fc

Author: Maarten Lankhorst <[email protected]>
Date:   Fri Feb 2 13:34:25 2018 +0100

lib/igt_debugfs: Add igt_pipe_crc_get_single and igt_pipe_crc_drain, v4.

It causes the kms_chv_cursor_fail to take 27 minutes, so fix this..

---
 lib/igt_debugfs.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
lib/igt_debugfs.c +3 -2
index e2b15f9bda0b..4a119985f102 100644
@@ -794,10 +794,11 @@ igt_pipe_crc_get_crcs(igt_pipe_crc_t *pipe_crc, int n_crcs,
 		int ret;
 
 		ret = read_crc(pipe_crc, crc);
+		if (ret == -EAGAIN)
+			break;
+
 		if (ret < 0)
 			continue;
-		if (ret == 0)
-			break;
 
 		n++;
 	} while (n < n_crcs);
Signature · 6 lines
2.16.1

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

PATCH 2/2 tests/kms_chv_cursor_fail: Use igt_display_reset() and igt_pipe_crc_drain()

This reduces the amount of state to reset on each preparation, and allows us to keep CRC enabled. With 2 outputs on KBL the test time goes from approximately 9.2s to 7s on KBL.

---
 tests/kms_chv_cursor_fail.c | 60 ++++++++++++++-------------------------------
 1 file changed, 18 insertions(+), 42 deletions(-)
tests/kms_chv_cursor_fail.c +18 -42
index 1bcf8469088e..ffbe39d0c41b 100644
@@ -60,15 +60,6 @@ enum {
 	EDGE_BOTTOM = 0x8,
 };
 
-static void cursor_disable(data_t *data)
-{
-	igt_output_t *output = data->output;
-	igt_plane_t *cursor;
-
-	cursor = igt_output_get_plane_type(output, DRM_PLANE_TYPE_CURSOR);
-	igt_plane_set_fb(cursor, NULL);
-}
-
 static void create_cursor_fb(data_t *data, int cur_w, int cur_h)
 {
 	cairo_t *cr;
@@ -123,7 +114,7 @@ static void test_edge_pos(data_t *data, int sx, int ex, int y, bool swap_axis)
 
 	dx = (ex - sx)/XSTEP;
 
-	igt_pipe_crc_start(data->pipe_crc);
+	igt_pipe_crc_drain(data->pipe_crc);
 
 	i = 0;
 
@@ -154,7 +145,6 @@ static void test_edge_pos(data_t *data, int sx, int ex, int y, bool swap_axis)
 	}
 
 	n = igt_pipe_crc_get_crcs(data->pipe_crc, NCRC, &crc);
-	igt_pipe_crc_stop(data->pipe_crc);
 
 	if (!data->colored) {
 		igt_debug("Checking CRCs: ");
@@ -225,15 +215,27 @@ static void test_edges(data_t *data, unsigned int edges)
 	}
 }
 
+static void cleanup_crtc(data_t *data)
+{
+	igt_display_t *display = &data->display;
+
+	igt_display_reset(display);
+	igt_pipe_crc_free(data->pipe_crc);
+	data->pipe_crc = NULL;
+
+	igt_remove_fb(data->drm_fd, &data->primary_fb);
+}
+
 static void prepare_crtc(data_t *data)
 {
 	drmModeModeInfo *mode;
 	igt_display_t *display = &data->display;
 	igt_plane_t *primary;
 
+	cleanup_crtc(data);
+
 	/* select the pipe we want to use */
 	igt_output_set_pipe(data->output, data->pipe);
-	cursor_disable(data);
 
 	mode = igt_output_get_mode(data->output);
 	igt_create_pattern_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
@@ -250,37 +252,12 @@ static void prepare_crtc(data_t *data)
 	data->jump_y = (mode->vdisplay - data->curh) / 2;
 
 	/* create the pipe_crc object for this pipe */
-	if (data->pipe_crc)
-		igt_pipe_crc_free(data->pipe_crc);
-
 	data->pipe_crc = igt_pipe_crc_new_nonblock(data->drm_fd, data->pipe,
 						   INTEL_PIPE_CRC_SOURCE_AUTO);
 
-	/* make sure cursor is disabled */
-	cursor_disable(data);
-	igt_wait_for_vblank(data->drm_fd, data->pipe);
-
 	/* get reference crc w/o cursor */
-	igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
-	igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
-	igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
-}
-
-static void cleanup_crtc(data_t *data)
-{
-	igt_display_t *display = &data->display;
-	igt_plane_t *primary;
-
-	igt_pipe_crc_free(data->pipe_crc);
-	data->pipe_crc = NULL;
-
-	igt_remove_fb(data->drm_fd, &data->primary_fb);
-
-	primary = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_PRIMARY);
-	igt_plane_set_fb(primary, NULL);
-
-	igt_output_set_pipe(data->output, PIPE_ANY);
-	igt_display_commit(display);
+	igt_pipe_crc_start(data->pipe_crc);
+	igt_assert(igt_pipe_crc_get_single(data->pipe_crc, &data->ref_crc));
 }
 
 static void test_crtc(data_t *data, unsigned int edges)
@@ -288,6 +265,8 @@ static void test_crtc(data_t *data, unsigned int edges)
 	igt_display_t *display = &data->display;
 	int valid_tests = 0;
 
+	cleanup_crtc(data);
+
 	create_cursor_fb(data, data->curw, data->curh);
 
 	for_each_valid_output_on_pipe(display, data->pipe, data->output) {
@@ -306,9 +285,6 @@ static void test_crtc(data_t *data, unsigned int edges)
 			 igt_subtest_name(),
 			 kmstest_pipe_name(data->pipe),
 			 igt_output_name(data->output));
-
-		/* cleanup what prepare_crtc() has done */
-		cleanup_crtc(data);
 	}
 
 	igt_remove_fb(data->drm_fd, &data->fb);
Signature · 6 lines
2.16.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Reviewed-by on v1 2/2
#2 lore raw

Re: [igt-dev] [PATCH i-g-t 2/2] tests/kms_chv_cursor_fail: Use igt_display_reset() and igt_pipe_crc_drain()

Quoted 5 lines · Maarten Lankhorst

This reduces the amount of state to reset on each preparation, and allows us to keep CRC enabled. With 2 outputs on KBL the test time goes from approximately 9.2s to 7s on KBL.

At first I thought you keep the CRC enabled even over modesets (which is invalid, since depending upon the output type the "auto" CRC source gets reconfigured), but that's not the case.

Quoted 136 lines
---
 tests/kms_chv_cursor_fail.c | 60 ++++++++++++++-------------------------------
 1 file changed, 18 insertions(+), 42 deletions(-)
tests/kms_chv_cursor_fail.c +18 -42
index 1bcf8469088e..ffbe39d0c41b 100644
@@ -60,15 +60,6 @@ enum {
 	EDGE_BOTTOM = 0x8,
 };
 
-static void cursor_disable(data_t *data)
-{
-	igt_output_t *output = data->output;
-	igt_plane_t *cursor;
-
-	cursor = igt_output_get_plane_type(output, DRM_PLANE_TYPE_CURSOR);
-	igt_plane_set_fb(cursor, NULL);
-}
-
 static void create_cursor_fb(data_t *data, int cur_w, int cur_h)
 {
 	cairo_t *cr;
@@ -123,7 +114,7 @@ static void test_edge_pos(data_t *data, int sx, int ex, int y, bool swap_axis)
 
 	dx = (ex - sx)/XSTEP;
 
-	igt_pipe_crc_start(data->pipe_crc);
+	igt_pipe_crc_drain(data->pipe_crc);
 
 	i = 0;
 
@@ -154,7 +145,6 @@ static void test_edge_pos(data_t *data, int sx, int ex, int y, bool swap_axis)
 	}
 
 	n = igt_pipe_crc_get_crcs(data->pipe_crc, NCRC, &crc);
-	igt_pipe_crc_stop(data->pipe_crc);
 
 	if (!data->colored) {
 		igt_debug("Checking CRCs: ");
@@ -225,15 +215,27 @@ static void test_edges(data_t *data, unsigned int edges)
 	}
 }
 
+static void cleanup_crtc(data_t *data)
+{
+	igt_display_t *display = &data->display;
+
+	igt_display_reset(display);
+	igt_pipe_crc_free(data->pipe_crc);
+	data->pipe_crc = NULL;
+
+	igt_remove_fb(data->drm_fd, &data->primary_fb);
+}
+
 static void prepare_crtc(data_t *data)
 {
 	drmModeModeInfo *mode;
 	igt_display_t *display = &data->display;
 	igt_plane_t *primary;
 
+	cleanup_crtc(data);
+
 	/* select the pipe we want to use */
 	igt_output_set_pipe(data->output, data->pipe);
-	cursor_disable(data);
 
 	mode = igt_output_get_mode(data->output);
 	igt_create_pattern_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
@@ -250,37 +252,12 @@ static void prepare_crtc(data_t *data)
 	data->jump_y = (mode->vdisplay - data->curh) / 2;
 
 	/* create the pipe_crc object for this pipe */
-	if (data->pipe_crc)
-		igt_pipe_crc_free(data->pipe_crc);
-
 	data->pipe_crc = igt_pipe_crc_new_nonblock(data->drm_fd, data->pipe,
 						   INTEL_PIPE_CRC_SOURCE_AUTO);
 
-	/* make sure cursor is disabled */
-	cursor_disable(data);
-	igt_wait_for_vblank(data->drm_fd, data->pipe);
-
 	/* get reference crc w/o cursor */
-	igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
-	igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
-	igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
-}
-
-static void cleanup_crtc(data_t *data)
-{
-	igt_display_t *display = &data->display;
-	igt_plane_t *primary;
-
-	igt_pipe_crc_free(data->pipe_crc);
-	data->pipe_crc = NULL;
-
-	igt_remove_fb(data->drm_fd, &data->primary_fb);
-
-	primary = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_PRIMARY);
-	igt_plane_set_fb(primary, NULL);
-
-	igt_output_set_pipe(data->output, PIPE_ANY);
-	igt_display_commit(display);
+	igt_pipe_crc_start(data->pipe_crc);
+	igt_assert(igt_pipe_crc_get_single(data->pipe_crc, &data->ref_crc));
 }
 
 static void test_crtc(data_t *data, unsigned int edges)
@@ -288,6 +265,8 @@ static void test_crtc(data_t *data, unsigned int edges)
 	igt_display_t *display = &data->display;
 	int valid_tests = 0;
 
+	cleanup_crtc(data);
+
 	create_cursor_fb(data, data->curw, data->curh);
 
 	for_each_valid_output_on_pipe(display, data->pipe, data->output) {
@@ -306,9 +285,6 @@ static void test_crtc(data_t *data, unsigned int edges)
 			 igt_subtest_name(),
 			 kmstest_pipe_name(data->pipe),
 			 igt_output_name(data->output));
-
-		/* cleanup what prepare_crtc() has done */
-		cleanup_crtc(data);
 	}
 
 	igt_remove_fb(data->drm_fd, &data->fb);
Signature · 6 lines
2.16.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Reviewed-by on v1 1/2
#3 lore raw
In reply to Maarten Lankhorst
Quoted 4 lines · Maarten Lankhorst

read_crc returns an error instead of 0 on timeout now, so handle this correctly. This is a small error introduced in

commit 7d48c0252c384d18318de89c54817bdfe9c832fc

Quoted 8 lines
Author: Maarten Lankhorst <[email protected]>
Date:   Fri Feb 2 13:34:25 2018 +0100

lib/igt_debugfs: Add igt_pipe_crc_get_single and igt_pipe_crc_drain, v4.

It causes the kms_chv_cursor_fail to take 27 minutes, so fix this..

Quoted 29 lines
---
 lib/igt_debugfs.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
lib/igt_debugfs.c +3 -2
index e2b15f9bda0b..4a119985f102 100644
@@ -794,10 +794,11 @@ igt_pipe_crc_get_crcs(igt_pipe_crc_t *pipe_crc, int n_crcs,
 		int ret;
 
 		ret = read_crc(pipe_crc, crc);
+		if (ret == -EAGAIN)
+			break;
+
 		if (ret < 0)
 			continue;
-		if (ret == 0)
-			break;
 
 		n++;
 	} while (n < n_crcs);
Signature · 6 lines
2.16.1

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

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

#4 lore raw

Op 15-02-18 om 13:49 schreef Petri Latvala:

Quoted 41 lines · Maarten Lankhorst
Quoted 4 lines

read_crc returns an error instead of 0 on timeout now, so handle this correctly. This is a small error introduced in

commit 7d48c0252c384d18318de89c54817bdfe9c832fc

Quoted 8 lines
Author: Maarten Lankhorst <[email protected]>
Date:   Fri Feb 2 13:34:25 2018 +0100

lib/igt_debugfs: Add igt_pipe_crc_get_single and igt_pipe_crc_drain, v4.

It causes the kms_chv_cursor_fail to take 27 minutes, so fix this..

Quoted 25 lines
---
 lib/igt_debugfs.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
lib/igt_debugfs.c +3 -2
index e2b15f9bda0b..4a119985f102 100644
@@ -794,10 +794,11 @@ igt_pipe_crc_get_crcs(igt_pipe_crc_t *pipe_crc, int n_crcs,
 		int ret;
 
 		ret = read_crc(pipe_crc, crc);
+		if (ret == -EAGAIN)
+			break;
+
 		if (ret < 0)
 			continue;
-		if (ret == 0)
-			break;
 
 		n++;
 	} while (n < n_crcs);
Signature · 1 line
2.16.1
Quoted 4 lines
Quoted 4 lines

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

Pushed first patch, thanks.

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

#5 lore raw

[igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/2] lib/igt_debugfs: Fix igt_pipe_get_crcs.

In reply to Maarten Lankhorst
== Series Details ==

== Series Details ==

Series: series starting with [i-g-t,1/2] lib/igt_debugfs: Fix igt_pipe_get_crcs.
URL : https://patchwork.freedesktop.org/series/38361/
State : success

== Summary ==

IGT patchset tested on top of latest successful build f2ac5601be25c683e89f7b6ee704c1b1b9eb1b30 tests/perf_pmu: Log perf timestamp in semaphore wait tests

with latest DRM-Tip kernel build CI_DRM_3779
6b3cedfad753 drm-tip: 2018y-02m-15d-15h-04m-33s UTC integration manifest

No testlist changes.

Test kms_pipe_crc_basic:

        Subgroup suspend-read-crc-pipe-a:
                pass       -> FAIL       (fi-skl-6700k2) fdo#103191

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

fi-bdw-5557u     total:288  pass:267  dwarn:0   dfail:0   fail:0   skip:21  time:418s
fi-bdw-gvtdvm    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:428s
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:381s
fi-bsw-n3050     total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  time:497s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:289s
fi-bxt-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:483s
fi-bxt-j4205     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:490s
fi-byt-j1900     total:288  pass:253  dwarn:0   dfail:0   fail:0   skip:35  time:474s
fi-byt-n2820     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:466s
fi-cfl-s2        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:573s
fi-elk-e7500     total:288  pass:229  dwarn:0   dfail:0   fail:0   skip:59  time:408s
fi-gdg-551       total:288  pass:179  dwarn:0   dfail:0   fail:1   skip:108 time:287s
fi-glk-1         total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:510s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:391s
fi-ilk-650       total:288  pass:228  dwarn:0   dfail:0   fail:0   skip:60  time:416s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:460s
fi-ivb-3770      total:288  pass:255  dwarn:0   dfail:0   fail:0   skip:33  time:414s
fi-kbl-7500u     total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:460s
fi-kbl-7560u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:499s
fi-kbl-7567u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:458s
fi-kbl-r         total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:504s
fi-pnv-d510      total:288  pass:222  dwarn:1   dfail:0   fail:0   skip:65  time:584s
fi-skl-6260u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:431s
fi-skl-6600u     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:506s
fi-skl-6700hq    total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:531s
fi-skl-6700k2    total:288  pass:263  dwarn:0   dfail:0   fail:1   skip:24  time:478s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:485s
fi-skl-guc       total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:419s
fi-skl-gvtdvm    total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:436s
fi-snb-2520m     total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:532s
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:399s

Blacklisted hosts:
fi-glk-dsi total:288 pass:258 dwarn:0 dfail:0 fail:0 skip:30 time:476s

== Logs ==

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

#6 lore raw

[igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,1/2] lib/igt_debugfs: Fix igt_pipe_get_crcs.

In reply to Maarten Lankhorst
== Series Details ==

== Series Details ==

Series: series starting with [i-g-t,1/2] lib/igt_debugfs: Fix igt_pipe_get_crcs.
URL : https://patchwork.freedesktop.org/series/38361/
State : success

== Summary ==

Test kms_cursor_crc:

        Subgroup cursor-128x128-suspend:
                skip       -> PASS       (shard-snb) fdo#103880
Test gem_eio:
        Subgroup in-flight-external:
                fail       -> PASS       (shard-hsw) fdo#104676 +1
        Subgroup in-flight-contexts:
                dmesg-warn -> PASS       (shard-snb) fdo#104058
Test kms_atomic_transition:
        Subgroup 1x-modeset-transitions-nonblocking-fencing:
                pass       -> FAIL       (shard-apl) fdo#103207
Test kms_sysfs_edid_timing:
                warn       -> PASS       (shard-apl) fdo#100047
Test kms_rotation_crc:
        Subgroup sprite-rotation-180:
                fail       -> PASS       (shard-snb) fdo#103925 +1

fdo#103880 https://bugs.freedesktop.org/show_bug.cgi?id=103880
fdo#104676 https://bugs.freedesktop.org/show_bug.cgi?id=104676
fdo#104058 https://bugs.freedesktop.org/show_bug.cgi?id=104058
fdo#103207 https://bugs.freedesktop.org/show_bug.cgi?id=103207
fdo#100047 https://bugs.freedesktop.org/show_bug.cgi?id=100047
fdo#103925 https://bugs.freedesktop.org/show_bug.cgi?id=103925

shard-apl        total:3410 pass:1771 dwarn:1   dfail:0   fail:21  skip:1616 time:12200s
shard-hsw        total:3427 pass:1759 dwarn:1   dfail:0   fail:10  skip:1656 time:11797s
shard-snb        total:3427 pass:1350 dwarn:1   dfail:0   fail:10  skip:2066 time:6648s

== Logs ==

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