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 v4] tests/kms_plane_alpha_blend: Limit the test execution
Date: Thu,  9 Feb 2023 10:12:19 +0530	[thread overview]
Message-ID: <20230209044219.4498-1-nidhi1.gupta@intel.com> (raw)

To optimize the test execution time on hardware and simulation,
limit the execution to two (first & last) pipes and 2 planes
(first & last).

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

Example: ./kms_plane_alpha_blend -e --run-subtest alpha-7efc

V2: Edited commit message (Bhanu)
V3: New function for simulation constraints (Kamil)
    Update commit message (Bhanu)
v4: Restrict the execution only on 2 pipes for
    real hardware aswell (Ankit)
v5: Provide extended option for plane also (Bhanu)
    Move pipe declaration inside fixture (Ankit)

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

diff --git a/tests/kms_plane_alpha_blend.c b/tests/kms_plane_alpha_blend.c
index 38272ccb..b8ead947 100644
--- a/tests/kms_plane_alpha_blend.c
+++ b/tests/kms_plane_alpha_blend.c
@@ -28,6 +28,10 @@
 
 IGT_TEST_DESCRIPTION("Test plane alpha and blending mode properties");
 
+static bool extended;
+static enum pipe active_pipes[IGT_MAX_PIPES];
+static uint32_t last_pipe;
+
 typedef struct {
 	int gfx_fd;
 	igt_display_t display;
@@ -482,6 +486,8 @@ static void run_test_on_pipe_planes(data_t *data, enum pipe pipe, igt_output_t *
 {
 	igt_display_t *display = &data->display;
 	igt_plane_t *plane;
+	int first_plane = -1;
+	int last_plane = -1;
 
 	for_each_plane_on_pipe(display, pipe, plane) {
 		if (!igt_plane_has_prop(plane, IGT_PLANE_ALPHA))
@@ -496,6 +502,29 @@ static void run_test_on_pipe_planes(data_t *data, enum pipe pipe, igt_output_t *
 		if (must_multiply && !has_multiplied_alpha(data, plane))
 			continue;
 
+		/* Get first & last valid planes. */
+		if (first_plane < 0)
+			first_plane = j__;
+
+		last_plane = j__;
+	}
+
+	for_each_plane_on_pipe(display, pipe, plane) {
+		if (!igt_plane_has_prop(plane, IGT_PLANE_ALPHA))
+			continue;
+
+		if (blend && !igt_plane_has_prop(plane, IGT_PLANE_PIXEL_BLEND_MODE))
+			continue;
+
+		/* Reset plane alpha properties between each plane. */
+		reset_alpha(display, pipe);
+
+		if (must_multiply && !has_multiplied_alpha(data, plane))
+			continue;
+
+		if (!extended && j__ != first_plane && j__ != last_plane)
+			continue;
+
 		igt_info("Testing plane %u\n", plane->index);
 		test(data, pipe, plane);
 		igt_plane_set_fb(plane, NULL);
@@ -621,6 +650,11 @@ static void run_subtests(data_t *data)
 
 		igt_subtest_with_dynamic(subtests[i].name) {
 			for_each_pipe_with_single_output(&data->display, pipe, output) {
+				if (!extended &&
+				    pipe != active_pipes[0] &&
+				    pipe != active_pipes[last_pipe])
+					continue;
+
 				prepare_crtc(data, output, pipe);
 				if (!pipe_check(data, pipe, subtests[i].blend, subtests[i].must_multiply))
 					continue;
@@ -633,15 +667,40 @@ static void run_subtests(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)
 {
 	data_t data = {};
 
 	igt_fixture {
+		enum pipe pipe;
+
+		last_pipe = 0;
+
 		data.gfx_fd = drm_open_driver_master(DRIVER_ANY);
 		igt_require_pipe_crc(data.gfx_fd);
 		igt_display_require(&data.display, data.gfx_fd);
 		igt_require(data.display.is_atomic);
+
+		/* Get active pipes. */
+		for_each_pipe(&data.display, pipe)
+			active_pipes[last_pipe++] = pipe;
+		last_pipe--;
 	}
 
 	run_subtests(&data);
-- 
2.39.0

             reply	other threads:[~2023-02-09  4:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-09  4:42 Nidhi Gupta [this message]
2023-02-09  5:37 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_plane_alpha_blend: Limit the test execution (rev4) Patchwork
2023-02-09  5:38 ` [igt-dev] [PATCH i-g-t v4] tests/kms_plane_alpha_blend: Limit the test execution Nautiyal, Ankit K
2023-02-10  1:54 ` [igt-dev] ✗ Fi.CI.BAT: failure for tests/kms_plane_alpha_blend: Limit the test execution (rev5) Patchwork
2023-02-10  5:35   ` Gupta, Nidhi1
2023-02-10  2:39 ` [igt-dev] ✗ Fi.CI.IGT: failure for tests/kms_plane_alpha_blend: Limit the test execution (rev4) Patchwork
2023-02-10  5:34   ` Gupta, Nidhi1
2023-02-10 15:42 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_plane_alpha_blend: Limit the test execution (rev5) Patchwork
2023-02-10 16:29 ` Patchwork
2023-02-10 17:38 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_plane_alpha_blend: Limit the test execution (rev6) Patchwork
2023-02-11  0:42 ` [igt-dev] ✓ Fi.CI.IGT: success for tests/kms_plane_alpha_blend: Limit the test execution (rev5) Patchwork
2023-02-11  7:40 ` [igt-dev] ✓ Fi.CI.IGT: success for tests/kms_plane_alpha_blend: Limit the test execution (rev6) 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=20230209044219.4498-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