All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [v2 i-g-t] tests/kms_flip: Restrict the hang tests execution to two pipes
@ 2021-03-10 20:52 Bhanuprakash Modem
  0 siblings, 0 replies; only message in thread
From: Bhanuprakash Modem @ 2021-03-10 20:52 UTC (permalink / raw)
  To: igt-dev; +Cc: Petri Latvala

To save the CI execution time, instead of running on all pipes
restrict the hang tests execution to two pipes.

If we want to execute on all pipes, we need to pass an extra
argument "-e" indicates extended.

Example: ./build/tests/kms_flip -e --r flip-vs-modeset-vs-hang

v2:
* Fix the typo in args handler (Petri)

Cc: Uma Shankar <uma.shankar@intel.com>
Cc: Petri Latvala <petri.latvala@intel.com>
Cc: Karthik B S <karthik.b.s@intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
---
 tests/kms_flip.c | 52 +++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 45 insertions(+), 7 deletions(-)

diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index e0d009d22..d926113a3 100755
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -85,6 +85,10 @@
 #define DRM_CAP_TIMESTAMP_MONOTONIC 6
 #endif
 
+/* restricted pipe count */
+#define CRTC_RESTRICT_CNT 2
+static bool all_pipes = false;
+
 drmModeRes *resources;
 int drm_fd;
 static struct buf_ops *bops;
@@ -1435,10 +1439,17 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs,
 		__run_test_on_crtc_set(o, crtc_idxs, crtc_count, duration_ms);
 }
 
+static int limit_crtc_count(int count_crtcs)
+{
+	return (count_crtcs > CRTC_RESTRICT_CNT)?
+			CRTC_RESTRICT_CNT : count_crtcs;
+}
+
 static int run_test(int duration, int flags)
 {
 	struct test_output o;
 	int i, n, modes = 0;
+	int count_crtcs;
 
 	igt_require((flags & TEST_HANG) == 0 || !is_wedged(drm_fd));
 	igt_require(!(flags & TEST_FENCE_STRESS) ||
@@ -1447,9 +1458,14 @@ static int run_test(int duration, int flags)
 	resources = drmModeGetResources(drm_fd);
 	igt_require(resources);
 
+	count_crtcs = resources->count_crtcs;
+	/* Limit the execution to 2 CRTCs for hang tests */
+	if(!!(flags & TEST_HANG) && !all_pipes)
+		count_crtcs = limit_crtc_count(count_crtcs);
+
 	/* Count output configurations to scale test runtime. */
 	for (i = 0; i < resources->count_connectors; i++) {
-		for (n = 0; n < resources->count_crtcs; n++) {
+		for (n = 0; n < count_crtcs; n++) {
 			memset(&o, 0, sizeof(o));
 			o.count = 1;
 			o._connector[0] = resources->connectors[i];
@@ -1471,7 +1487,7 @@ static int run_test(int duration, int flags)
 
 	/* Find any connected displays */
 	for (i = 0; i < resources->count_connectors; i++) {
-		for (n = 0; n < resources->count_crtcs; n++) {
+		for (n = 0; n < count_crtcs; n++) {
 			int crtc_idx;
 
 			memset(&o, 0, sizeof(o));
@@ -1494,6 +1510,7 @@ static int run_pair(int duration, int flags)
 {
 	struct test_output o;
 	int i, j, m, n, modes = 0;
+	int count_crtcs;
 
 	igt_require((flags & TEST_HANG) == 0 || !is_wedged(drm_fd));
 	igt_require(!(flags & TEST_FENCE_STRESS) ||
@@ -1502,11 +1519,16 @@ static int run_pair(int duration, int flags)
 	resources = drmModeGetResources(drm_fd);
 	igt_require(resources);
 
+	count_crtcs = resources->count_crtcs;
+	/* Limit the execution to 2 CRTCs for hang tests */
+	if(!!(flags & TEST_HANG) && !all_pipes)
+		count_crtcs = limit_crtc_count(count_crtcs);
+
 	/* Find a pair of connected displays */
 	for (i = 0; i < resources->count_connectors; i++) {
-		for (n = 0; n < resources->count_crtcs; n++) {
+		for (n = 0; n < count_crtcs; n++) {
 			for (j = i + 1; j < resources->count_connectors; j++) {
-				for (m = n + 1; m < resources->count_crtcs; m++) {
+				for (m = n + 1; m < count_crtcs; m++) {
 					memset(&o, 0, sizeof(o));
 					o.count = 2;
 					o._connector[0] = resources->connectors[i];
@@ -1533,9 +1555,9 @@ static int run_pair(int duration, int flags)
 
 	/* Find a pair of connected displays */
 	for (i = 0; i < resources->count_connectors; i++) {
-		for (n = 0; n < resources->count_crtcs; n++) {
+		for (n = 0; n < count_crtcs; n++) {
 			for (j = i + 1; j < resources->count_connectors; j++) {
-				for (m = n + 1; m < resources->count_crtcs; m++) {
+				for (m = n + 1; m < count_crtcs; m++) {
 					int crtc_idxs[2];
 
 					memset(&o, 0, sizeof(o));
@@ -1604,7 +1626,23 @@ static void test_nonblocking_read(int in)
 	close(fd);
 }
 
-igt_main
+static int opt_handler(int opt, int opt_index, void *data)
+{
+	switch (opt) {
+		case 'e':
+			all_pipes = true;
+			break;
+		default:
+			return IGT_OPT_HANDLER_ERROR;
+	}
+
+	return IGT_OPT_HANDLER_SUCCESS;
+}
+
+const char *help_str =
+	"  -e \tRun on all pipes. (By default subtests will run on two pipes)\n";
+
+igt_main_args("e:", NULL, help_str, opt_handler, NULL)
 {
 	struct {
 		int duration;
-- 
2.20.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-10 13:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-10 20:52 [igt-dev] [v2 i-g-t] tests/kms_flip: Restrict the hang tests execution to two pipes Bhanuprakash Modem

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.