Skip to contentSkip to conversation

tests/kms_flip: Use human readable pipe and connector names

PATCH In review [email protected] 2 participants 8 messages Nov 11, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 tests/kms_flip: Use human readable pipe and connector names

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

Print the pipes and connectors in a human readable form instead of using the integer IDs.

---
 tests/kms_flip.c | 28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)
tests/kms_flip.c +21 -7
index e1b5856..649678c 100644
@@ -158,6 +158,7 @@ struct test_output {
 	drmModeConnector *kconnector[4];
 	uint32_t _connector[4];
 	uint32_t _crtc[4];
+	int _pipe[4];
 	int count; /* 1:1 mapping between crtc:connector */
 	int flags;
 	int pipe; /* primary pipe for vblank */
@@ -1102,6 +1103,7 @@ static void connector_find_preferred_mode(uint32_t connector_id, int crtc_idx,
 	o->kconnector[0] = config.connector;
 	o->kencoder[0] = config.encoder;
 	o->_crtc[0] = config.crtc->crtc_id;
+	o->_pipe[0] = config.pipe;
 	o->kmode[0] = config.default_mode;
 	o->mode_valid = 1;
 
@@ -1170,11 +1172,13 @@ found:
 	o->kconnector[0] = config[0].connector;
 	o->kencoder[0] = config[0].encoder;
 	o->_crtc[0] = config[0].crtc->crtc_id;
+	o->_pipe[0] = config[0].pipe;
 	o->kmode[0] = *mode[0];
 
 	o->kconnector[1] = config[1].connector;
 	o->kencoder[1] = config[1].encoder;
 	o->_crtc[1] = config[1].crtc->crtc_id;
+	o->_pipe[1] = config[1].pipe;
 	o->kmode[1] = *mode[1];
 
 	drmModeFreeCrtc(config[0].crtc);
@@ -1350,22 +1354,32 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs,
 	switch (crtc_count) {
 	case 1:
 		connector_find_preferred_mode(o->_connector[0], crtc_idxs[0], o);
+		if (!o->mode_valid)
+			return;
 		snprintf(test_name, sizeof(test_name),
-			  "%s on crtc %d, connector %d",
-			  igt_subtest_name(), o->_crtc[0], o->_connector[0]);
+			 "%s on pipe %s, connector %s-%d",
+			 igt_subtest_name(),
+			 kmstest_pipe_name(o->_pipe[0]),
+			 kmstest_connector_type_str(o->kconnector[0]->connector_type),
+			 o->kconnector[0]->connector_type_id);
 		break;
 	case 2:
 		connector_find_compatible_mode(crtc_idxs[0], crtc_idxs[1], o);
+		if (!o->mode_valid)
+			return;
 		snprintf(test_name, sizeof(test_name),
-			 "%s on crtc %d:%d, connector %d:%d",
-			 igt_subtest_name(), o->_crtc[0], o->_crtc[1],
-			 o->_connector[0], o->_connector[1]);
+			 "%s on pipe %s:%s, connector %s-%d:%s-%d",
+			 igt_subtest_name(),
+			 kmstest_pipe_name(o->_pipe[0]),
+			 kmstest_pipe_name(o->_pipe[1]),
+			 kmstest_connector_type_str(o->kconnector[0]->connector_type),
+			 o->kconnector[0]->connector_type_id,
+			 kmstest_connector_type_str(o->kconnector[1]->connector_type),
+			 o->kconnector[1]->connector_type_id);
 		break;
 	default:
 		igt_assert(0);
 	}
-	if (!o->mode_valid)
-		return;
 
 	igt_assert_eq(o->count, crtc_count);
 
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/4 tests/kms_flip: Disable all pipes before each test

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

Currently kms_flip leaks the state of the pipes from one subtest to the next. Meaning a single pipe test can actually have two or more pipes actually up and running, and similarly a two pipe test can have three pipes running.

This is particularly nasty on IVB since one of the pipes still running but not actually part of the test maybe have reserved the shared FDI lanes, thus preventing one of the pipes taking part in the test from being enabled.

To avoid such problems explicitly disable all pipes before each subtests.

---
 tests/kms_flip.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
tests/kms_flip.c +18 -0
index 649678c..632f264 100644
@@ -849,6 +849,22 @@ static bool is_hung(int fd)
 	return errno == EIO;
 }
 
+static void disable_crtcs(void)
+{
+	int n;
+
+	for (n = 0; n < resources->count_crtcs; n++) {
+		drmModeCrtc *crtc = drmModeGetCrtc(drm_fd, resources->crtcs[n]);
+
+		int ret = drmModeSetCrtc(drm_fd, crtc->crtc_id,
+					 0, 0, 0,
+					 0, 0, 0);
+		igt_assert(ret == 0);
+
+		drmModeFreeCrtc(crtc);
+	}
+}
+
 static int set_mode(struct test_output *o, uint32_t fb, int x, int y)
 {
 	int n;
@@ -1425,6 +1441,8 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs,
 	for (i = 0; i < o->count; i++)
 		kmstest_dump_mode(&o->kmode[i]);
 
+	disable_crtcs();
+
 	if (set_mode(o, o->fb_ids[0], 0, 0)) {
 		/* We may fail to apply the mode if there are hidden
 		 * constraints, such as bandwidth on the third pipe.
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/4] tests/kms_flip: Disable all pipes before each test

2015-11-11 15:32 GMT-02:00 <[email protected]>:

Quoted 26 lines

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

Currently kms_flip leaks the state of the pipes from one subtest to the next. Meaning a single pipe test can actually have two or more pipes actually up and running, and similarly a two pipe test can have three pipes running.

This is particularly nasty on IVB since one of the pipes still running but not actually part of the test maybe have reserved the shared FDI lanes, thus preventing one of the pipes taking part in the test from being enabled.

To avoid such problems explicitly disable all pipes before each subtests.

---
 tests/kms_flip.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
tests/kms_flip.c +0 -0
index 649678c..632f264 100644
@@ -849,6 +849,22 @@ static bool is_hung(int fd)
        return errno == EIO;

tests/kms_flip.c static bool is_hung(int fd) · line 859

Quoted 10 lines
tests/kms_flip.c +8 -0
 }
 
+static void disable_crtcs(void)
+{
+       int n;
+
+       for (n = 0; n < resources->count_crtcs; n++) {
+               drmModeCrtc *crtc = drmModeGetCrtc(drm_fd, resources->crtcs[n]);
+
+               int ret = drmModeSetCrtc(drm_fd, crtc->crtc_id,

You could have used resources->crtcs[n] do avoid the GetCrtc() call.

Anyway, you can avoid this new function and just call kmstest_unset_all_crtcs(drm_fd, resources) from igt_kms.h.

Quoted 27 lines
tests/kms_flip.c +10 -1
+                                        0, 0, 0,
+                                        0, 0, 0);
+               igt_assert(ret == 0);
+
+               drmModeFreeCrtc(crtc);
+       }
+}
+
 static int set_mode(struct test_output *o, uint32_t fb, int x, int y)
 {
        int n;
@@ -1425,6 +1441,8 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs,
        for (i = 0; i < o->count; i++)
                kmstest_dump_mode(&o->kmode[i]);
 
+       disable_crtcs();
+
        if (set_mode(o, o->fb_ids[0], 0, 0)) {
                /* We may fail to apply the mode if there are hidden
                 * constraints, such as bandwidth on the third pipe.
--

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
#3 lore raw

Re: [PATCH i-g-t 2/4] tests/kms_flip: Disable all pipes before each test

Quoted 29 lines · Paulo Zanoni

2015-11-11 15:32 GMT-02:00 <[email protected]>:

Quoted 28 lines

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

Currently kms_flip leaks the state of the pipes from one subtest to the next. Meaning a single pipe test can actually have two or more pipes actually up and running, and similarly a two pipe test can have three pipes running.

This is particularly nasty on IVB since one of the pipes still running but not actually part of the test maybe have reserved the shared FDI lanes, thus preventing one of the pipes taking part in the test from being enabled.

To avoid such problems explicitly disable all pipes before each subtests.

---
 tests/kms_flip.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
tests/kms_flip.c +0 -0
index 649678c..632f264 100644
@@ -849,6 +849,22 @@ static bool is_hung(int fd)
        return errno == EIO;
 }
 
Quoted 10 lines

tests/kms_flip.c static bool is_hung(int fd) · line 859

Quoted 8 lines
tests/kms_flip.c +8 -0
+static void disable_crtcs(void)
+{
+       int n;
+
+       for (n = 0; n < resources->count_crtcs; n++) {
+               drmModeCrtc *crtc = drmModeGetCrtc(drm_fd, resources->crtcs[n]);
+
+               int ret = drmModeSetCrtc(drm_fd, crtc->crtc_id,

You could have used resources->crtcs[n] do avoid the GetCrtc() call.

I thought we freed those. Maybe not.

Quoted 3 lines

Anyway, you can avoid this new function and just call kmstest_unset_all_crtcs(drm_fd, resources) from igt_kms.h.

OK. That's nice.

Quoted 33 lines
Quoted 28 lines
tests/kms_flip.c +10 -1
+                                        0, 0, 0,
+                                        0, 0, 0);
+               igt_assert(ret == 0);
+
+               drmModeFreeCrtc(crtc);
+       }
+}
+
 static int set_mode(struct test_output *o, uint32_t fb, int x, int y)
 {
        int n;
@@ -1425,6 +1441,8 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs,
        for (i = 0; i < o->count; i++)
                kmstest_dump_mode(&o->kmode[i]);
 
+       disable_crtcs();
+
        if (set_mode(o, o->fb_ids[0], 0, 0)) {
                /* We may fail to apply the mode if there are hidden
                 * constraints, such as bandwidth on the third pipe.
--

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
#4 lore raw

Re: [PATCH i-g-t 2/4] tests/kms_flip: Disable all pipes before each test

Quoted 41 lines · Ville Syrjälä
Quoted 29 lines · Paulo Zanoni

2015-11-11 15:32 GMT-02:00 <[email protected]>:

Quoted 28 lines

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

Currently kms_flip leaks the state of the pipes from one subtest to the next. Meaning a single pipe test can actually have two or more pipes actually up and running, and similarly a two pipe test can have three pipes running.

This is particularly nasty on IVB since one of the pipes still running but not actually part of the test maybe have reserved the shared FDI lanes, thus preventing one of the pipes taking part in the test from being enabled.

To avoid such problems explicitly disable all pipes before each subtests.

---
 tests/kms_flip.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
tests/kms_flip.c +0 -0
index 649678c..632f264 100644
@@ -849,6 +849,22 @@ static bool is_hung(int fd)
        return errno == EIO;
 }
 
Quoted 10 lines

tests/kms_flip.c static bool is_hung(int fd) · line 859

Quoted 8 lines
tests/kms_flip.c +8 -0
+static void disable_crtcs(void)
+{
+       int n;
+
+       for (n = 0; n < resources->count_crtcs; n++) {
+               drmModeCrtc *crtc = drmModeGetCrtc(drm_fd, resources->crtcs[n]);
+
+               int ret = drmModeSetCrtc(drm_fd, crtc->crtc_id,

You could have used resources->crtcs[n] do avoid the GetCrtc() call.

Quoted 1 line

I thought we freed those. Maybe not.

Ah misread the whole thing. Yes, there's no point in this id->struct->id dance I'm doing.

Quoted 48 lines
Quoted 4 lines

Anyway, you can avoid this new function and just call kmstest_unset_all_crtcs(drm_fd, resources) from igt_kms.h.

OK. That's nice.

Quoted 33 lines
Quoted 28 lines
tests/kms_flip.c +10 -1
+                                        0, 0, 0,
+                                        0, 0, 0);
+               igt_assert(ret == 0);
+
+               drmModeFreeCrtc(crtc);
+       }
+}
+
 static int set_mode(struct test_output *o, uint32_t fb, int x, int y)
 {
        int n;
@@ -1425,6 +1441,8 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs,
        for (i = 0; i < o->count; i++)
                kmstest_dump_mode(&o->kmode[i]);
 
+       disable_crtcs();
+
        if (set_mode(o, o->fb_ids[0], 0, 0)) {
                /* We may fail to apply the mode if there are hidden
                 * constraints, such as bandwidth on the third pipe.
--

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
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

PATCH v2 2/4 tests/kms_flip: Disable all pipes before each test

In reply to [email protected]

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

Currently kms_flip leaks the state of the pipes from one subtest to the next. Meaning a single pipe test can actually have two or more pipes actually up and running, and similarly a two pipe test can have three pipes running.

This is particularly nasty on IVB since one of the pipes still running but not actually part of the test maybe have reserved the shared FDI lanes, thus preventing one of the pipes taking part in the test from being enabled.

To avoid such problems explicitly disable all pipes before each subtests.

v2: Use kmstest_unset_all_crtcs() (Paulo)

---
 tests/kms_flip.c | 2 ++
 1 file changed, 2 insertions(+)
tests/kms_flip.c +2 -0
index 649678c..8bba121 100644
@@ -1425,6 +1425,8 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs,
 	for (i = 0; i < o->count; i++)
 		kmstest_dump_mode(&o->kmode[i]);
 
+	kmstest_unset_all_crtcs(drm_fd, resources);
+
 	if (set_mode(o, o->fb_ids[0], 0, 0)) {
 		/* We may fail to apply the mode if there are hidden
 		 * constraints, such as bandwidth on the third pipe.
Signature · 6 lines
2.4.10

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

PATCH 3/4 tests/kms_flip: Modeset pipes in reverse order

In reply to [email protected]

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

To make more multi-pipe tests run on IVB, do the modesets in the reverse order (ie. pipe C first, pipe A last). This way pipe B can't reserve the 2 shared FDI lanes before pipe C is set up.

---
 tests/kms_flip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/kms_flip.c +1 -1
index 632f264..23dadad 100644
@@ -869,7 +869,7 @@ static int set_mode(struct test_output *o, uint32_t fb, int x, int y)
 {
 	int n;
 
-	for (n = 0; n < o->count; n++) {
+	for (n = o->count - 1; n >= 0; n--) {
 		if (fb == 0) {
 			int ret = drmModeSetCrtc(drm_fd, o->_crtc[n],
 						 0, 0, 0,
Signature · 6 lines
2.4.10

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

PATCH 4/4 tests/kms_flip: Add a note that the test was skipped when modeset fails

In reply to [email protected]

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

---
 tests/kms_flip.c | 1 +
 1 file changed, 1 insertion(+)
tests/kms_flip.c +1 -0
index 23dadad..af1ccfb 100644
@@ -1449,6 +1449,7 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs,
 		 */
 		igt_assert_f(crtc_count > 1 || crtc_idxs[0] < 2,
 			     "set_mode may only fail on the 3rd pipe or in multiple crtc tests\n");
+		igt_info("\n%s: SKIPPED\n\n", test_name);
 		goto out;
 	}
 	igt_assert(fb_is_bound(o, o->fb_ids[0]));
Signature · 6 lines
2.4.10

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