Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Swati Sharma <swati2.sharma@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [v3] tests/kms_plane_scaling: Add downscaling+upscaling tests
Date: Wed, 15 Feb 2023 12:57:53 +0530	[thread overview]
Message-ID: <20230215072753.26070-1-swati2.sharma@intel.com> (raw)

In newer hardware versions (i.e. display version >= 14), the second
scaler doesn't support downscaling. Current driver design in the
case of 2 plane scaling scenario is if plane1-US and plane2-DS,
it's reject for now. That's why new tests are added for plane1-DS
and plane2-US, so that different DS+US combinations can be validated.

v2: -minor fix
v3: -change to if-else ladder to switch (JP)

Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
---
 tests/kms_plane_scaling.c | 108 ++++++++++++++++++++++++++++++++------
 1 file changed, 91 insertions(+), 17 deletions(-)

diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
index 4a04f42a0..8b93a424c 100644
--- a/tests/kms_plane_scaling.c
+++ b/tests/kms_plane_scaling.c
@@ -31,7 +31,8 @@ IGT_TEST_DESCRIPTION("Test display plane scaling");
 enum scaler_combo_test_type {
 	TEST_PLANES_UPSCALE = 0,
 	TEST_PLANES_DOWNSCALE,
-	TEST_PLANES_UPSCALE_DOWNSCALE
+	TEST_PLANES_UPSCALE_DOWNSCALE,
+	TEST_PLANES_DOWNSCALE_UPSCALE
 };
 
 typedef struct {
@@ -286,6 +287,69 @@ const struct {
 		0.75,
 		TEST_PLANES_UPSCALE_DOWNSCALE,
 	},
+	{
+		"Tests downscaling (scaling factor 0.25) and upscaling (20x20) of 2 planes.",
+		"planes-downscale-factor-0-25-upscale-20x20",
+		0.25,
+		0.0,
+		TEST_PLANES_DOWNSCALE_UPSCALE,
+	},
+	{
+		"Tests downscaling (scaling factor 0.25) and upscaling (scaling factor 0.25) of 2 planes.",
+		"planes-downscale-factor-0-25-upscale-0-25",
+		0.25,
+		0.25,
+		TEST_PLANES_DOWNSCALE_UPSCALE,
+	},
+	{
+		"Tests downscaling (scaling factor 0.25) and scaling (unity) of 2 planes.",
+		"planes-downscale-factor-0-25-unity-scaling",
+		0.25,
+		1.0,
+		TEST_PLANES_DOWNSCALE_UPSCALE,
+	},
+	{
+		"Tests downscaling (scaling factor 0.5) and upscaling (20x20) of 2 planes.",
+		"planes-downscale-factor-0-5-upscale-20x20",
+		0.5,
+		0.0,
+		TEST_PLANES_DOWNSCALE_UPSCALE,
+	},
+	{
+		"Tests downscaling (scaling factor 0.5) and upscaling (scaling factor 0.25) of 2 planes.",
+		"planes-downscale-factor-0-5-upscale-0-25",
+		0.5,
+		0.25,
+		TEST_PLANES_DOWNSCALE_UPSCALE,
+	},
+	{
+		"Tests downscaling (scaling factor 0.5) and scaling (unity) of 2 planes.",
+		"planes-downscale-factor-0-5-unity-scaling",
+		0.5,
+		1.0,
+		TEST_PLANES_DOWNSCALE_UPSCALE,
+	},
+	{
+		"Tests downscaling (scaling factor 0.75) and upscaling (20x20) of 2 planes.",
+		"planes-downscale-factor-0-75-upscale-20x20",
+		0.75,
+		0.0,
+		TEST_PLANES_DOWNSCALE_UPSCALE,
+	},
+	{
+		"Tests downscaling (scaling factor 0.75) and upscaling (scaling factor 0.25) of 2 planes.",
+		"planes-downscale-factor-0-75-upscale-0-25",
+		0.75,
+		0.25,
+		TEST_PLANES_DOWNSCALE_UPSCALE,
+	},
+	{
+		"Tests downscaling (scaling factor 0.75) and scaling (unity) of 2 planes.",
+		"planes-downscale-factor-0-75-unity-scaling",
+		0.75,
+		1.0,
+		TEST_PLANES_DOWNSCALE_UPSCALE,
+	},
 };
 
 static int get_width(drmModeModeInfo *mode, double scaling_factor)
@@ -589,23 +653,25 @@ __test_planes_scaling_combo(data_t *d, int w1, int h1, int w2, int h2,
 	igt_plane_set_fb(p1, fb1);
 	igt_plane_set_fb(p2, fb2);
 
-	if (test_type == TEST_PLANES_UPSCALE) {
-		/* first plane upscaling */
+	switch (test_type) {
+	case TEST_PLANES_UPSCALE:
 		igt_plane_set_size(p1, mode->hdisplay, mode->vdisplay);
-		/* second plane upscaling */
 		igt_plane_set_size(p2, mode->hdisplay - 20, mode->vdisplay - 20);
-	}
-	if (test_type == TEST_PLANES_DOWNSCALE) {
-		/* first plane downscaling */
+		break;
+	case TEST_PLANES_DOWNSCALE:
 		igt_plane_set_size(p1, w1, h1);
-		/* second plane downscaling */
 		igt_plane_set_size(p2, w2, h2);
-	}
-	if (test_type == TEST_PLANES_UPSCALE_DOWNSCALE) {
-		/* first plane upscaling */
+		break;
+	case TEST_PLANES_UPSCALE_DOWNSCALE:
 		igt_plane_set_size(p1, mode->hdisplay, mode->vdisplay);
-		/* second plane downscaling */
 		igt_plane_set_size(p2, w2, h2);
+		break;
+	case TEST_PLANES_DOWNSCALE_UPSCALE:
+		igt_plane_set_size(p1, w1, h1);
+		igt_plane_set_size(p2, mode->hdisplay, mode->vdisplay);
+		break;
+	default:
+		igt_assert(0);
 	}
 
 	ret = igt_display_try_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
@@ -641,17 +707,25 @@ test_planes_scaling_combo(data_t *d, int w1, int h1, int w2, int h2,
 	igt_output_set_pipe(output, pipe);
 	mode = igt_output_get_mode(output);
 
-	if (test_type == TEST_PLANES_UPSCALE) {
+	switch (test_type) {
+	case TEST_PLANES_UPSCALE:
 		setup_fb(display->drm_fd, w1, h1, 1.0, 0.0, 0.0, &d->fb[1]);
 		setup_fb(display->drm_fd, w2, h2, 0.0, 1.0, 0.0, &d->fb[2]);
-	}
-	if (test_type == TEST_PLANES_DOWNSCALE) {
+		break;
+	case TEST_PLANES_DOWNSCALE:
 		setup_fb(display->drm_fd, mode->hdisplay, mode->vdisplay, 1.0, 0.0, 0.0, &d->fb[1]);
 		setup_fb(display->drm_fd, mode->hdisplay, mode->vdisplay, 0.0, 1.0, 0.0, &d->fb[2]);
-	}
-	if (test_type == TEST_PLANES_UPSCALE_DOWNSCALE) {
+		break;
+	case TEST_PLANES_UPSCALE_DOWNSCALE:
 		setup_fb(display->drm_fd, w1, h1, 1.0, 0.0, 0.0, &d->fb[1]);
 		setup_fb(display->drm_fd, mode->hdisplay, mode->vdisplay, 0.0, 1.0, 0.0, &d->fb[2]);
+		break;
+	case TEST_PLANES_DOWNSCALE_UPSCALE:
+		setup_fb(display->drm_fd, mode->hdisplay, mode->vdisplay, 0.0, 1.0, 0.0, &d->fb[1]);
+		setup_fb(display->drm_fd, w1, h1, 1.0, 0.0, 0.0, &d->fb[2]);
+		break;
+	default:
+		igt_assert(0);
 	}
 
 	for (int k = 0; k < display->pipes[pipe].n_planes; k++) {
-- 
2.25.1

             reply	other threads:[~2023-02-15  7:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-15  7:27 Swati Sharma [this message]
2023-02-15  8:07 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_plane_scaling: Add downscaling+upscaling tests (rev3) Patchwork
2023-02-15 20:40 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2023-02-15  7:36 [igt-dev] [v3] tests/kms_plane_scaling: Add downscaling+upscaling tests Swati Sharma
2023-02-16 15:29 ` Juha-Pekka Heikkila
2023-02-17  7:03   ` Swati Sharma

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=20230215072753.26070-1-swati2.sharma@intel.com \
    --to=swati2.sharma@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