public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 3/3] tests/kms_plane_scaling: Don't test every pixel format
Date: Thu, 30 Jan 2020 17:12:29 +0200	[thread overview]
Message-ID: <20200130151229.984-3-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20200130151229.984-1-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

We probably don't need to test every pixel format, so let's just
test one format for each format "class" (as defined by
igt_reduce_format()).

Speeds up the test considerably (on KBL):
$ time ./build/tests/kms_plane_scaling --r pipe-A-scaler-with-clipping-clamping
- real	0m25,186s
+ real	0m3,440s

As with kms_plane we'll add a new command line argument (--extended)
which can be used to test all formats.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 tests/kms_plane_scaling.c | 80 ++++++++++++++++++++++++++++++++++++---
 1 file changed, 74 insertions(+), 6 deletions(-)

diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
index 35aac8dad078..19087286a0f9 100644
--- a/tests/kms_plane_scaling.c
+++ b/tests/kms_plane_scaling.c
@@ -23,6 +23,7 @@
  */
 
 #include "igt.h"
+#include "igt_vec.h"
 #include <math.h>
 
 
@@ -43,6 +44,7 @@ typedef struct {
 	igt_plane_t *plane2;
 	igt_plane_t *plane3;
 	igt_plane_t *plane4;
+	bool extended;
 } data_t;
 
 static int get_num_scalers(data_t* d, enum pipe pipe)
@@ -221,6 +223,28 @@ static bool can_scale(data_t *d, unsigned format)
 	}
 }
 
+static bool test_format(data_t *data,
+			struct igt_vec *tested_formats,
+			uint32_t format)
+{
+	if (!igt_fb_supported_format(format))
+		return false;
+
+	if (!is_i915_device(data->drm_fd) ||
+	    data->extended)
+		return true;
+
+	format = igt_reduce_format(format);
+
+	/* only test each format "class" once */
+	if (igt_vec_index(tested_formats, &format) >= 0)
+		return false;
+
+	igt_vec_push(tested_formats, &format);
+
+	return true;
+}
+
 static void test_scaler_with_rotation_pipe(data_t *d, enum pipe pipe,
 					   igt_output_t *output)
 {
@@ -236,10 +260,14 @@ static void test_scaler_with_rotation_pipe(data_t *d, enum pipe pipe,
 
 		for (int i = 0; i < ARRAY_SIZE(rotations); i++) {
 			igt_rotation_t rot = rotations[i];
+			struct igt_vec tested_formats;
+
+			igt_vec_init(&tested_formats, sizeof(uint32_t));
+
 			for (int j = 0; j < plane->drm_plane->count_formats; j++) {
 				unsigned format = plane->drm_plane->formats[j];
 
-				if (igt_fb_supported_format(format) &&
+				if (test_format(d, &tested_formats, format) &&
 				    igt_plane_has_format_mod(plane, format, tiling) &&
 				    can_rotate(d, format, tiling, rot) &&
 				    can_scale(d, format))
@@ -247,6 +275,8 @@ static void test_scaler_with_rotation_pipe(data_t *d, enum pipe pipe,
 								     tiling, pipe,
 								     output, rot);
 			}
+
+			igt_vec_fini(&tested_formats);
 		}
 	}
 }
@@ -271,17 +301,22 @@ static void test_scaler_with_pixel_format_pipe(data_t *d, enum pipe pipe, igt_ou
 
 		for (int i = 0; i < ARRAY_SIZE(tilings); i++) {
 			uint64_t tiling = tilings[i];
+			struct igt_vec tested_formats;
+
+			igt_vec_init(&tested_formats, sizeof(uint32_t));
 
 			for (int j = 0; j < plane->drm_plane->count_formats; j++) {
 				uint32_t format = plane->drm_plane->formats[j];
 
-				if (igt_fb_supported_format(format) &&
+				if (test_format(d, &tested_formats, format) &&
 				    igt_plane_has_format_mod(plane, format, tiling) &&
 				    can_scale(d, format))
 					check_scaling_pipe_plane_rot(d, plane,
 								     format, tiling,
 								     pipe, output, IGT_ROTATION_0);
 			}
+
+			igt_vec_fini(&tested_formats);
 		}
 	}
 }
@@ -502,6 +537,7 @@ test_scaler_with_clipping_clamping_scenario(data_t *d, enum pipe pipe, igt_outpu
 {
 	igt_pipe_t *pipe_obj = &d->display.pipes[pipe];
 	drmModeModeInfo *mode;
+	struct igt_vec tested_formats1;
 
 	igt_require(get_num_scalers(d, pipe) >= 2);
 
@@ -510,22 +546,32 @@ test_scaler_with_clipping_clamping_scenario(data_t *d, enum pipe pipe, igt_outpu
 	d->plane2 = igt_pipe_get_plane_type(pipe_obj, DRM_PLANE_TYPE_OVERLAY);
 	prepare_crtc(d, output, pipe, d->plane1, mode);
 
+	igt_vec_init(&tested_formats1, sizeof(uint32_t));
+
 	for (int i = 0; i < d->plane1->drm_plane->count_formats; i++) {
 		unsigned f1 = d->plane1->drm_plane->formats[i];
-		if (!igt_fb_supported_format(f1) ||
+		struct igt_vec tested_formats2;
+
+		if (!test_format(d, &tested_formats1, f1) ||
 		    !can_scale(d, f1))
 			continue;
 
+		igt_vec_init(&tested_formats2, sizeof(uint32_t));
+
 		for (int j = 0; j < d->plane2->drm_plane->count_formats; j++) {
 			unsigned f2 = d->plane2->drm_plane->formats[j];
 
-			if (!igt_fb_supported_format(f2) ||
+			if (!test_format(d, &tested_formats2, f2) ||
 			    !can_scale(d, f2))
 				continue;
 
 			__test_scaler_with_clipping_clamping_scenario(d, mode, f1, f2);
 		}
+
+		igt_vec_fini(&tested_formats2);
 	}
+
+	igt_vec_fini(&tested_formats1);
 }
 
 static void find_connected_pipe(igt_display_t *display, bool second, enum pipe *pipe, igt_output_t **output)
@@ -619,9 +665,31 @@ static void test_scaler_with_multi_pipe_plane(data_t *d)
 	igt_display_commit2(display, COMMIT_ATOMIC);
 }
 
-igt_main
+static int opt_handler(int opt, int opt_index, void *_data)
+{
+	data_t *data = _data;
+
+	switch (opt) {
+	case 'e':
+		data->extended = true;
+		break;
+	}
+
+	return IGT_OPT_HANDLER_SUCCESS;
+}
+
+static const struct option long_opts[] = {
+	{ .name = "extended", .has_arg = false, .val = 'e', },
+	{}
+};
+
+static const char help_str[] =
+	"  --extended\t\tRun the extended tests\n";
+
+static data_t data;
+
+igt_main_args("", long_opts, help_str, opt_handler, &data)
 {
-	data_t data = {};
 	enum pipe pipe;
 
 	igt_fixture {
-- 
2.24.1

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

  parent reply	other threads:[~2020-01-30 15:12 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-30 15:12 [igt-dev] [PATCH i-g-t 1/3] lib/vec: Add igt_vec Ville Syrjala
2020-01-30 15:12 ` [igt-dev] [PATCH i-g-t 2/3] lib/igt_kms: Add igt_reduce_format() Ville Syrjala
2020-01-30 15:38   ` Chris Wilson
2020-02-03 16:35   ` [igt-dev] [PATCH i-g-t v2 " Ville Syrjala
2020-01-30 15:12 ` Ville Syrjala [this message]
2020-01-30 15:40   ` [igt-dev] [PATCH i-g-t 3/3] tests/kms_plane_scaling: Don't test every pixel format Chris Wilson
2020-01-30 15:57     ` Ville Syrjälä
2020-01-30 15:31 ` [igt-dev] [PATCH i-g-t 1/3] lib/vec: Add igt_vec Chris Wilson
2020-01-30 15:54   ` Ville Syrjälä
2020-01-30 16:00     ` Chris Wilson
2020-01-30 16:10 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] " Patchwork
2020-02-02  4:41 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2020-02-03 16:34 ` [igt-dev] [PATCH i-g-t v2 1/3] " Ville Syrjala
2020-02-04 12:36 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v2,1/3] lib/vec: Add igt_vec (rev3) Patchwork
2020-02-06 10:27 ` [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=20200130151229.984-3-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.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