All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stylon Wang <stylon.wang@amd.com>
To: igt-dev@lists.freedesktop.org
Cc: Bhawanpreet.Lakha@amd.com, Ahmad.Othman@amd.com,
	Hayden.Goodfellow@amd.com
Subject: [igt-dev] [PATCH i-g-t v2 07/11] tests/amdgpu/amd_plane: Create mpo scaling tests
Date: Wed, 1 Dec 2021 14:54:30 +0800	[thread overview]
Message-ID: <20211201065434.48827-8-stylon.wang@amd.com> (raw)
In-Reply-To: <20211201065434.48827-1-stylon.wang@amd.com>

From: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>

[Why]
Resizing MPO window is a common usecase (video in windowed mode)

Our MPO feature has scaling limitations (0.25x -> 16x). So this test
creates a window of various reolutions and scales them between 0.25x -> 16x

[How]
The test creates common video sizes and scales them from (0.30x->16x).
The lower limit is 0.25 but some combination of configs fail at 0.25x so
0.30 is used as the starting point.

CRTC#1                            CRTC#1
+--------------------+           +---------------------+
| +-------+          |           | +------------+      |
| |Primary|          |           | |Primary     |      |
| +-------+          |    -->    | |            |      |
|                    |   scale   | |            |      |
|                    |           | +------------+      |
|overlay             |           |Overlay              |
+--------------------+           +---------------------+

Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
---
 tests/amdgpu/amd_plane.c | 53 ++++++++++++++++++++++++++++++++++------
 1 file changed, 46 insertions(+), 7 deletions(-)

diff --git a/tests/amdgpu/amd_plane.c b/tests/amdgpu/amd_plane.c
index fe2389df..9506421d 100644
--- a/tests/amdgpu/amd_plane.c
+++ b/tests/amdgpu/amd_plane.c
@@ -141,7 +141,8 @@ static void lut_free(lut_t *lut)
 
 enum test {
 	MPO_SINGLE_PAN,
-	MPO_MULTI_PAN
+	MPO_MULTI_PAN,
+	MPO_SCALE
 };
 
 static void test_init(data_t *data)
@@ -273,7 +274,7 @@ static void set_regamma_lut(data_t *data, lut_t const *lut, int n)
  * NOTE: The reason for using White+White is to speed up the crc (reuse the ref crc for all cases vs taking
  * a ref crc per flip)
  */
-static void test_plane(data_t *data, int n, int x, int y, int w, int h, int pw, int ph, struct fbc *fbc){
+static void test_plane(data_t *data, int n, int x, int y, double w, double h, double scale, int pw, int ph, struct fbc *fbc){
 
 	igt_crc_t test_crc;
 	igt_display_t *display = &data->display;
@@ -290,14 +291,14 @@ static void test_plane(data_t *data, int n, int x, int y, int w, int h, int pw,
 	/* Test: */
 	/* Draw a white overlay with a cutout */
 	draw_color_alpha(&fbc[n].test_overlay, 0, 0, pw, ph, 1.0, 1.0, 1.0, 1.00);
-	draw_color_alpha(&fbc[n].test_overlay, x, y, w, h, 0.0, 0.0, 0.0, 0.0);
+	draw_color_alpha(&fbc[n].test_overlay, x, y, w*scale, h*scale, 0.0, 0.0, 0.0, 0.0);
 
 	igt_plane_set_fb(data->primary[n], &fbc[n].test_primary);
 	igt_plane_set_fb(data->overlay[n], &fbc[n].test_overlay);
 
 	/* Move the overlay to cover the cutout */
 	igt_plane_set_position(data->primary[n], x, y);
-	igt_plane_set_size(data->primary[n], w, h);
+	igt_plane_set_size(data->primary[n], w*scale, h*scale);
 
 	igt_display_commit_atomic(display, 0, 0);
 	igt_pipe_crc_collect_crc(data->pipe_crc[n], &test_crc);
@@ -350,7 +351,7 @@ static void test_panning_1_display(data_t *data, int display_count, int w, int h
 				if (pw <= w && ph <= h)
 					break;
 
-				test_plane(data, n, x, y, w, h, pw, ph, fb);
+				test_plane(data, n, x, y, w, h, 1.0, pw, ph, fb);
 
 			}
 		}
@@ -361,6 +362,40 @@ static void test_panning_1_display(data_t *data, int display_count, int w, int h
 
 }
 
+ /* MPO_SCALE: This test scales a window of size (w,h) from x1/4->x16.
+  */
+static void test_scaling_planes(data_t *data, int display_count, int w, int h, struct fbc *fb)
+{
+
+	/* Scale limit is x1/4 -> x16
+	 * some combinations of mode/window sizes fail for x0.25 so start from 0.30 -> 16
+	 */
+	double scale[]= {
+		0.30,
+		0.50,
+		0.75,
+		1.50,
+		3.00,
+		6.00,
+		12.00,
+		16.00
+
+	};
+
+	for (int n = 0; n < display_count; n++) {
+		int pw = data->w[n];
+		int ph = data->h[n];
+
+		for (int i=0;i<ARRAY_SIZE(scale);i++) {
+			/* No need to scale a overley that is bigger than the display */
+			if (pw <= w*scale[i] && ph <= h*scale[i])
+				break;
+			test_plane(data, n, 0, 0, w, h, scale[i], pw, ph, fb);
+		}
+	}
+
+	return;
+}
 /*
  * MPO_MULTI_PAN: Requires 2 displays. This test swaps a window (w,h) between 2 displays at 3 different
  * vertical locations (top, middle, bottom)
@@ -390,9 +425,9 @@ static void test_panning_2_display(data_t *data, int w, int h, struct fbc *fbc)
 	for (int j = 0; j < ARRAY_SIZE(y); j++){
 		for (int i = 0; i < it; i++){
 			if (toggle)
-				test_plane(data, 0, pw-w, y[j], w, h, pw, ph, fbc);
+				test_plane(data, 0, pw-w, y[j], w, h, 1.0, pw, ph, fbc);
 			else
-				test_plane(data, 1, 0, y[j], w, h, pw2, ph2, fbc);
+				test_plane(data, 1, 0, y[j], w, h, 1.0, pw2, ph2, fbc);
 
 			toggle = !toggle;
 		}
@@ -472,6 +507,8 @@ static void test_display_mpo(data_t *data, enum test test, uint32_t format, int
 			test_panning_1_display(data, display_count, videos[i][0], videos[i][1], fb);
 		if (test == MPO_MULTI_PAN)
 			test_panning_2_display(data, videos[i][0], videos[i][1], fb);
+		if(test == MPO_SCALE)
+			test_scaling_planes(data, display_count, videos[i][0], videos[i][1], fb);
 
 		for (int n = 0; n < display_count; n++)
 			igt_remove_fb(data->fd, &fb[n].test_primary);
@@ -707,6 +744,8 @@ igt_main
 	igt_subtest("mpo-pan-nv12") test_display_mpo(&data, MPO_SINGLE_PAN, DRM_FORMAT_NV12, DISPLAYS_TO_TEST);
 	igt_subtest("mpo-pan-multi-rgb") test_display_mpo(&data, MPO_MULTI_PAN, DRM_FORMAT_XRGB8888, DISPLAYS_TO_TEST);
 	igt_subtest("mpo-pan-multi-nv12") test_display_mpo(&data, MPO_MULTI_PAN, DRM_FORMAT_NV12, DISPLAYS_TO_TEST);
+	igt_subtest("mpo-scale-rgb") test_display_mpo(&data, MPO_SCALE, DRM_FORMAT_XRGB8888, DISPLAYS_TO_TEST);
+	igt_subtest("mpo-scale-nv12") test_display_mpo(&data, MPO_SCALE, DRM_FORMAT_NV12, DISPLAYS_TO_TEST);
 
 	igt_fixture
 	{
-- 
2.33.1

  parent reply	other threads:[~2021-12-01  6:55 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-30  8:34 [igt-dev] [PATCH i-g-t 00/11] Create tests for multi-plane overlay Stylon Wang
2021-11-30  8:34 ` [igt-dev] [PATCH i-g-t 01/11] tests/amdgpu/amd_plane: Introduced 4K MPO test Stylon Wang
2021-11-30  8:34 ` [igt-dev] [PATCH i-g-t 02/11] tests/amdgpu/amd_plane: Add MPO swizzle mode toggle test Stylon Wang
2021-11-30  8:34 ` [igt-dev] [PATCH i-g-t 03/11] tests/amdgpu/amd_plane: fixes for test-4k-mpo Stylon Wang
2021-11-30  8:34 ` [igt-dev] [PATCH i-g-t 04/11] tests/amdgpu/amd_plane: Switch mpo-swizzle-toggle to single-head Stylon Wang
2021-11-30  8:34 ` [igt-dev] [PATCH i-g-t 05/11] tests/amdgpu/amd_plane: Create mpo panning test Stylon Wang
2021-11-30  8:34 ` [igt-dev] [PATCH i-g-t 06/11] tests/amdgpu/amd_plane: Create mpo swap between 2 displays test Stylon Wang
2021-11-30  8:34 ` [igt-dev] [PATCH i-g-t 07/11] tests/amdgpu/amd_plane: Create mpo scaling tests Stylon Wang
2021-11-30  8:35 ` [igt-dev] [PATCH i-g-t 08/11] tests/amdgpu/amd_plane: Add MPO scale and pan subtest single display option Stylon Wang
2021-11-30  8:35 ` [igt-dev] [PATCH i-g-t 09/11] tests/amdgpu/amd_plane: Add full screen scaling test case Stylon Wang
2021-11-30  8:35 ` [igt-dev] [PATCH i-g-t 10/11] tests/amdgpu/amd_plane: Ensure pipes are enabled before accessing Stylon Wang
2021-11-30  8:35 ` [igt-dev] [PATCH i-g-t 11/11] tests/amdgpu/amd_plane: Add P010 format to MPO tests and add test descriptions Stylon Wang
2021-11-30 11:10 ` [igt-dev] ✗ Fi.CI.BUILD: failure for Create tests for multi-plane overlay Patchwork
2021-12-01  6:54 ` [igt-dev] [PATCH i-g-t v2 00/11] " Stylon Wang
2021-12-01  6:54   ` [igt-dev] [PATCH i-g-t v2 01/11] tests/amdgpu/amd_plane: Introduced 4K MPO test Stylon Wang
2021-12-01  6:54   ` [igt-dev] [PATCH i-g-t v2 02/11] tests/amdgpu/amd_plane: Add MPO swizzle mode toggle test Stylon Wang
2021-12-01  6:54   ` [igt-dev] [PATCH i-g-t v2 03/11] tests/amdgpu/amd_plane: fixes for test-4k-mpo Stylon Wang
2021-12-01  6:54   ` [igt-dev] [PATCH i-g-t v2 04/11] tests/amdgpu/amd_plane: Switch mpo-swizzle-toggle to single-head Stylon Wang
2021-12-01  6:54   ` [igt-dev] [PATCH i-g-t v2 05/11] tests/amdgpu/amd_plane: Create mpo panning test Stylon Wang
2021-12-01  6:54   ` [igt-dev] [PATCH i-g-t v2 06/11] tests/amdgpu/amd_plane: Create mpo swap between 2 displays test Stylon Wang
2021-12-01  6:54   ` Stylon Wang [this message]
2021-12-01  6:54   ` [igt-dev] [PATCH i-g-t v2 08/11] tests/amdgpu/amd_plane: Add MPO scale and pan subtest single display option Stylon Wang
2021-12-01  6:54   ` [igt-dev] [PATCH i-g-t v2 09/11] tests/amdgpu/amd_plane: Add full screen scaling test case Stylon Wang
2021-12-01  6:54   ` [igt-dev] [PATCH i-g-t v2 10/11] tests/amdgpu/amd_plane: Ensure pipes are enabled before accessing Stylon Wang
2021-12-01  6:54   ` [igt-dev] [PATCH i-g-t v2 11/11] tests/amdgpu/amd_plane: Add P010 format to MPO tests and add test descriptions Stylon Wang
2021-12-01 22:09 ` [igt-dev] [PATCH i-g-t 00/11] Create tests for multi-plane overlay Rodrigo Siqueira Jordao

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=20211201065434.48827-8-stylon.wang@amd.com \
    --to=stylon.wang@amd.com \
    --cc=Ahmad.Othman@amd.com \
    --cc=Bhawanpreet.Lakha@amd.com \
    --cc=Hayden.Goodfellow@amd.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 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.