Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Nidhi Gupta <nidhi1.gupta@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Nidhi Gupta <nidhi1.gupta@intel.com>
Subject: [igt-dev] [PATCH i-g-t v2] tests/kms_cursor_crc: Reduce the execution time on simulation
Date: Wed,  5 Apr 2023 14:21:41 +0530	[thread overview]
Message-ID: <20230405085141.40355-1-nidhi1.gupta@intel.com> (raw)

As the test execution is taking more time on simulation, limit the
execution to two (first & last) pipes. This optimization is for
simulation and hardware.

This patch will also provide an option (command line flag '-e') to
execute on all pipes.

Signed-off-by: Nidhi Gupta <nidhi1.gupta@intel.com>
Reviewed-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
---
 tests/kms_cursor_crc.c | 60 +++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 59 insertions(+), 1 deletion(-)

diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
index 962ff27f..cc9dfcb1 100644
--- a/tests/kms_cursor_crc.c
+++ b/tests/kms_cursor_crc.c
@@ -83,6 +83,11 @@ typedef struct {
 	cursorarea oldcursorarea[MAXCURSORBUFFER];
 } data_t;
 
+static bool extended;
+static enum pipe active_pipes[IGT_MAX_PIPES];
+static uint32_t last_pipe;
+
+
 #define TEST_DPMS (1<<0)
 #define TEST_SUSPEND (1<<1)
 
@@ -716,6 +721,17 @@ static bool valid_pipe_output_combo(data_t *data)
 	return ret;
 }
 
+static bool execution_constraint(enum pipe pipe)
+{
+	if (!extended &&
+	    pipe != active_pipes[0] &&
+	    pipe != active_pipes[last_pipe])
+		return true;
+
+	return false;
+}
+
+
 static void run_size_tests(data_t *data, int w, int h)
 {
 	enum pipe pipe;
@@ -766,6 +782,9 @@ static void run_size_tests(data_t *data, int w, int h)
 			}
 
 			for_each_pipe_with_single_output(&data->display, pipe, data->output) {
+				if (execution_constraint(pipe))
+					continue;
+
 				data->pipe = pipe;
 
 				if (!valid_pipe_output_combo(data))
@@ -802,6 +821,9 @@ static void run_tests_on_pipe(data_t *data)
 		     "correctly.");
 	igt_subtest_with_dynamic("cursor-size-change") {
 		for_each_pipe_with_single_output(&data->display, pipe, data->output) {
+			if (execution_constraint(pipe))
+				continue;
+
 			data->pipe = pipe;
 
 			if (!valid_pipe_output_combo(data))
@@ -819,6 +841,9 @@ static void run_tests_on_pipe(data_t *data)
 		     "plane, i.e., alpha channel equal to 1.0.");
 	igt_subtest_with_dynamic("cursor-alpha-opaque") {
 		for_each_pipe_with_single_output(&data->display, pipe, data->output) {
+			if (execution_constraint(pipe))
+				continue;
+
 			data->pipe = pipe;
 
 			if (!valid_pipe_output_combo(data))
@@ -836,6 +861,9 @@ static void run_tests_on_pipe(data_t *data)
 		     "plane, i.e., alpha channel equal to 0.0.");
 	igt_subtest_with_dynamic("cursor-alpha-transparent") {
 		for_each_pipe_with_single_output(&data->display, pipe, data->output) {
+			if (execution_constraint(pipe))
+				continue;
+
 			data->pipe = pipe;
 
 			if (!valid_pipe_output_combo(data))
@@ -856,6 +884,9 @@ static void run_tests_on_pipe(data_t *data)
 	igt_describe("Check random placement of a cursor with DPMS.");
 	igt_subtest_with_dynamic("cursor-dpms") {
 		for_each_pipe_with_single_output(&data->display, pipe, data->output) {
+			if (execution_constraint(pipe))
+				continue;
+
 			data->pipe = pipe;
 			data->flags = TEST_DPMS;
 
@@ -874,6 +905,9 @@ static void run_tests_on_pipe(data_t *data)
 	igt_describe("Check random placement of a cursor with suspend.");
 	igt_subtest_with_dynamic("cursor-suspend") {
 		for_each_pipe_with_single_output(&data->display, pipe, data->output) {
+			if (execution_constraint(pipe))
+				continue;
+
 			data->pipe = pipe;
 			data->flags = TEST_SUSPEND;
 
@@ -915,16 +949,40 @@ static void run_tests_on_pipe(data_t *data)
 
 static data_t data;
 
-igt_main
+static int opt_handler(int opt, int opt_index, void *_data)
+{
+	switch (opt) {
+	case 'e':
+		extended = true;
+		break;
+	default:
+		return IGT_OPT_HANDLER_ERROR;
+	}
+
+	return IGT_OPT_HANDLER_SUCCESS;
+}
+
+const char *help_str =
+	"  -e \tExtended tests.\n";
+
+igt_main_args("e", NULL, help_str, opt_handler, NULL)
 {
 	uint64_t cursor_width = 64, cursor_height = 64;
 	int ret;
 
 	igt_fixture {
+		enum pipe pipe;
+
+		last_pipe = 0;
+
 		data.drm_fd = drm_open_driver_master(DRIVER_ANY);
 
 		igt_display_require(&data.display, data.drm_fd);
 		igt_display_require_output(&data.display);
+		/* Get active pipes. */
+		for_each_pipe(&data.display, pipe)
+			active_pipes[last_pipe++] = pipe;
+		last_pipe--;
 
 		ret = drmGetCap(data.drm_fd, DRM_CAP_CURSOR_WIDTH, &cursor_width);
 		igt_assert(ret == 0 || errno == EINVAL);
-- 
2.25.1

             reply	other threads:[~2023-04-05  8:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-05  8:51 Nidhi Gupta [this message]
2023-04-05 13:03 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_cursor_crc: Reduce the execution time on simulation (rev2) Patchwork
2023-04-06  0:39 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230405085141.40355-1-nidhi1.gupta@intel.com \
    --to=nidhi1.gupta@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox