All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t v4 0/7] MPO + pipe color test
@ 2022-11-10  5:53 Ananya Sharma
  2022-11-10  5:53 ` [igt-dev] [PATCH i-g-t v4 1/7] tests/kms_color_helper: helper to enable " Ananya Sharma
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Ananya Sharma @ 2022-11-10  5:53 UTC (permalink / raw)
  To: igt-dev

This series includes tests for degamma, gamma, ctm transformation
for both kms_color as well as kms_color_chamelium. Few changes are
also made in kms_color_helper to support multiplanes with different
formats.

Ananya Sharma (7):
  tests/kms_color_helper: helper to enable MPO + pipe color test
  tests/kms_color: MPO + pipe color test for degamma
  tests/kms_color: MPO + pipe color test for gamma
  tests/kms_color: MPO + pipe color test for ctm
  tests/chamelium/kms_color_chamelium: MPO + pipe color test for degamma
  tests/chamelium/kms_color_chamelium: MPO + pipe color test for gamma
  tests/chamelium/kms_color_chamelium: MPO + pipe color test for ctm

 tests/chamelium/kms_color_chamelium.c | 365 ++++++++++++++++------
 tests/kms_color.c                     | 433 +++++++++++++++++++-------
 tests/kms_color_helper.c              |  26 +-
 tests/kms_color_helper.h              |  10 +-
 4 files changed, 612 insertions(+), 222 deletions(-)

-- 
2.25.1

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [igt-dev] [PATCH i-g-t v4 1/7] tests/kms_color_helper: helper to enable MPO + pipe color test
  2022-11-10  5:53 [igt-dev] [PATCH i-g-t v4 0/7] MPO + pipe color test Ananya Sharma
@ 2022-11-10  5:53 ` Ananya Sharma
  2022-11-10  5:53 ` [igt-dev] [PATCH i-g-t v4 2/7] tests/kms_color: MPO + pipe color test for degamma Ananya Sharma
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Ananya Sharma @ 2022-11-10  5:53 UTC (permalink / raw)
  To: igt-dev

Adding support of multiple planes in pipe color test by splitting the
screen into two parts i.e. one plane having RGB format and another
one having NV12 format. To add this support for multiple planes the
two functions paint_rectangle() and paint_gradient_rectangle() are
modified in kms_color_helper accordingly. This patch contains the
effected changes that will take place in kms_color and
kms_color_chamelium due to the changes in kms_color_helper.

Signed-off-by: Ananya Sharma <ananya.sharma@intel.com>
---
 tests/chamelium/kms_color_chamelium.c | 23 +++++++++++++++--------
 tests/kms_color.c                     | 24 ++++++++++++++++--------
 tests/kms_color_helper.c              | 26 +++++++++++++++-----------
 tests/kms_color_helper.h              | 10 ++++++++--
 4 files changed, 54 insertions(+), 29 deletions(-)

diff --git a/tests/chamelium/kms_color_chamelium.c b/tests/chamelium/kms_color_chamelium.c
index 907f4dd5..4a8cb339 100644
--- a/tests/chamelium/kms_color_chamelium.c
+++ b/tests/chamelium/kms_color_chamelium.c
@@ -85,12 +85,14 @@ static bool test_pipe_degamma(data_t *data,
 	igt_display_commit(&data->display);
 
 	/* Draw solid colors with linear degamma transformation. */
-	paint_rectangles(data, mode, red_green_blue, &fbref);
+	paint_rectangles(data, mode->vdisplay, mode->hdisplay,
+			 0, 0, red_green_blue, &fbref);
 
 	/* Draw a gradient with degamma LUT to remap all
 	 * values to max red/green/blue.
 	 */
-	paint_gradient_rectangles(data, mode, red_green_blue, &fb);
+	paint_gradient_rectangles(data, mode->vdisplay, mode->hdisplay,
+				  0, 0, red_green_blue, &fb);
 	igt_plane_set_fb(primary, &fb);
 	set_degamma(data, primary->pipe, degamma_full);
 	igt_display_commit(&data->display);
@@ -175,12 +177,14 @@ static bool test_pipe_gamma(data_t *data,
 	igt_display_commit(&data->display);
 
 	/* Draw solid colors with no gamma transformation. */
-	paint_rectangles(data, mode, red_green_blue, &fbref);
+	paint_rectangles(data, mode->vdisplay, mode->hdisplay,
+			 0, 0, red_green_blue, &fbref);
 
 	/* Draw a gradient with gamma LUT to remap all values
 	 * to max red/green/blue.
 	 */
-	paint_gradient_rectangles(data, mode, red_green_blue, &fb);
+	paint_gradient_rectangles(data, mode->vdisplay, mode->hdisplay,
+				  0, 0, red_green_blue, &fb);
 	igt_plane_set_fb(primary, &fb);
 	igt_display_commit(&data->display);
 	chamelium_capture(data->chamelium, port, 0, 0, 0, 0, 1);
@@ -269,10 +273,11 @@ static bool test_pipe_ctm(data_t *data,
 	disable_ctm(primary->pipe);
 	igt_display_commit(&data->display);
 
-	paint_rectangles(data, mode, after, &fbref);
+	paint_rectangles(data, mode->vdisplay, mode->hdisplay,
+			 0, 0, after, &fbref);
 
 	/* With CTM transformation. */
-	paint_rectangles(data, mode, before, &fb);
+	paint_rectangles(data, mode->vdisplay, mode->hdisplay, 0, 0, before, &fb);
 	igt_plane_set_fb(primary, &fb);
 	set_ctm(primary->pipe, ctm_matrix);
 	igt_display_commit(&data->display);
@@ -367,7 +372,8 @@ static bool test_pipe_limited_range_ctm(data_t *data,
 	igt_output_set_prop_value(output,
 				  IGT_CONNECTOR_BROADCAST_RGB,
 				  BROADCAST_RGB_FULL);
-	paint_rectangles(data, mode, red_green_blue_limited, &fb);
+	paint_rectangles(data, mode->vdisplay, mode->hdisplay,
+			 0, 0, red_green_blue_limited, &fb);
 	igt_plane_set_fb(primary, &fb);
 	igt_display_commit(&data->display);
 
@@ -375,7 +381,8 @@ static bool test_pipe_limited_range_ctm(data_t *data,
 	igt_output_set_prop_value(output,
 				  IGT_CONNECTOR_BROADCAST_RGB,
 				  BROADCAST_RGB_16_235);
-	paint_rectangles(data, mode, red_green_blue_full, &fb);
+	paint_rectangles(data, mode->vdisplay, mode->hdisplay,
+			 0, 0, red_green_blue_full, &fb);
 
 	/* And reset.. */
 	igt_output_set_prop_value(output,
diff --git a/tests/kms_color.c b/tests/kms_color.c
index e4dc2465..cbe3c391 100644
--- a/tests/kms_color.c
+++ b/tests/kms_color.c
@@ -76,7 +76,8 @@ static bool test_pipe_degamma(data_t *data,
 	igt_display_commit(&data->display);
 
 	/* Draw solid colors with linear degamma transformation. */
-	paint_rectangles(data, mode, red_green_blue, &fb);
+	paint_rectangles(data, mode->vdisplay, mode->hdisplay,
+			 0, 0, red_green_blue, &fb);
 	igt_plane_set_fb(primary, &fb);
 	igt_display_commit(&data->display);
 	igt_wait_for_vblank(data->drm_fd,
@@ -87,7 +88,8 @@ static bool test_pipe_degamma(data_t *data,
 	 * Draw a gradient with degamma LUT to remap all
 	 * values to max red/green/blue.
 	 */
-	paint_gradient_rectangles(data, mode, red_green_blue, &fb);
+	paint_gradient_rectangles(data, mode->vdisplay, mode->hdisplay,
+				  0, 0, red_green_blue, &fb);
 	igt_plane_set_fb(primary, &fb);
 	set_degamma(data, primary->pipe, degamma_full);
 	igt_display_commit(&data->display);
@@ -166,7 +168,8 @@ static bool test_pipe_gamma(data_t *data,
 	igt_display_commit(&data->display);
 
 	/* Draw solid colors with no gamma transformation. */
-	paint_rectangles(data, mode, red_green_blue, &fb);
+	paint_rectangles(data, mode->vdisplay, mode->hdisplay,
+			 0, 0, red_green_blue, &fb);
 	igt_plane_set_fb(primary, &fb);
 	igt_display_commit(&data->display);
 	igt_wait_for_vblank(data->drm_fd,
@@ -177,7 +180,8 @@ static bool test_pipe_gamma(data_t *data,
 	 * Draw a gradient with gamma LUT to remap all values
 	 * to max red/green/blue.
 	 */
-	paint_gradient_rectangles(data, mode, red_green_blue, &fb);
+	paint_gradient_rectangles(data, mode->vdisplay, mode->hdisplay,
+				  0, 0, red_green_blue, &fb);
 	igt_plane_set_fb(primary, &fb);
 	igt_display_commit(&data->display);
 	igt_wait_for_vblank(data->drm_fd,
@@ -261,7 +265,8 @@ static bool test_pipe_legacy_gamma(data_t *data,
 	igt_display_commit(&data->display);
 
 	/* Draw solid colors with no gamma transformation. */
-	paint_rectangles(data, mode, red_green_blue, &fb);
+	paint_rectangles(data, mode->vdisplay, mode->hdisplay,
+			 0, 0, red_green_blue, &fb);
 	igt_plane_set_fb(primary, &fb);
 	igt_display_commit(&data->display);
 	igt_wait_for_vblank(data->drm_fd,
@@ -272,7 +277,8 @@ static bool test_pipe_legacy_gamma(data_t *data,
 	 * Draw a gradient with gamma LUT to remap all values
 	 * to max red/green/blue.
 	 */
-	paint_gradient_rectangles(data, mode, red_green_blue, &fb);
+	paint_gradient_rectangles(data, mode->vdisplay, mode->hdisplay,
+				  0, 0, red_green_blue, &fb);
 	igt_plane_set_fb(primary, &fb);
 
 	red_lut[0] = green_lut[0] = blue_lut[0] = 0;
@@ -513,7 +519,8 @@ static bool test_pipe_ctm(data_t *data,
 	disable_ctm(primary->pipe);
 	igt_display_commit(&data->display);
 
-	paint_rectangles(data, mode, after, &fb);
+	paint_rectangles(data, mode->vdisplay, mode->hdisplay,
+			 0, 0, after, &fb);
 	igt_plane_set_fb(primary, &fb);
 	set_ctm(primary->pipe, ctm_identity);
 	igt_display_commit(&data->display);
@@ -522,7 +529,8 @@ static bool test_pipe_ctm(data_t *data,
 	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_software);
 
 	/* With CTM transformation. */
-	paint_rectangles(data, mode, before, &fb);
+	paint_rectangles(data, mode->vdisplay, mode->hdisplay,
+			 0, 0, before, &fb);
 	igt_plane_set_fb(primary, &fb);
 	set_ctm(primary->pipe, ctm_matrix);
 	igt_display_commit(&data->display);
diff --git a/tests/kms_color_helper.c b/tests/kms_color_helper.c
index 55f3e409..dbcb3f34 100644
--- a/tests/kms_color_helper.c
+++ b/tests/kms_color_helper.c
@@ -41,20 +41,22 @@ uint64_t get_max_bpc(igt_output_t *output)
 }
 
 void paint_gradient_rectangles(data_t *data,
-			       drmModeModeInfo *mode,
+			       uint16_t vdisplay,
+			       uint16_t hdisplay,
+			       int x, int y,
 			       color_t *colors,
 			       struct igt_fb *fb)
 {
 	cairo_t *cr = igt_get_cairo_ctx(data->drm_fd, fb);
-	int i, l = mode->hdisplay / 3;
-	int rows_remaining = mode->hdisplay % 3;
+	int i, l = hdisplay / 3;
+	int rows_remaining = hdisplay % 3;
 
 	/* Paint 3 gradient rectangles with red/green/blue between 1.0 and
 	 * 0.5. We want to avoid 0 so each max LUTs only affect their own
 	 * rectangle.
 	 */
 	for (i = 0 ; i < 3; i++) {
-		igt_paint_color_gradient_range(cr, i * l, 0, l, mode->vdisplay,
+		igt_paint_color_gradient_range(cr, (x + (i * l)), y, l, vdisplay,
 					       colors[i].r != 0 ? 0.2 : 0,
 					       colors[i].g != 0 ? 0.2 : 0,
 					       colors[i].b != 0 ? 0.2 : 0,
@@ -64,8 +66,8 @@ void paint_gradient_rectangles(data_t *data,
 	}
 
 	if (rows_remaining > 0)
-		igt_paint_color_gradient_range(cr, i * l, 0, rows_remaining,
-					       mode->vdisplay,
+		igt_paint_color_gradient_range(cr, (x + (i * l)), y, rows_remaining,
+					       vdisplay,
 					       colors[i-1].r != 0 ? 0.2 : 0,
 					       colors[i-1].g != 0 ? 0.2 : 0,
 					       colors[i-1].b != 0 ? 0.2 : 0,
@@ -77,22 +79,24 @@ void paint_gradient_rectangles(data_t *data,
 }
 
 void paint_rectangles(data_t *data,
-		      drmModeModeInfo *mode,
+		      uint16_t vdisplay,
+		      uint16_t hdisplay,
+		      int x, int y,
 		      color_t *colors,
 		      struct igt_fb *fb)
 {
 	cairo_t *cr = igt_get_cairo_ctx(data->drm_fd, fb);
-	int i, l = mode->hdisplay / 3;
-	int rows_remaining = mode->hdisplay % 3;
+	int i, l = hdisplay / 3;
+	int rows_remaining = hdisplay % 3;
 
 	/* Paint 3 solid rectangles. */
 	for (i = 0 ; i < 3; i++) {
-		igt_paint_color(cr, i * l, 0, l, mode->vdisplay,
+		igt_paint_color(cr, (x + (i * l)), y, l, vdisplay,
 				colors[i].r, colors[i].g, colors[i].b);
 	}
 
 	if (rows_remaining > 0)
-		igt_paint_color(cr, i * l, 0, rows_remaining, mode->vdisplay,
+		igt_paint_color(cr, (x + (i * l)), y, rows_remaining, vdisplay,
 				colors[i-1].r, colors[i-1].g, colors[i-1].b);
 
 	igt_put_cairo_ctx(cr);
diff --git a/tests/kms_color_helper.h b/tests/kms_color_helper.h
index f0ae30e3..199d449c 100644
--- a/tests/kms_color_helper.h
+++ b/tests/kms_color_helper.h
@@ -51,9 +51,11 @@ typedef struct {
 	igt_pipe_crc_t *pipe_crc;
 	igt_output_t *output;
 	igt_plane_t *primary;
+	igt_plane_t *overlay;
 	drmModeModeInfo *mode;
 
 	uint32_t drm_format;
+	uint32_t drm_format_overlay;
 	uint32_t color_depth;
 	uint64_t degamma_lut_size;
 	uint64_t gamma_lut_size;
@@ -72,11 +74,15 @@ typedef struct {
 bool panel_supports_deep_color(int fd, char *output_name);
 uint64_t get_max_bpc(igt_output_t *output);
 void paint_gradient_rectangles(data_t *data,
-			       drmModeModeInfo *mode,
+			       uint16_t vdisplay,
+			       uint16_t hdisplay,
+			       int x, int y,
 			       color_t *colors,
 			       struct igt_fb *fb);
 void paint_rectangles(data_t *data,
-		      drmModeModeInfo *mode,
+		      uint16_t vdisplay,
+		      uint16_t hdisplay,
+		      int x, int y,
 		      color_t *colors,
 		      struct igt_fb *fb);
 gamma_lut_t *alloc_lut(int lut_size);
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [igt-dev] [PATCH i-g-t v4 2/7] tests/kms_color: MPO + pipe color test for degamma
  2022-11-10  5:53 [igt-dev] [PATCH i-g-t v4 0/7] MPO + pipe color test Ananya Sharma
  2022-11-10  5:53 ` [igt-dev] [PATCH i-g-t v4 1/7] tests/kms_color_helper: helper to enable " Ananya Sharma
@ 2022-11-10  5:53 ` Ananya Sharma
  2022-11-10  5:53 ` [igt-dev] [PATCH i-g-t v4 3/7] tests/kms_color: MPO + pipe color test for gamma Ananya Sharma
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Ananya Sharma @ 2022-11-10  5:53 UTC (permalink / raw)
  To: igt-dev

Adding multiple planes with two different formats i.e. RGB and
NV12 in pipe color test for degamma. This will increase the YUV
coverage in color management.

Signed-off-by: Ananya Sharma <ananya.sharma@intel.com>
---
 tests/kms_color.c | 164 ++++++++++++++++++++++++++++++++--------------
 1 file changed, 116 insertions(+), 48 deletions(-)

diff --git a/tests/kms_color.c b/tests/kms_color.c
index cbe3c391..ca36229c 100644
--- a/tests/kms_color.c
+++ b/tests/kms_color.c
@@ -27,59 +27,90 @@
 IGT_TEST_DESCRIPTION("Test Color Features at Pipe level");
 
 static bool test_pipe_degamma(data_t *data,
-			      igt_plane_t *primary)
+			      igt_plane_t *primary, bool multiplane)
 {
 	igt_output_t *output = data->output;
+	igt_plane_t *overlay = data->overlay;
 	igt_display_t *display = &data->display;
-	gamma_lut_t *degamma_linear, *degamma_full;
+	gamma_lut_t *degamma_full;
 	color_t red_green_blue[] = {
 		{ 1.0, 0.0, 0.0 },
 		{ 0.0, 1.0, 0.0 },
 		{ 0.0, 0.0, 1.0 }
 	};
+	color_t blue_red_green[] = {
+		{ 0.0, 1.0, 0.0 },
+		{ 0.0, 0.0, 1.0 },
+		{ 1.0, 0.0, 0.0 }
+	};
 	drmModeModeInfo *mode = data->mode;
-	struct igt_fb fb_modeset, fb;
+	struct igt_fb fb0, fb1;
 	igt_crc_t crc_fullgamma, crc_fullcolors;
-	int fb_id, fb_modeset_id;
+	int fb_id0, fb_id1;
+	int primary_x, primary_y, primary_h, primary_w;
+	int overlay_x, overlay_y, overlay_h, overlay_w;
 	bool ret;
 
 	igt_require(igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_DEGAMMA_LUT));
 	igt_require(igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_GAMMA_LUT));
 
-	degamma_linear = generate_table(data->degamma_lut_size, 1.0);
 	degamma_full = generate_table_max(data->degamma_lut_size);
 
 	igt_output_set_pipe(output, primary->pipe->pipe);
 	igt_output_override_mode(output, mode);
 
-	/* Create a framebuffer at the size of the output. */
-	fb_id = igt_create_fb(data->drm_fd,
-			      mode->hdisplay,
-			      mode->vdisplay,
-			      data->drm_format,
-			      DRM_FORMAT_MOD_LINEAR,
-			      &fb);
-	igt_assert(fb_id);
+	primary_w = mode->hdisplay;
+	primary_h = multiplane ? (mode->vdisplay / 2) : mode->vdisplay;
+	overlay_w = mode->hdisplay;
+	overlay_h = primary_h + (mode->vdisplay % 2);
+	primary_x = 0;
+	primary_y = 0;
+	overlay_x = 0;
+	overlay_y = primary_h;
 
-	fb_modeset_id = igt_create_fb(data->drm_fd,
-				      mode->hdisplay,
-				      mode->vdisplay,
-				      data->drm_format,
-				      DRM_FORMAT_MOD_LINEAR,
-				      &fb_modeset);
-	igt_assert(fb_modeset_id);
+	/* Create a framebuffer at the size of the output. */
+	fb_id0 = igt_create_fb(data->drm_fd,
+			       primary_w,
+			       primary_h,
+			       data->drm_format,
+			       DRM_FORMAT_MOD_LINEAR,
+			       &fb0);
+	igt_assert(fb_id0);
+	igt_plane_set_fb(primary, &fb0);
+	igt_plane_set_position(primary, primary_x, primary_y);
+
+	if (multiplane) {
+		fb_id1 = igt_create_fb(data->drm_fd,
+				       overlay_w,
+				       overlay_h,
+				       data->drm_format_overlay,
+				       DRM_FORMAT_MOD_LINEAR,
+				       &fb1);
+		igt_assert(fb_id1);
+
+		igt_plane_set_fb(overlay, &fb1);
+		igt_plane_set_position(overlay, overlay_x, overlay_y);
+	}
 
-	igt_plane_set_fb(primary, &fb_modeset);
 	disable_ctm(primary->pipe);
 	disable_gamma(primary->pipe);
-	set_degamma(data, primary->pipe, degamma_linear);
-	igt_display_commit(&data->display);
+	disable_degamma(primary->pipe);
+	igt_display_commit2(&data->display, multiplane ? COMMIT_ATOMIC : COMMIT_LEGACY);
 
 	/* Draw solid colors with linear degamma transformation. */
-	paint_rectangles(data, mode->vdisplay, mode->hdisplay,
-			 0, 0, red_green_blue, &fb);
-	igt_plane_set_fb(primary, &fb);
-	igt_display_commit(&data->display);
+	/* Draw solid colors with no degamma transformation. */
+	paint_rectangles(data, primary_h, primary_w, primary_x,
+			 primary_y, red_green_blue, &fb0);
+	igt_plane_set_fb(primary, &fb0);
+	igt_plane_set_position(primary, primary_x, primary_y);
+
+	if (multiplane) {
+		paint_rectangles(data, overlay_h, overlay_w, 0, 0, blue_red_green, &fb1);
+		igt_plane_set_fb(overlay, &fb1);
+		igt_plane_set_position(overlay, overlay_x, overlay_y);
+	}
+
+	igt_display_commit2(&data->display, multiplane ? COMMIT_ATOMIC : COMMIT_LEGACY);
 	igt_wait_for_vblank(data->drm_fd,
 			    display->pipes[primary->pipe->pipe].crtc_offset);
 	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullcolors);
@@ -88,11 +119,18 @@ static bool test_pipe_degamma(data_t *data,
 	 * Draw a gradient with degamma LUT to remap all
 	 * values to max red/green/blue.
 	 */
-	paint_gradient_rectangles(data, mode->vdisplay, mode->hdisplay,
-				  0, 0, red_green_blue, &fb);
-	igt_plane_set_fb(primary, &fb);
+	paint_gradient_rectangles(data, primary_h, primary_w, primary_x,
+				  primary_y, red_green_blue, &fb0);
+	igt_plane_set_fb(primary, &fb0);
+	igt_plane_set_position(primary, primary_x, primary_y);
+
+	if (multiplane) {
+		paint_gradient_rectangles(data, overlay_h, overlay_w, 0, 0, blue_red_green, &fb1);
+		igt_plane_set_fb(overlay, &fb1);
+		igt_plane_set_position(overlay, overlay_x, overlay_y);
+	}
 	set_degamma(data, primary->pipe, degamma_full);
-	igt_display_commit(&data->display);
+	igt_display_commit2(&data->display, multiplane ? COMMIT_ATOMIC : COMMIT_LEGACY);
 	igt_wait_for_vblank(data->drm_fd,
 			    display->pipes[primary->pipe->pipe].crtc_offset);
 	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullgamma);
@@ -105,12 +143,14 @@ static bool test_pipe_degamma(data_t *data,
 
 	disable_degamma(primary->pipe);
 	igt_plane_set_fb(primary, NULL);
+	if (multiplane)
+		igt_plane_set_fb(overlay, NULL);
 	igt_output_set_pipe(output, PIPE_NONE);
-	igt_display_commit(&data->display);
-	igt_remove_fb(data->drm_fd, &fb);
-	igt_remove_fb(data->drm_fd, &fb_modeset);
+	igt_display_commit2(&data->display, multiplane ? COMMIT_ATOMIC : COMMIT_LEGACY);
+	igt_remove_fb(data->drm_fd, &fb0);
+	if (multiplane)
+		igt_remove_fb(data->drm_fd, &fb1);
 
-	free_lut(degamma_linear);
 	free_lut(degamma_full);
 
 	return ret;
@@ -121,7 +161,7 @@ static bool test_pipe_degamma(data_t *data,
  * LUT and verify we have the same CRC as drawing solid color rectangles.
  */
 static bool test_pipe_gamma(data_t *data,
-			    igt_plane_t *primary)
+			    igt_plane_t *primary, bool multiplane)
 {
 	igt_output_t *output = data->output;
 	igt_display_t *display = &data->display;
@@ -212,7 +252,7 @@ static bool test_pipe_gamma(data_t *data,
  * with linear legacy gamma LUT.
  */
 static bool test_pipe_legacy_gamma(data_t *data,
-				   igt_plane_t *primary)
+				   igt_plane_t *primary, bool multiplane)
 {
 	igt_output_t *output = data->output;
 	igt_display_t *display = &data->display;
@@ -323,7 +363,7 @@ static bool test_pipe_legacy_gamma(data_t *data,
  * through the GAMMA_LUT property.
  */
 static bool test_pipe_legacy_gamma_reset(data_t *data,
-					 igt_plane_t *primary)
+					 igt_plane_t *primary, bool multiplane)
 {
 	const double ctm_identity[] = {
 		1.0, 0.0, 0.0,
@@ -717,9 +757,11 @@ static void test_cleanup(data_t *data)
 }
 
 static void
-run_gamma_degamma_tests_for_pipe(data_t *data, enum pipe p,
-				 bool (*test_t)(data_t*, igt_plane_t*))
+run_gamma_degamma_tests_for_pipe(data_t *data, enum pipe p, bool multiplane,
+				 bool (*test_t)(data_t*, igt_plane_t*, bool))
 {
+	igt_plane_t *overlay;
+	int count = 0;
 	test_setup(data, p);
 
 	/*
@@ -730,8 +772,25 @@ run_gamma_degamma_tests_for_pipe(data_t *data, enum pipe p,
 	data->drm_format = DRM_FORMAT_XRGB8888;
 	data->mode = igt_output_get_mode(data->output);
 
+	if (multiplane) {
+		for_each_plane_on_pipe(&data->display, p, overlay) {
+			if (overlay->type == DRM_PLANE_TYPE_PRIMARY ||
+			    overlay->type == DRM_PLANE_TYPE_CURSOR)
+				continue;
+
+			if (igt_plane_has_format_mod(overlay, DRM_FORMAT_NV12, DRM_FORMAT_MOD_LINEAR)) {
+				count++;
+				break;
+			}
+		}
+		igt_require_f(count, "No valid planes found.\n");
+	}
+
+	data->overlay = overlay;
+	data->drm_format_overlay = DRM_FORMAT_NV12;
+
 	igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(p), data->output->name)
-		igt_assert(test_t(data, data->primary));
+		igt_assert(test_t(data, data->primary, multiplane));
 
 	test_cleanup(data);
 }
@@ -846,7 +905,7 @@ run_deep_color_tests_for_pipe(data_t *data, enum pipe p)
 			igt_display_reset(&data->display);
 			igt_output_set_prop_value(output, IGT_CONNECTOR_MAX_BPC, 10);
 
-			ret = test_pipe_gamma(data, data->primary);
+			ret = test_pipe_gamma(data, data->primary, false);
 
 			igt_output_set_prop_value(output, IGT_CONNECTOR_MAX_BPC, max_bpc);
 			igt_assert(ret);
@@ -856,7 +915,7 @@ run_deep_color_tests_for_pipe(data_t *data, enum pipe p)
 			igt_display_reset(&data->display);
 			igt_output_set_prop_value(output, IGT_CONNECTOR_MAX_BPC, 10);
 
-			ret = test_pipe_degamma(data, data->primary);
+			ret = test_pipe_degamma(data, data->primary, false);
 
 			igt_output_set_prop_value(output, IGT_CONNECTOR_MAX_BPC, max_bpc);
 			igt_assert(ret);
@@ -921,19 +980,23 @@ run_tests_for_pipe(data_t *data)
 	enum pipe pipe;
 	struct {
 		const char *name;
-		bool (*test_t)(data_t*, igt_plane_t*);
+		bool (*test_t)(data_t*, igt_plane_t*, bool);
+		bool multiplane;
 		const char *desc;
 	} gamma_degamma_tests[] = {
-		{ "degamma", test_pipe_degamma,
+		{ "degamma", test_pipe_degamma, false,
 		  "Verify that degamma LUT transformation works correctly" },
 
-		{ "gamma", test_pipe_gamma,
+		{ "degamma-multiplane", test_pipe_degamma, true,
+		  "Verify that degamma LUT transformation works correctly for multiplane" },
+
+		{ "gamma", test_pipe_gamma, false,
 		  "Verify that gamma LUT transformation works correctly" },
 
-		{ "legacy-gamma", test_pipe_legacy_gamma,
+		{ "legacy-gamma", test_pipe_legacy_gamma, false,
 		  "Verify that legacy gamma LUT transformation works correctly" },
 
-		{ "legacy-gamma-reset", test_pipe_legacy_gamma_reset,
+		{ "legacy-gamma-reset", test_pipe_legacy_gamma_reset, false,
 		  "Verify that setting the legacy gamma LUT resets the gamma LUT set through GAMMA_LUT property" },
 	};
 	struct {
@@ -1015,8 +1078,13 @@ run_tests_for_pipe(data_t *data)
 	for (i = 0; i < ARRAY_SIZE(gamma_degamma_tests); i++) {
 		igt_describe_f("%s", gamma_degamma_tests[i].desc);
 		igt_subtest_with_dynamic_f("%s", gamma_degamma_tests[i].name) {
+			if (gamma_degamma_tests[i].multiplane &&
+			    (!data->display.is_atomic ||
+			     !igt_display_has_format_mod(&data->display, DRM_FORMAT_NV12, DRM_FORMAT_MOD_LINEAR)))
+				continue;
 			for_each_pipe(&data->display, pipe) {
 				run_gamma_degamma_tests_for_pipe(data, pipe,
+								 gamma_degamma_tests[i].multiplane,
 								 gamma_degamma_tests[i].test_t);
 			}
 		}
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [igt-dev] [PATCH i-g-t v4 3/7] tests/kms_color: MPO + pipe color test for gamma
  2022-11-10  5:53 [igt-dev] [PATCH i-g-t v4 0/7] MPO + pipe color test Ananya Sharma
  2022-11-10  5:53 ` [igt-dev] [PATCH i-g-t v4 1/7] tests/kms_color_helper: helper to enable " Ananya Sharma
  2022-11-10  5:53 ` [igt-dev] [PATCH i-g-t v4 2/7] tests/kms_color: MPO + pipe color test for degamma Ananya Sharma
@ 2022-11-10  5:53 ` Ananya Sharma
  2022-11-10  5:53 ` [igt-dev] [PATCH i-g-t v4 4/7] tests/kms_color: MPO + pipe color test for ctm Ananya Sharma
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Ananya Sharma @ 2022-11-10  5:53 UTC (permalink / raw)
  To: igt-dev

Adding multiple planes with two different formats i.e. RGB and
NV12 in pipe color test for gamma. This will increase the YUV
coverage in color management.

Signed-off-by: Ananya Sharma <ananya.sharma@intel.com>
---
 tests/kms_color.c | 108 +++++++++++++++++++++++++++++++++-------------
 1 file changed, 78 insertions(+), 30 deletions(-)

diff --git a/tests/kms_color.c b/tests/kms_color.c
index ca36229c..560e8801 100644
--- a/tests/kms_color.c
+++ b/tests/kms_color.c
@@ -164,6 +164,7 @@ static bool test_pipe_gamma(data_t *data,
 			    igt_plane_t *primary, bool multiplane)
 {
 	igt_output_t *output = data->output;
+	igt_plane_t *overlay = data->overlay;
 	igt_display_t *display = &data->display;
 	gamma_lut_t *gamma_full;
 	color_t red_green_blue[] = {
@@ -171,10 +172,17 @@ static bool test_pipe_gamma(data_t *data,
 		{ 0.0, 1.0, 0.0 },
 		{ 0.0, 0.0, 1.0 }
 	};
+	color_t blue_red_green[] = {
+		{ 0.0, 1.0, 0.0 },
+		{ 0.0, 0.0, 1.0 },
+		{ 1.0, 0.0, 0.0 }
+	};
 	drmModeModeInfo *mode = data->mode;
-	struct igt_fb fb_modeset, fb;
+	struct igt_fb fb0, fb1;
 	igt_crc_t crc_fullgamma, crc_fullcolors;
-	int fb_id, fb_modeset_id;
+	int fb_id0, fb_id1;
+	int primary_x, primary_y, primary_h, primary_w;
+	int overlay_x, overlay_y, overlay_h, overlay_w;
 	bool ret;
 
 	igt_require(igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_GAMMA_LUT));
@@ -184,34 +192,58 @@ static bool test_pipe_gamma(data_t *data,
 	igt_output_set_pipe(output, primary->pipe->pipe);
 	igt_output_override_mode(output, mode);
 
+	primary_w = mode->hdisplay;
+	primary_h = multiplane ? (mode->vdisplay / 2) : mode->vdisplay;
+	overlay_w = mode->hdisplay;
+	overlay_h = primary_h + (mode->vdisplay % 2);
+	primary_x = 0;
+	primary_y = 0;
+	overlay_x = 0;
+	overlay_y = primary_h;
+
 	/* Create a framebuffer at the size of the output. */
-	fb_id = igt_create_fb(data->drm_fd,
-			      mode->hdisplay,
-			      mode->vdisplay,
-			      data->drm_format,
-			      DRM_FORMAT_MOD_LINEAR,
-			      &fb);
-	igt_assert(fb_id);
+	fb_id0 = igt_create_fb(data->drm_fd,
+			       primary_w,
+			       primary_h,
+			       data->drm_format,
+			       DRM_FORMAT_MOD_LINEAR,
+			       &fb0);
+	igt_assert(fb_id0);
 
-	fb_modeset_id = igt_create_fb(data->drm_fd,
-				      mode->hdisplay,
-				      mode->vdisplay,
-				      data->drm_format,
-				      DRM_FORMAT_MOD_LINEAR,
-				      &fb_modeset);
-	igt_assert(fb_modeset_id);
+	igt_plane_set_fb(primary, &fb0);
+	igt_plane_set_position(primary, primary_x, primary_y);
+
+	if (multiplane) {
+		fb_id1 = igt_create_fb(data->drm_fd,
+				       overlay_w,
+				       overlay_h,
+				       data->drm_format_overlay,
+				       DRM_FORMAT_MOD_LINEAR,
+				       &fb1);
+		igt_assert(fb_id1);
+
+		igt_plane_set_fb(overlay, &fb1);
+		igt_plane_set_position(overlay, overlay_x, overlay_y);
+	}
 
-	igt_plane_set_fb(primary, &fb_modeset);
 	disable_ctm(primary->pipe);
 	disable_degamma(primary->pipe);
-	set_gamma(data, primary->pipe, gamma_full);
-	igt_display_commit(&data->display);
+	disable_gamma(primary->pipe);
+	igt_display_commit2(&data->display, multiplane ? COMMIT_ATOMIC : COMMIT_LEGACY);
 
 	/* Draw solid colors with no gamma transformation. */
-	paint_rectangles(data, mode->vdisplay, mode->hdisplay,
-			 0, 0, red_green_blue, &fb);
-	igt_plane_set_fb(primary, &fb);
-	igt_display_commit(&data->display);
+	paint_rectangles(data, primary_h, primary_w, primary_x,
+			 primary_y, red_green_blue, &fb0);
+	igt_plane_set_fb(primary, &fb0);
+	igt_plane_set_position(primary, primary_x, primary_y);
+
+	if (multiplane) {
+		paint_rectangles(data, overlay_h, overlay_w, 0, 0, blue_red_green, &fb1);
+		igt_plane_set_fb(overlay, &fb1);
+		igt_plane_set_position(overlay, overlay_x, overlay_y);
+	}
+
+	igt_display_commit2(&data->display, multiplane ? COMMIT_ATOMIC : COMMIT_LEGACY);
 	igt_wait_for_vblank(data->drm_fd,
 			    display->pipes[primary->pipe->pipe].crtc_offset);
 	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullcolors);
@@ -220,10 +252,20 @@ static bool test_pipe_gamma(data_t *data,
 	 * Draw a gradient with gamma LUT to remap all values
 	 * to max red/green/blue.
 	 */
-	paint_gradient_rectangles(data, mode->vdisplay, mode->hdisplay,
-				  0, 0, red_green_blue, &fb);
-	igt_plane_set_fb(primary, &fb);
-	igt_display_commit(&data->display);
+	paint_gradient_rectangles(data, primary_h, primary_w, primary_x,
+				  primary_y, red_green_blue, &fb0);
+	igt_plane_set_fb(primary, &fb0);
+	igt_plane_set_position(primary, primary_x, primary_y);
+
+	if (multiplane) {
+		paint_gradient_rectangles(data, overlay_h, overlay_w,
+					  0, 0, blue_red_green, &fb1);
+		igt_plane_set_fb(overlay, &fb1);
+		igt_plane_set_position(overlay, overlay_x, overlay_y);
+	}
+
+	set_gamma(data, primary->pipe, gamma_full);
+	igt_display_commit2(&data->display, multiplane ? COMMIT_ATOMIC : COMMIT_LEGACY);
 	igt_wait_for_vblank(data->drm_fd,
 			    display->pipes[primary->pipe->pipe].crtc_offset);
 	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullgamma);
@@ -236,10 +278,13 @@ static bool test_pipe_gamma(data_t *data,
 
 	disable_gamma(primary->pipe);
 	igt_plane_set_fb(primary, NULL);
+	if (multiplane)
+		igt_plane_set_fb(overlay, NULL);
 	igt_output_set_pipe(output, PIPE_NONE);
-	igt_display_commit(&data->display);
-	igt_remove_fb(data->drm_fd, &fb);
-	igt_remove_fb(data->drm_fd, &fb_modeset);
+	igt_display_commit2(&data->display, multiplane ? COMMIT_ATOMIC : COMMIT_LEGACY);
+	igt_remove_fb(data->drm_fd, &fb0);
+	if (multiplane)
+		igt_remove_fb(data->drm_fd, &fb1);
 
 	free_lut(gamma_full);
 
@@ -993,6 +1038,9 @@ run_tests_for_pipe(data_t *data)
 		{ "gamma", test_pipe_gamma, false,
 		  "Verify that gamma LUT transformation works correctly" },
 
+		{ "gamma-multiplane", test_pipe_gamma, true,
+		  "Verify that gamma LUT transformation works correctly for multiplane" },
+
 		{ "legacy-gamma", test_pipe_legacy_gamma, false,
 		  "Verify that legacy gamma LUT transformation works correctly" },
 
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [igt-dev] [PATCH i-g-t v4 4/7] tests/kms_color: MPO + pipe color test for ctm
  2022-11-10  5:53 [igt-dev] [PATCH i-g-t v4 0/7] MPO + pipe color test Ananya Sharma
                   ` (2 preceding siblings ...)
  2022-11-10  5:53 ` [igt-dev] [PATCH i-g-t v4 3/7] tests/kms_color: MPO + pipe color test for gamma Ananya Sharma
@ 2022-11-10  5:53 ` Ananya Sharma
  2022-11-10  5:53 ` [igt-dev] [PATCH i-g-t v4 5/7] tests/chamelium/kms_color_chamelium: MPO + pipe color test for degamma Ananya Sharma
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Ananya Sharma @ 2022-11-10  5:53 UTC (permalink / raw)
  To: igt-dev

Adding multiple planes with two different formats i.e. RGB and NV12 in
pipe color test for ctm. This will increase the YUV coverage in color
management.

Signed-off-by: Ananya Sharma <ananya.sharma@intel.com>
---
 tests/kms_color.c | 157 ++++++++++++++++++++++++++++++++++------------
 1 file changed, 117 insertions(+), 40 deletions(-)

diff --git a/tests/kms_color.c b/tests/kms_color.c
index 560e8801..abdd6b5a 100644
--- a/tests/kms_color.c
+++ b/tests/kms_color.c
@@ -543,6 +543,7 @@ end:
  */
 static bool test_pipe_ctm(data_t *data,
 			  igt_plane_t *primary,
+			  bool multiplane,
 			  color_t *before,
 			  color_t *after,
 			  double *ctm_matrix)
@@ -552,14 +553,17 @@ static bool test_pipe_ctm(data_t *data,
 		0.0, 1.0, 0.0,
 		0.0, 0.0, 1.0
 	};
+	igt_plane_t *overlay = data->overlay;
 	gamma_lut_t *degamma_linear, *gamma_linear;
 	igt_output_t *output = data->output;
 	bool ret = true;
 	igt_display_t *display = &data->display;
 	drmModeModeInfo *mode = data->mode;
-	struct igt_fb fb_modeset, fb;
+	struct igt_fb fb0, fb1;
 	igt_crc_t crc_software, crc_hardware;
-	int fb_id, fb_modeset_id;
+	int fb_id0, fb_id1;
+	int primary_x, primary_y, primary_h, primary_w;
+	int overlay_x, overlay_y, overlay_h, overlay_w;
 
 	igt_require(igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_CTM));
 
@@ -569,23 +573,39 @@ static bool test_pipe_ctm(data_t *data,
 	igt_output_set_pipe(output, primary->pipe->pipe);
 	igt_output_override_mode(output, mode);
 
+	primary_w = mode->hdisplay;
+	primary_h = multiplane ? (mode->vdisplay / 2) : mode->vdisplay;
+	overlay_w = mode->hdisplay;
+	overlay_h = primary_h + (mode->vdisplay % 2);
+	primary_x = 0;
+	primary_y = 0;
+	overlay_x = 0;
+	overlay_y = primary_h;
+
 	/* Create a framebuffer at the size of the output. */
-	fb_id = igt_create_fb(data->drm_fd,
-			      mode->hdisplay,
-			      mode->vdisplay,
-			      data->drm_format,
-			      DRM_FORMAT_MOD_LINEAR,
-			      &fb);
-	igt_assert(fb_id);
+	fb_id0 = igt_create_fb(data->drm_fd,
+			       primary_w,
+			       primary_h,
+			       data->drm_format,
+			       DRM_FORMAT_MOD_LINEAR,
+			       &fb0);
+	igt_assert(fb_id0);
 
-	fb_modeset_id = igt_create_fb(data->drm_fd,
-				      mode->hdisplay,
-				      mode->vdisplay,
-				      data->drm_format,
-				      DRM_FORMAT_MOD_LINEAR,
-				      &fb_modeset);
-	igt_assert(fb_modeset_id);
-	igt_plane_set_fb(primary, &fb_modeset);
+	igt_plane_set_fb(primary, &fb0);
+	igt_plane_set_position(primary, primary_x, primary_y);
+
+	if (multiplane) {
+		fb_id1 = igt_create_fb(data->drm_fd,
+				       overlay_w,
+				       overlay_h,
+				       data->drm_format_overlay,
+				       DRM_FORMAT_MOD_LINEAR,
+				       &fb1);
+		igt_assert(fb_id1);
+
+		igt_plane_set_fb(overlay, &fb1);
+		igt_plane_set_position(overlay, overlay_x, overlay_y);
+	}
 
 	/*
 	 * Don't program LUT's for max CTM cases, as limitation of
@@ -602,23 +622,37 @@ static bool test_pipe_ctm(data_t *data,
 	}
 
 	disable_ctm(primary->pipe);
-	igt_display_commit(&data->display);
+	igt_display_commit2(&data->display, multiplane ? COMMIT_ATOMIC : COMMIT_LEGACY);
+
+	paint_rectangles(data, primary_h, primary_w, primary_x, primary_y, after, &fb0);
+	igt_plane_set_fb(primary, &fb0);
+	igt_plane_set_position(primary, primary_x, primary_y);
+
+	if (multiplane) {
+		paint_rectangles(data, overlay_h, overlay_w, 0, 0, after, &fb1);
+		igt_plane_set_fb(overlay, &fb1);
+		igt_plane_set_position(overlay, overlay_x, overlay_y);
+	}
 
-	paint_rectangles(data, mode->vdisplay, mode->hdisplay,
-			 0, 0, after, &fb);
-	igt_plane_set_fb(primary, &fb);
 	set_ctm(primary->pipe, ctm_identity);
-	igt_display_commit(&data->display);
+	igt_display_commit2(&data->display, multiplane ? COMMIT_ATOMIC : COMMIT_LEGACY);
 	igt_wait_for_vblank(data->drm_fd,
 			    display->pipes[primary->pipe->pipe].crtc_offset);
 	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_software);
 
 	/* With CTM transformation. */
-	paint_rectangles(data, mode->vdisplay, mode->hdisplay,
-			 0, 0, before, &fb);
-	igt_plane_set_fb(primary, &fb);
+	paint_rectangles(data, primary_h, primary_w, primary_x, primary_y, before, &fb0);
+	igt_plane_set_fb(primary, &fb0);
+	igt_plane_set_position(primary, primary_x, primary_y);
+
+	if (multiplane) {
+		paint_rectangles(data, overlay_h, overlay_w, 0, 0, before, &fb1);
+		igt_plane_set_fb(overlay, &fb1);
+		igt_plane_set_position(overlay, overlay_x, overlay_y);
+	}
+
 	set_ctm(primary->pipe, ctm_matrix);
-	igt_display_commit(&data->display);
+	igt_display_commit2(&data->display, multiplane ? COMMIT_ATOMIC : COMMIT_LEGACY);
 	igt_wait_for_vblank(data->drm_fd,
 			    display->pipes[primary->pipe->pipe].crtc_offset);
 	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_hardware);
@@ -629,11 +663,18 @@ static bool test_pipe_ctm(data_t *data,
 	 */
 	ret &= igt_skip_crc_compare || igt_check_crc_equal(&crc_software, &crc_hardware);
 
+	disable_degamma(primary->pipe);
+	disable_gamma(primary->pipe);
+	disable_ctm(primary->pipe);
+
 	igt_plane_set_fb(primary, NULL);
+	if (multiplane)
+		igt_plane_set_fb(overlay, NULL);
 	igt_output_set_pipe(output, PIPE_NONE);
-	igt_display_commit(&data->display);
-	igt_remove_fb(data->drm_fd, &fb);
-	igt_remove_fb(data->drm_fd, &fb_modeset);
+	igt_display_commit2(&data->display, multiplane ? COMMIT_ATOMIC : COMMIT_LEGACY);
+	igt_remove_fb(data->drm_fd, &fb0);
+	if (multiplane)
+		igt_remove_fb(data->drm_fd, &fb1);
 
 	free_lut(degamma_linear);
 	free_lut(gamma_linear);
@@ -842,10 +883,13 @@ run_gamma_degamma_tests_for_pipe(data_t *data, enum pipe p, bool multiplane,
 
 static void
 run_ctm_tests_for_pipe(data_t *data, enum pipe p,
+		       bool multiplane,
 		       color_t *expected_colors,
 		       double *ctm,
 		       int iter)
 {
+	igt_plane_t *overlay;
+	int count = 0;
 	double delta;
 	color_t red_green_blue[] = {
 		{ 1.0, 0.0, 0.0 },
@@ -864,12 +908,29 @@ run_ctm_tests_for_pipe(data_t *data, enum pipe p,
 	data->drm_format = DRM_FORMAT_XRGB8888;
 	data->mode = igt_output_get_mode(data->output);
 
+	if (multiplane) {
+		for_each_plane_on_pipe(&data->display, p, overlay) {
+			if (overlay->type != DRM_PLANE_TYPE_OVERLAY)
+				continue;
+
+			if (igt_plane_has_format_mod(overlay, DRM_FORMAT_NV12,
+						     DRM_FORMAT_MOD_LINEAR)) {
+				count++;
+				break;
+			}
+		}
+		igt_require_f(count, "No valid planes found.\n");
+	}
+
+	data->overlay = overlay;
+	data->drm_format_overlay = DRM_FORMAT_NV12;
+
 	igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(p), data->output->name) {
 		bool success = false;
 		int i;
 
 		if (!iter)
-			success = test_pipe_ctm(data, data->primary, red_green_blue,
+			success = test_pipe_ctm(data, data->primary, multiplane, red_green_blue,
 						expected_colors, ctm);
 
 		/*
@@ -883,7 +944,7 @@ run_ctm_tests_for_pipe(data_t *data, enum pipe p,
 				expected_colors[1].g =
 				expected_colors[2].b =
 				ctm[0] + delta * (i - (iter / 2));
-			if (test_pipe_ctm(data, data->primary, red_green_blue,
+			if (test_pipe_ctm(data, data->primary, multiplane, red_green_blue,
 					  expected_colors, ctm)) {
 				success = true;
 				break;
@@ -970,7 +1031,7 @@ run_deep_color_tests_for_pipe(data_t *data, enum pipe p)
 			igt_display_reset(&data->display);
 			igt_output_set_prop_value(output, IGT_CONNECTOR_MAX_BPC, 10);
 
-			ret = test_pipe_ctm(data, data->primary,
+			ret = test_pipe_ctm(data, data->primary, false,
 					    red_green_blue,
 					    blue_green_blue, ctm);
 
@@ -1050,11 +1111,21 @@ run_tests_for_pipe(data_t *data)
 	struct {
 		const char *name;
 		int iter;
+		bool multiplane;
 		color_t colors[3];
 		double ctm[9];
 		const char *desc;
 	} ctm_tests[] = {
-		{ "ctm-red-to-blue", 0,
+		{ "ctm-multiplane", 0, true,
+			{{ 0.0, 0.0, 1.0 },
+			 { 0.0, 1.0, 0.0 },
+			 { 0.0, 0.0, 1.0 }},
+		  { 0.0, 0.0, 0.0,
+		    0.0, 1.0, 0.0,
+		    1.0, 0.0, 1.0 },
+		  "Check the color transformation from red to blue"
+		},
+		{ "ctm-red-to-blue", 0, false,
 			{{ 0.0, 0.0, 1.0 },
 			 { 0.0, 1.0, 0.0 },
 			 { 0.0, 0.0, 1.0 }},
@@ -1063,7 +1134,7 @@ run_tests_for_pipe(data_t *data)
 		    1.0, 0.0, 1.0 },
 		  "Check the color transformation from red to blue"
 		},
-		{ "ctm-green-to-red", 0,
+		{ "ctm-green-to-red", 0, false,
 			{{ 1.0, 0.0, 0.0 },
 			 { 1.0, 0.0, 0.0 },
 			 { 0.0, 0.0, 1.0 }},
@@ -1072,7 +1143,7 @@ run_tests_for_pipe(data_t *data)
 		    0.0, 0.0, 1.0 },
 		  "Check the color transformation from green to red"
 		},
-		{ "ctm-blue-to-red", 0,
+		{ "ctm-blue-to-red", 0, false,
 			{{ 1.0, 0.0, 0.0 },
 			 { 0.0, 1.0, 0.0 },
 			 { 1.0, 0.0, 0.0 }},
@@ -1081,7 +1152,7 @@ run_tests_for_pipe(data_t *data)
 		    0.0, 0.0, 0.0 },
 		  "Check the color transformation from blue to red"
 		},
-		{ "ctm-max", 0,
+		{ "ctm-max", 0, false,
 			{{ 1.0, 0.0, 0.0 },
 			 { 0.0, 1.0, 0.0 },
 			 { 0.0, 0.0, 1.0 }},
@@ -1090,7 +1161,7 @@ run_tests_for_pipe(data_t *data)
 		    0.0, 0.0, 100.0 },
 		  "Check the color transformation for maximum transparency"
 		},
-		{ "ctm-negative", 0,
+		{ "ctm-negative", 0, false,
 			{{ 0.0, 0.0, 0.0 },
 			 { 0.0, 0.0, 0.0 },
 			 { 0.0, 0.0, 0.0 }},
@@ -1099,21 +1170,21 @@ run_tests_for_pipe(data_t *data)
 		    0.0, 0.0, -1.0 },
 		  "Check the color transformation for negative transparency"
 		},
-		{ "ctm-0-25", 5,
+		{ "ctm-0-25", 5, false,
 			{{ 0.0, }, { 0.0, }, { 0.0, }},
 		  { 0.25, 0.0,  0.0,
 		    0.0,  0.25, 0.0,
 		    0.0,  0.0,  0.25 },
 		  "Check the color transformation for 0.25 transparency"
 		},
-		{ "ctm-0-50", 5,
+		{ "ctm-0-50", 5, false,
 			{{ 0.0, }, { 0.0, }, { 0.0, }},
 		  { 0.5,  0.0,  0.0,
 		    0.0,  0.5,  0.0,
 		    0.0,  0.0,  0.5 },
 		  "Check the color transformation for 0.5 transparency"
 		},
-		{ "ctm-0-75", 7,
+		{ "ctm-0-75", 7, false,
 			{{ 0.0, }, { 0.0, }, { 0.0, }},
 		  { 0.75, 0.0,  0.0,
 		    0.0,  0.75, 0.0,
@@ -1141,8 +1212,14 @@ run_tests_for_pipe(data_t *data)
 	for (i = 0; i < ARRAY_SIZE(ctm_tests); i++) {
 		igt_describe_f("%s", ctm_tests[i].desc);
 		igt_subtest_with_dynamic_f("%s", ctm_tests[i].name) {
+			if (ctm_tests[i].multiplane &&
+			   (!data->display.is_atomic || !igt_display_has_format_mod(&data->display,
+										    DRM_FORMAT_NV12,
+										    DRM_FORMAT_MOD_LINEAR)))
+				continue;
 			for_each_pipe(&data->display, pipe) {
 				run_ctm_tests_for_pipe(data, pipe,
+						       ctm_tests[i].multiplane,
 						       ctm_tests[i].colors,
 						       ctm_tests[i].ctm,
 						       ctm_tests[i].iter);
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [igt-dev] [PATCH i-g-t v4 5/7] tests/chamelium/kms_color_chamelium: MPO + pipe color test for degamma
  2022-11-10  5:53 [igt-dev] [PATCH i-g-t v4 0/7] MPO + pipe color test Ananya Sharma
                   ` (3 preceding siblings ...)
  2022-11-10  5:53 ` [igt-dev] [PATCH i-g-t v4 4/7] tests/kms_color: MPO + pipe color test for ctm Ananya Sharma
@ 2022-11-10  5:53 ` Ananya Sharma
  2022-11-10  5:53 ` [igt-dev] [PATCH i-g-t v4 6/7] tests/chamelium/kms_color_chamelium: MPO + pipe color test for gamma Ananya Sharma
  2022-11-10  5:53 ` [igt-dev] [PATCH i-g-t v4 7/7] tests/chamelium/kms_color_chamelium: MPO + pipe color test for ctm Ananya Sharma
  6 siblings, 0 replies; 9+ messages in thread
From: Ananya Sharma @ 2022-11-10  5:53 UTC (permalink / raw)
  To: igt-dev

Adding multiple planes with two different formats i.e. RGB and
NV12 in pipe color test for degamma in kms_color_chamelium too
as we can expect crc mismatches due to the hardware round-ups
the LUT values. This will also increase the coverage in color
management.

Signed-off-by: Ananya Sharma <ananya.sharma@intel.com>
---
 tests/chamelium/kms_color_chamelium.c | 132 +++++++++++++++++++-------
 1 file changed, 99 insertions(+), 33 deletions(-)

diff --git a/tests/chamelium/kms_color_chamelium.c b/tests/chamelium/kms_color_chamelium.c
index 4a8cb339..6043718c 100644
--- a/tests/chamelium/kms_color_chamelium.c
+++ b/tests/chamelium/kms_color_chamelium.c
@@ -33,19 +33,28 @@ IGT_TEST_DESCRIPTION("Test Color Features at Pipe level using Chamelium to verif
  */
 static bool test_pipe_degamma(data_t *data,
 			      igt_plane_t *primary,
+			      bool multiplane,
 			      struct chamelium_port *port)
 {
 	igt_output_t *output = data->output;
+	igt_plane_t *overlay = data->overlay;
 	gamma_lut_t *degamma_full;
 	drmModeModeInfo *mode = data->mode;
-	struct igt_fb fb_modeset, fb, fbref;
+	struct igt_fb fb0, fb1, fbref;
 	struct chamelium_frame_dump *frame_fullcolors;
-	int fb_id, fb_modeset_id, fbref_id;
+	int fb_id0, fb_id1, fbref_id;
 	color_t red_green_blue[] = {
 		{ 1.0, 0.0, 0.0 },
 		{ 0.0, 1.0, 0.0 },
 		{ 0.0, 0.0, 1.0 }
 	};
+	color_t blue_red_green[] = {
+		{ 0.0, 1.0, 0.0 },
+		{ 0.0, 0.0, 1.0 },
+		{ 1.0, 0.0, 0.0 }
+	};
+	int primary_x, primary_y, primary_h, primary_w;
+	int overlay_x, overlay_y, overlay_h, overlay_w;
 	bool ret;
 
 	igt_require(igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_DEGAMMA_LUT));
@@ -54,22 +63,39 @@ static bool test_pipe_degamma(data_t *data,
 
 	igt_output_set_pipe(output, primary->pipe->pipe);
 
-	/* Create a framebuffer at the size of the output. */
-	fb_id = igt_create_fb(data->drm_fd,
-			      mode->hdisplay,
-			      mode->vdisplay,
-			      DRM_FORMAT_XRGB8888,
-			      DRM_FORMAT_MOD_LINEAR,
-			      &fb);
-	igt_assert(fb_id);
+	primary_w = mode->hdisplay;
+	primary_h = mode->vdisplay/2;
+	overlay_w = mode->hdisplay;
+	overlay_h = primary_h + (mode->vdisplay % 2);
+	primary_x = 0;
+	primary_y = 0;
+	overlay_x = 0;
+	overlay_y = primary_h;
 
-	fb_modeset_id = igt_create_fb(data->drm_fd,
-				      mode->hdisplay,
-				      mode->vdisplay,
-				      DRM_FORMAT_XRGB8888,
-				      DRM_FORMAT_MOD_LINEAR,
-				      &fb_modeset);
-	igt_assert(fb_modeset_id);
+	/* Create a framebuffer at the size of the output. */
+	fb_id0 = igt_create_fb(data->drm_fd,
+			       primary_w,
+			       primary_h,
+			       data->drm_format,
+			       DRM_FORMAT_MOD_LINEAR,
+			       &fb0);
+	igt_assert(fb_id0);
+
+	igt_plane_set_fb(primary, &fb0);
+	igt_plane_set_position(primary, primary_x, primary_y);
+
+	if (multiplane) {
+		fb_id1 = igt_create_fb(data->drm_fd,
+				       overlay_w,
+				       overlay_h,
+				       data->drm_format_overlay,
+				       DRM_FORMAT_MOD_LINEAR,
+				       &fb1);
+		igt_assert(fb_id1);
+
+		igt_plane_set_fb(overlay, &fb1);
+		igt_plane_set_position(overlay, overlay_x, overlay_y);
+	}
 
 	fbref_id = igt_create_fb(data->drm_fd,
 				 mode->hdisplay,
@@ -79,23 +105,31 @@ static bool test_pipe_degamma(data_t *data,
 				 &fbref);
 	igt_assert(fbref_id);
 
-	igt_plane_set_fb(primary, &fb_modeset);
 	disable_ctm(primary->pipe);
 	disable_gamma(primary->pipe);
-	igt_display_commit(&data->display);
+	igt_display_commit2(&data->display, multiplane ? COMMIT_ATOMIC : COMMIT_LEGACY);
 
-	/* Draw solid colors with linear degamma transformation. */
-	paint_rectangles(data, mode->vdisplay, mode->hdisplay,
-			 0, 0, red_green_blue, &fbref);
+	/* Draw solid colors with no degamma transformation. */
+	paint_rectangles(data, primary_h, primary_w, 0, 0, red_green_blue, &fbref);
+	paint_rectangles(data, overlay_h, overlay_w, 0, 0, blue_red_green, &fbref);
 
 	/* Draw a gradient with degamma LUT to remap all
 	 * values to max red/green/blue.
 	 */
-	paint_gradient_rectangles(data, mode->vdisplay, mode->hdisplay,
-				  0, 0, red_green_blue, &fb);
-	igt_plane_set_fb(primary, &fb);
+	paint_gradient_rectangles(data, primary_h, primary_w,
+				  primary_x, primary_y, red_green_blue, &fb0);
+	igt_plane_set_fb(primary, &fb0);
+	igt_plane_set_position(primary, primary_x, primary_y);
+
+	if (multiplane) {
+		paint_gradient_rectangles(data, overlay_h, overlay_w, 0, 0,
+					  blue_red_green, &fb1);
+		igt_plane_set_fb(overlay, &fb1);
+		igt_plane_set_position(overlay, overlay_x, overlay_y);
+	}
+
 	set_degamma(data, primary->pipe, degamma_full);
-	igt_display_commit(&data->display);
+	igt_display_commit2(&data->display, multiplane ? COMMIT_ATOMIC : COMMIT_LEGACY);
 	chamelium_capture(data->chamelium, port, 0, 0, 0, 0, 1);
 	frame_fullcolors =
 		chamelium_read_captured_frame(data->chamelium, 0);
@@ -110,8 +144,10 @@ static bool test_pipe_degamma(data_t *data,
 
 	disable_degamma(primary->pipe);
 	igt_plane_set_fb(primary, NULL);
+	if (multiplane)
+		igt_plane_set_fb(overlay, NULL);
 	igt_output_set_pipe(output, PIPE_NONE);
-	igt_display_commit(&data->display);
+	igt_display_commit2(&data->display, multiplane ? COMMIT_ATOMIC : COMMIT_LEGACY);
 	free_lut(degamma_full);
 
 	return ret;
@@ -124,6 +160,7 @@ static bool test_pipe_degamma(data_t *data,
  */
 static bool test_pipe_gamma(data_t *data,
 			    igt_plane_t *primary,
+			    bool multiplane,
 			    struct chamelium_port *port)
 {
 	igt_output_t *output = data->output;
@@ -454,9 +491,11 @@ static int test_setup(data_t *data, enum pipe p)
 }
 
 static void
-run_gamma_degamma_tests_for_pipe(data_t *data, enum pipe p,
-		bool (*test_t)(data_t*, igt_plane_t*, struct chamelium_port*))
+run_gamma_degamma_tests_for_pipe(data_t *data, enum pipe p, bool multiplane,
+		bool (*test_t)(data_t*, igt_plane_t*, bool, struct chamelium_port*))
 {
+	igt_plane_t *overlay;
+	int count = 0;
 	int port_idx = test_setup(data, p);
 
 	igt_require(port_idx >= 0);
@@ -465,8 +504,25 @@ run_gamma_degamma_tests_for_pipe(data_t *data, enum pipe p,
 	data->drm_format = DRM_FORMAT_XRGB8888;
 	data->mode = igt_output_get_mode(data->output);
 
+	if (multiplane) {
+		for_each_plane_on_pipe(&data->display, p, overlay) {
+			if (overlay->type != DRM_PLANE_TYPE_OVERLAY)
+				continue;
+
+			if (igt_plane_has_format_mod(overlay, DRM_FORMAT_NV12,
+						     DRM_FORMAT_MOD_LINEAR)) {
+				count++;
+				break;
+			}
+		}
+		igt_require_f(count, "No valid planes found.\n");
+	}
+
+	data->overlay = overlay;
+	data->drm_format_overlay = DRM_FORMAT_NV12;
+
 	igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(p), data->output->name)
-		igt_assert(test_t(data, data->primary, data->ports[port_idx]));
+		igt_assert(test_t(data, data->primary, multiplane,  data->ports[port_idx]));
 }
 
 static void
@@ -555,13 +611,17 @@ run_tests_for_pipe(data_t *data)
 	enum pipe pipe;
 	struct {
 		const char *name;
-		bool (*test_t)(data_t*, igt_plane_t*, struct chamelium_port*);
+		bool (*test_t)(data_t*, igt_plane_t*, bool, struct chamelium_port*);
+		bool multiplane;
 		const char *desc;
 	} gamma_degamma_tests[] = {
-		{ "degamma", test_pipe_degamma,
+		{ "degamma", test_pipe_degamma, false,
 		  "Verify that degamma LUT transformation works correctly" },
 
-		{ "gamma", test_pipe_gamma,
+		{ "degamma-multiplane", test_pipe_degamma, true,
+		  "Verify that degamma LUT transformation works correctly for multiplanes" },
+
+		{ "gamma", test_pipe_gamma, false,
 		  "Verify that gamma LUT transformation works correctly" },
 	};
 	struct {
@@ -643,8 +703,14 @@ run_tests_for_pipe(data_t *data)
 	for (i = 0; i < ARRAY_SIZE(gamma_degamma_tests); i++) {
 		igt_describe_f("%s", gamma_degamma_tests[i].desc);
 		igt_subtest_with_dynamic_f("%s", gamma_degamma_tests[i].name) {
+			if (gamma_degamma_tests[i].multiplane &&
+			   (!data->display.is_atomic ||
+			    !igt_display_has_format_mod(&data->display, DRM_FORMAT_NV12,
+							DRM_FORMAT_MOD_LINEAR)))
+				continue;
 			for_each_pipe(&data->display, pipe) {
 				run_gamma_degamma_tests_for_pipe(data, pipe,
+								 gamma_degamma_tests[i].multiplane,
 								 gamma_degamma_tests[i].test_t);
 			}
 		}
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [igt-dev] [PATCH i-g-t v4 6/7] tests/chamelium/kms_color_chamelium: MPO + pipe color test for gamma
  2022-11-10  5:53 [igt-dev] [PATCH i-g-t v4 0/7] MPO + pipe color test Ananya Sharma
                   ` (4 preceding siblings ...)
  2022-11-10  5:53 ` [igt-dev] [PATCH i-g-t v4 5/7] tests/chamelium/kms_color_chamelium: MPO + pipe color test for degamma Ananya Sharma
@ 2022-11-10  5:53 ` Ananya Sharma
  2022-11-10  5:53 ` [igt-dev] [PATCH i-g-t v4 7/7] tests/chamelium/kms_color_chamelium: MPO + pipe color test for ctm Ananya Sharma
  6 siblings, 0 replies; 9+ messages in thread
From: Ananya Sharma @ 2022-11-10  5:53 UTC (permalink / raw)
  To: igt-dev

Adding multiple planes with two different formats i.e. RGB and
NV12 in pipe color test for gamma in kms_color_chamelium too
as we can expect crc mismatches due to the hardware round-ups
the LUT values. This will also increase the coverage in color
management.

Signed-off-by: Ananya Sharma <ananya.sharma@intel.com>
---
 tests/chamelium/kms_color_chamelium.c | 92 +++++++++++++++++++--------
 1 file changed, 66 insertions(+), 26 deletions(-)

diff --git a/tests/chamelium/kms_color_chamelium.c b/tests/chamelium/kms_color_chamelium.c
index 6043718c..695cb9ad 100644
--- a/tests/chamelium/kms_color_chamelium.c
+++ b/tests/chamelium/kms_color_chamelium.c
@@ -164,16 +164,24 @@ static bool test_pipe_gamma(data_t *data,
 			    struct chamelium_port *port)
 {
 	igt_output_t *output = data->output;
+	igt_plane_t *overlay = data->overlay;
 	gamma_lut_t *gamma_full;
 	drmModeModeInfo *mode = data->mode;
-	struct igt_fb fb_modeset, fb, fbref;
+	struct igt_fb fb0, fb1, fbref;
 	struct chamelium_frame_dump *frame_fullcolors;
-	int fb_id, fb_modeset_id, fbref_id;
+	int fb_id0, fb_id1, fbref_id;
 	color_t red_green_blue[] = {
 		{ 1.0, 0.0, 0.0 },
 		{ 0.0, 1.0, 0.0 },
 		{ 0.0, 0.0, 1.0 }
 	};
+	color_t blue_red_green[] = {
+		{ 0.0, 1.0, 0.0 },
+		{ 0.0, 0.0, 1.0 },
+		{ 1.0, 0.0, 0.0 }
+	};
+	int primary_x, primary_y, primary_h, primary_w;
+	int overlay_x, overlay_y, overlay_h, overlay_w;
 	bool ret;
 
 	igt_require(igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_GAMMA_LUT));
@@ -182,22 +190,39 @@ static bool test_pipe_gamma(data_t *data,
 
 	igt_output_set_pipe(output, primary->pipe->pipe);
 
+	primary_w = mode->hdisplay;
+	primary_h = mode->vdisplay/2;
+	overlay_w = mode->hdisplay;
+	overlay_h = primary_h + (mode->vdisplay % 2);
+	primary_x = 0;
+	primary_y = 0;
+	overlay_x = 0;
+	overlay_y = primary_h;
+
 	/* Create a framebuffer at the size of the output. */
-	fb_id = igt_create_fb(data->drm_fd,
-			      mode->hdisplay,
-			      mode->vdisplay,
-			      DRM_FORMAT_XRGB8888,
-			      DRM_FORMAT_MOD_LINEAR,
-			      &fb);
-	igt_assert(fb_id);
+	fb_id0 = igt_create_fb(data->drm_fd,
+			       primary_w,
+			       primary_h,
+			       data->drm_format,
+			       DRM_FORMAT_MOD_LINEAR,
+			       &fb0);
+	igt_assert(fb_id0);
 
-	fb_modeset_id = igt_create_fb(data->drm_fd,
-				      mode->hdisplay,
-				      mode->vdisplay,
-				      DRM_FORMAT_XRGB8888,
-				      DRM_FORMAT_MOD_LINEAR,
-				      &fb_modeset);
-	igt_assert(fb_modeset_id);
+	igt_plane_set_fb(primary, &fb0);
+	igt_plane_set_position(primary, primary_x, primary_y);
+
+	if (multiplane) {
+		fb_id1 = igt_create_fb(data->drm_fd,
+				       overlay_w,
+				       overlay_h,
+				       data->drm_format_overlay,
+				       DRM_FORMAT_MOD_LINEAR,
+				       &fb1);
+		igt_assert(fb_id1);
+
+		igt_plane_set_fb(overlay, &fb1);
+		igt_plane_set_position(overlay, overlay_x, overlay_y);
+	}
 
 	fbref_id = igt_create_fb(data->drm_fd,
 			      mode->hdisplay,
@@ -207,23 +232,32 @@ static bool test_pipe_gamma(data_t *data,
 			      &fbref);
 	igt_assert(fbref_id);
 
-	igt_plane_set_fb(primary, &fbref);
 	disable_ctm(primary->pipe);
 	disable_degamma(primary->pipe);
-	set_gamma(data, primary->pipe, gamma_full);
-	igt_display_commit(&data->display);
+	disable_gamma(primary->pipe);
+	igt_display_commit2(&data->display, multiplane ? COMMIT_ATOMIC : COMMIT_LEGACY);
 
 	/* Draw solid colors with no gamma transformation. */
-	paint_rectangles(data, mode->vdisplay, mode->hdisplay,
-			 0, 0, red_green_blue, &fbref);
+	paint_rectangles(data, primary_h, primary_w, 0, 0, red_green_blue, &fbref);
+	paint_rectangles(data, overlay_h, overlay_w, 0, 0, blue_red_green, &fbref);
 
 	/* Draw a gradient with gamma LUT to remap all values
 	 * to max red/green/blue.
 	 */
-	paint_gradient_rectangles(data, mode->vdisplay, mode->hdisplay,
-				  0, 0, red_green_blue, &fb);
-	igt_plane_set_fb(primary, &fb);
-	igt_display_commit(&data->display);
+	paint_gradient_rectangles(data, primary_h, primary_w,
+				  primary_x, primary_y, red_green_blue, &fb0);
+	igt_plane_set_fb(primary, &fb0);
+	igt_plane_set_position(primary, primary_x, primary_y);
+
+	if (multiplane) {
+		paint_gradient_rectangles(data, overlay_h, overlay_w,
+					  0, 0, blue_red_green, &fb1);
+		igt_plane_set_fb(overlay, &fb1);
+		igt_plane_set_position(overlay, overlay_x, overlay_y);
+	}
+
+	set_gamma(data, primary->pipe, gamma_full);
+	igt_display_commit2(&data->display, multiplane ? COMMIT_ATOMIC : COMMIT_LEGACY);
 	chamelium_capture(data->chamelium, port, 0, 0, 0, 0, 1);
 	frame_fullcolors =
 		chamelium_read_captured_frame(data->chamelium, 0);
@@ -238,8 +272,10 @@ static bool test_pipe_gamma(data_t *data,
 
 	disable_gamma(primary->pipe);
 	igt_plane_set_fb(primary, NULL);
+	if (multiplane)
+		igt_plane_set_fb(overlay, NULL);
 	igt_output_set_pipe(output, PIPE_NONE);
-	igt_display_commit(&data->display);
+	igt_display_commit2(&data->display, multiplane ? COMMIT_ATOMIC : COMMIT_LEGACY);
 	free_lut(gamma_full);
 
 	return ret;
@@ -623,6 +659,10 @@ run_tests_for_pipe(data_t *data)
 
 		{ "gamma", test_pipe_gamma, false,
 		  "Verify that gamma LUT transformation works correctly" },
+
+		{ "gamma-multiplane", test_pipe_gamma, true,
+		  "Verify that gamma LUT transformation works correctly for multiplane" },
+
 	};
 	struct {
 		const char *name;
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [igt-dev] [PATCH i-g-t v4 7/7] tests/chamelium/kms_color_chamelium: MPO + pipe color test for ctm
  2022-11-10  5:53 [igt-dev] [PATCH i-g-t v4 0/7] MPO + pipe color test Ananya Sharma
                   ` (5 preceding siblings ...)
  2022-11-10  5:53 ` [igt-dev] [PATCH i-g-t v4 6/7] tests/chamelium/kms_color_chamelium: MPO + pipe color test for gamma Ananya Sharma
@ 2022-11-10  5:53 ` Ananya Sharma
  6 siblings, 0 replies; 9+ messages in thread
From: Ananya Sharma @ 2022-11-10  5:53 UTC (permalink / raw)
  To: igt-dev

Adding multiple planes with two different formats i.e. RGB and
NV12 in pipe color test for gamma in kms_color_chamelium too
as we can expect crc mismatches due to the hardware round-ups
the LUT values. This will also increase the coverage in color
management.

Signed-off-by: Ananya Sharma <ananya.sharma@intel.com>
---
 tests/chamelium/kms_color_chamelium.c | 136 +++++++++++++++++++-------
 1 file changed, 101 insertions(+), 35 deletions(-)

diff --git a/tests/chamelium/kms_color_chamelium.c b/tests/chamelium/kms_color_chamelium.c
index 695cb9ad..6b39ee60 100644
--- a/tests/chamelium/kms_color_chamelium.c
+++ b/tests/chamelium/kms_color_chamelium.c
@@ -287,6 +287,7 @@ static bool test_pipe_gamma(data_t *data,
  */
 static bool test_pipe_ctm(data_t *data,
 			  igt_plane_t *primary,
+			  bool multiplane,
 			  color_t *before,
 			  color_t *after,
 			  double *ctm_matrix,
@@ -294,10 +295,13 @@ static bool test_pipe_ctm(data_t *data,
 {
 	gamma_lut_t *degamma_linear, *gamma_linear;
 	igt_output_t *output = data->output;
+	igt_plane_t *overlay = data->overlay;
 	drmModeModeInfo *mode = data->mode;
-	struct igt_fb fb_modeset, fb, fbref;
+	struct igt_fb fb0, fb1, fbref;
 	struct chamelium_frame_dump *frame_hardware;
-	int fb_id, fb_modeset_id, fbref_id;
+	int fb_id0, fb_id1, fbref_id;
+	int primary_x, primary_y, primary_h, primary_w;
+	int overlay_x, overlay_y, overlay_h, overlay_w;
 	bool ret = true;
 
 	igt_require(igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_CTM));
@@ -307,22 +311,39 @@ static bool test_pipe_ctm(data_t *data,
 
 	igt_output_set_pipe(output, primary->pipe->pipe);
 
+	primary_w = mode->hdisplay;
+	primary_h = mode->vdisplay / 2;
+	overlay_w = mode->hdisplay;
+	overlay_h = primary_h + (mode->vdisplay % 2);
+	primary_x = 0;
+	primary_y = 0;
+	overlay_x = 0;
+	overlay_y = primary_h;
+
 	/* Create a framebuffer at the size of the output. */
-	fb_id = igt_create_fb(data->drm_fd,
-			      mode->hdisplay,
-			      mode->vdisplay,
-			      DRM_FORMAT_XRGB8888,
-			      DRM_FORMAT_MOD_LINEAR,
-			      &fb);
-	igt_assert(fb_id);
+	fb_id0 = igt_create_fb(data->drm_fd,
+			       primary_w,
+			       primary_h,
+			       data->drm_format,
+			       DRM_FORMAT_MOD_LINEAR,
+			       &fb0);
+	igt_assert(fb_id0);
 
-	fb_modeset_id = igt_create_fb(data->drm_fd,
-				      mode->hdisplay,
-				      mode->vdisplay,
-				      DRM_FORMAT_XRGB8888,
-				      DRM_FORMAT_MOD_LINEAR,
-				      &fb_modeset);
-	igt_assert(fb_modeset_id);
+	igt_plane_set_fb(primary, &fb0);
+	igt_plane_set_position(primary, primary_x, primary_y);
+
+	if (multiplane) {
+		fb_id1 = igt_create_fb(data->drm_fd,
+				       overlay_w,
+				       overlay_h,
+				       data->drm_format_overlay,
+				       DRM_FORMAT_MOD_LINEAR,
+				       &fb1);
+		igt_assert(fb_id1);
+
+		igt_plane_set_fb(overlay, &fb1);
+		igt_plane_set_position(overlay, overlay_x, overlay_y);
+	}
 
 	fbref_id = igt_create_fb(data->drm_fd,
 				 mode->hdisplay,
@@ -332,8 +353,6 @@ static bool test_pipe_ctm(data_t *data,
 				 &fbref);
 	igt_assert(fbref_id);
 
-	igt_plane_set_fb(primary, &fb_modeset);
-
 	if (memcmp(before, after, sizeof(color_t))) {
 		set_degamma(data, primary->pipe, degamma_linear);
 		set_gamma(data, primary->pipe, gamma_linear);
@@ -344,16 +363,24 @@ static bool test_pipe_ctm(data_t *data,
 	}
 
 	disable_ctm(primary->pipe);
-	igt_display_commit(&data->display);
+	igt_display_commit2(&data->display, multiplane ? COMMIT_ATOMIC : COMMIT_LEGACY);
 
-	paint_rectangles(data, mode->vdisplay, mode->hdisplay,
-			 0, 0, after, &fbref);
+	paint_rectangles(data, primary_h, primary_w, 0, 0, after, &fbref);
+	paint_rectangles(data, overlay_h, overlay_w, 0, 0, after, &fbref);
 
 	/* With CTM transformation. */
-	paint_rectangles(data, mode->vdisplay, mode->hdisplay, 0, 0, before, &fb);
-	igt_plane_set_fb(primary, &fb);
+	paint_rectangles(data, primary_h, primary_w, primary_x, primary_y, before, &fb0);
+	igt_plane_set_fb(primary, &fb0);
+	igt_plane_set_position(primary, primary_x, primary_y);
+
+	if (multiplane) {
+		paint_rectangles(data, overlay_h, overlay_w, 0, 0, before, &fb1);
+		igt_plane_set_fb(overlay, &fb1);
+		igt_plane_set_position(overlay, overlay_x, overlay_y);
+	}
+
 	set_ctm(primary->pipe, ctm_matrix);
-	igt_display_commit(&data->display);
+	igt_display_commit2(&data->display, multiplane ? COMMIT_ATOMIC : COMMIT_LEGACY);
 	chamelium_capture(data->chamelium, port, 0, 0, 0, 0, 1);
 	frame_hardware =
 		chamelium_read_captured_frame(data->chamelium, 0);
@@ -368,10 +395,13 @@ static bool test_pipe_ctm(data_t *data,
 					     CHAMELIUM_CHECK_ANALOG);
 
 	igt_plane_set_fb(primary, NULL);
+	if (multiplane)
+		igt_plane_set_fb(overlay, NULL);
 	disable_degamma(primary->pipe);
 	disable_gamma(primary->pipe);
+	disable_ctm(primary->pipe);
 	igt_output_set_pipe(output, PIPE_NONE);
-	igt_display_commit(&data->display);
+	igt_display_commit2(&data->display, multiplane ? COMMIT_ATOMIC : COMMIT_LEGACY);
 	free_lut(degamma_linear);
 	free_lut(gamma_linear);
 
@@ -563,10 +593,13 @@ run_gamma_degamma_tests_for_pipe(data_t *data, enum pipe p, bool multiplane,
 
 static void
 run_ctm_tests_for_pipe(data_t *data, enum pipe p,
+		       bool multiplane,
 		       color_t *expected_colors,
 		       double *ctm,
 		       int iter)
 {
+	igt_plane_t *overlay;
+	int count = 0;
 	double delta;
 	color_t red_green_blue[] = {
 		{ 1.0, 0.0, 0.0 },
@@ -592,12 +625,29 @@ run_ctm_tests_for_pipe(data_t *data, enum pipe p,
 	data->drm_format = DRM_FORMAT_XRGB8888;
 	data->mode = igt_output_get_mode(data->output);
 
+	if (multiplane) {
+		for_each_plane_on_pipe(&data->display, p, overlay) {
+			if (overlay->type != DRM_PLANE_TYPE_OVERLAY)
+				continue;
+
+			if (igt_plane_has_format_mod(overlay, DRM_FORMAT_NV12,
+						     DRM_FORMAT_MOD_LINEAR)) {
+				count++;
+				break;
+			}
+		}
+		igt_require_f(count, "No valid planes found.\n");
+	}
+
+	data->overlay = overlay;
+	data->drm_format_overlay = DRM_FORMAT_NV12;
+
 	igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(p), data->output->name) {
 		bool success = false;
 		int i;
 
 		if (!iter)
-			success = test_pipe_ctm(data, data->primary,
+			success = test_pipe_ctm(data, data->primary, multiplane,
 						red_green_blue,
 						expected_colors, ctm,
 						data->ports[port_idx]);
@@ -613,7 +663,7 @@ run_ctm_tests_for_pipe(data_t *data, enum pipe p,
 				expected_colors[1].g =
 				expected_colors[2].b =
 				ctm[0] + delta * (i - (iter / 2));
-			if (test_pipe_ctm(data, data->primary,
+			if (test_pipe_ctm(data, data->primary, multiplane,
 					  red_green_blue, expected_colors,
 					  ctm, data->ports[port_idx])) {
 				success = true;
@@ -667,11 +717,12 @@ run_tests_for_pipe(data_t *data)
 	struct {
 		const char *name;
 		int iter;
+		bool multiplane;
 		color_t colors[3];
 		double ctm[9];
 		const char *desc;
 	} ctm_tests[] = {
-		{ "ctm-red-to-blue", 0,
+		{ "ctm-multiplane", 0, true,
 			{{ 0.0, 0.0, 1.0 },
 			 { 0.0, 1.0, 0.0 },
 			 { 0.0, 0.0, 1.0 }},
@@ -680,7 +731,16 @@ run_tests_for_pipe(data_t *data)
 		    1.0, 0.0, 1.0 },
 		  "Check the color transformation from red to blue"
 		},
-		{ "ctm-green-to-red", 0,
+		{ "ctm-red-to-blue", 0, false,
+			{{ 0.0, 0.0, 1.0 },
+			 { 0.0, 1.0, 0.0 },
+			 { 0.0, 0.0, 1.0 }},
+		  { 0.0, 0.0, 0.0,
+		    0.0, 1.0, 0.0,
+		    1.0, 0.0, 1.0 },
+		  "Check the color transformation from red to blue"
+		},
+		{ "ctm-green-to-red", 0, false,
 			{{ 1.0, 0.0, 0.0 },
 			 { 1.0, 0.0, 0.0 },
 			 { 0.0, 0.0, 1.0 }},
@@ -689,7 +749,7 @@ run_tests_for_pipe(data_t *data)
 		    0.0, 0.0, 1.0 },
 		  "Check the color transformation from green to red"
 		},
-		{ "ctm-blue-to-red", 0,
+		{ "ctm-blue-to-red", 0, false,
 			{{ 1.0, 0.0, 0.0 },
 			 { 0.0, 1.0, 0.0 },
 			 { 1.0, 0.0, 0.0 }},
@@ -698,7 +758,7 @@ run_tests_for_pipe(data_t *data)
 		    0.0, 0.0, 0.0 },
 		  "Check the color transformation from blue to red"
 		},
-		{ "ctm-max", 0,
+		{ "ctm-max", 0, false,
 			{{ 1.0, 0.0, 0.0 },
 			 { 0.0, 1.0, 0.0 },
 			 { 0.0, 0.0, 1.0 }},
@@ -707,7 +767,7 @@ run_tests_for_pipe(data_t *data)
 		    0.0, 0.0, 100.0 },
 		  "Check the color transformation for maximum transparency"
 		},
-		{ "ctm-negative", 0,
+		{ "ctm-negative", 0, false,
 			{{ 0.0, 0.0, 0.0 },
 			 { 0.0, 0.0, 0.0 },
 			 { 0.0, 0.0, 0.0 }},
@@ -716,21 +776,21 @@ run_tests_for_pipe(data_t *data)
 		    0.0, 0.0, -1.0 },
 		  "Check the color transformation for negative transparency"
 		},
-		{ "ctm-0-25", 5,
+		{ "ctm-0-25", 5, false,
 			{{ 0.0, }, { 0.0, }, { 0.0, }},
 		  { 0.25, 0.0,  0.0,
 		    0.0,  0.25, 0.0,
 		    0.0,  0.0,  0.25 },
 		  "Check the color transformation for 0.25 transparency"
 		},
-		{ "ctm-0-50", 5,
+		{ "ctm-0-50", 5, false,
 			{{ 0.0, }, { 0.0, }, { 0.0, }},
 		  { 0.5,  0.0,  0.0,
 		    0.0,  0.5,  0.0,
 		    0.0,  0.0,  0.5 },
 		  "Check the color transformation for 0.5 transparency"
 		},
-		{ "ctm-0-75", 7,
+		{ "ctm-0-75", 7, false,
 			{{ 0.0, }, { 0.0, }, { 0.0, }},
 		  { 0.75, 0.0,  0.0,
 		    0.0,  0.75, 0.0,
@@ -759,8 +819,14 @@ run_tests_for_pipe(data_t *data)
 	for (i = 0; i < ARRAY_SIZE(ctm_tests); i++) {
 		igt_describe_f("%s", ctm_tests[i].desc);
 		igt_subtest_with_dynamic_f("%s", ctm_tests[i].name) {
+			if (ctm_tests[i].multiplane &&
+			   (!data->display.is_atomic ||
+			    !igt_display_has_format_mod(&data->display, DRM_FORMAT_NV12,
+							DRM_FORMAT_MOD_LINEAR)))
+				continue;
 			for_each_pipe(&data->display, pipe) {
 				run_ctm_tests_for_pipe(data, pipe,
+						       ctm_tests[i].multiplane,
 						       ctm_tests[i].colors,
 						       ctm_tests[i].ctm,
 						       ctm_tests[i].iter);
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [igt-dev] [PATCH i-g-t v4 1/7] tests/kms_color_helper: helper to enable MPO + pipe color test
  2022-11-10  7:08 [igt-dev] [PATCH i-g-t v4 0/7] MPO + pipe color test Ananya Sharma
@ 2022-11-10  7:08 ` Ananya Sharma
  0 siblings, 0 replies; 9+ messages in thread
From: Ananya Sharma @ 2022-11-10  7:08 UTC (permalink / raw)
  To: igt-dev

Adding support of multiple planes in pipe color test by splitting the
screen into two parts i.e. one plane having RGB format and another
one having NV12 format. To add this support for multiple planes the
two functions paint_rectangle() and paint_gradient_rectangle() are
modified in kms_color_helper accordingly. This patch contains the
effected changes that will take place in kms_color and
kms_color_chamelium due to the changes in kms_color_helper.

Signed-off-by: Ananya Sharma <ananya.sharma@intel.com>
---
 tests/chamelium/kms_color_chamelium.c | 23 +++++++++++++++--------
 tests/kms_color.c                     | 24 ++++++++++++++++--------
 tests/kms_color_helper.c              | 26 +++++++++++++++-----------
 tests/kms_color_helper.h              | 10 ++++++++--
 4 files changed, 54 insertions(+), 29 deletions(-)

diff --git a/tests/chamelium/kms_color_chamelium.c b/tests/chamelium/kms_color_chamelium.c
index 907f4dd5..4a8cb339 100644
--- a/tests/chamelium/kms_color_chamelium.c
+++ b/tests/chamelium/kms_color_chamelium.c
@@ -85,12 +85,14 @@ static bool test_pipe_degamma(data_t *data,
 	igt_display_commit(&data->display);
 
 	/* Draw solid colors with linear degamma transformation. */
-	paint_rectangles(data, mode, red_green_blue, &fbref);
+	paint_rectangles(data, mode->vdisplay, mode->hdisplay,
+			 0, 0, red_green_blue, &fbref);
 
 	/* Draw a gradient with degamma LUT to remap all
 	 * values to max red/green/blue.
 	 */
-	paint_gradient_rectangles(data, mode, red_green_blue, &fb);
+	paint_gradient_rectangles(data, mode->vdisplay, mode->hdisplay,
+				  0, 0, red_green_blue, &fb);
 	igt_plane_set_fb(primary, &fb);
 	set_degamma(data, primary->pipe, degamma_full);
 	igt_display_commit(&data->display);
@@ -175,12 +177,14 @@ static bool test_pipe_gamma(data_t *data,
 	igt_display_commit(&data->display);
 
 	/* Draw solid colors with no gamma transformation. */
-	paint_rectangles(data, mode, red_green_blue, &fbref);
+	paint_rectangles(data, mode->vdisplay, mode->hdisplay,
+			 0, 0, red_green_blue, &fbref);
 
 	/* Draw a gradient with gamma LUT to remap all values
 	 * to max red/green/blue.
 	 */
-	paint_gradient_rectangles(data, mode, red_green_blue, &fb);
+	paint_gradient_rectangles(data, mode->vdisplay, mode->hdisplay,
+				  0, 0, red_green_blue, &fb);
 	igt_plane_set_fb(primary, &fb);
 	igt_display_commit(&data->display);
 	chamelium_capture(data->chamelium, port, 0, 0, 0, 0, 1);
@@ -269,10 +273,11 @@ static bool test_pipe_ctm(data_t *data,
 	disable_ctm(primary->pipe);
 	igt_display_commit(&data->display);
 
-	paint_rectangles(data, mode, after, &fbref);
+	paint_rectangles(data, mode->vdisplay, mode->hdisplay,
+			 0, 0, after, &fbref);
 
 	/* With CTM transformation. */
-	paint_rectangles(data, mode, before, &fb);
+	paint_rectangles(data, mode->vdisplay, mode->hdisplay, 0, 0, before, &fb);
 	igt_plane_set_fb(primary, &fb);
 	set_ctm(primary->pipe, ctm_matrix);
 	igt_display_commit(&data->display);
@@ -367,7 +372,8 @@ static bool test_pipe_limited_range_ctm(data_t *data,
 	igt_output_set_prop_value(output,
 				  IGT_CONNECTOR_BROADCAST_RGB,
 				  BROADCAST_RGB_FULL);
-	paint_rectangles(data, mode, red_green_blue_limited, &fb);
+	paint_rectangles(data, mode->vdisplay, mode->hdisplay,
+			 0, 0, red_green_blue_limited, &fb);
 	igt_plane_set_fb(primary, &fb);
 	igt_display_commit(&data->display);
 
@@ -375,7 +381,8 @@ static bool test_pipe_limited_range_ctm(data_t *data,
 	igt_output_set_prop_value(output,
 				  IGT_CONNECTOR_BROADCAST_RGB,
 				  BROADCAST_RGB_16_235);
-	paint_rectangles(data, mode, red_green_blue_full, &fb);
+	paint_rectangles(data, mode->vdisplay, mode->hdisplay,
+			 0, 0, red_green_blue_full, &fb);
 
 	/* And reset.. */
 	igt_output_set_prop_value(output,
diff --git a/tests/kms_color.c b/tests/kms_color.c
index e4dc2465..cbe3c391 100644
--- a/tests/kms_color.c
+++ b/tests/kms_color.c
@@ -76,7 +76,8 @@ static bool test_pipe_degamma(data_t *data,
 	igt_display_commit(&data->display);
 
 	/* Draw solid colors with linear degamma transformation. */
-	paint_rectangles(data, mode, red_green_blue, &fb);
+	paint_rectangles(data, mode->vdisplay, mode->hdisplay,
+			 0, 0, red_green_blue, &fb);
 	igt_plane_set_fb(primary, &fb);
 	igt_display_commit(&data->display);
 	igt_wait_for_vblank(data->drm_fd,
@@ -87,7 +88,8 @@ static bool test_pipe_degamma(data_t *data,
 	 * Draw a gradient with degamma LUT to remap all
 	 * values to max red/green/blue.
 	 */
-	paint_gradient_rectangles(data, mode, red_green_blue, &fb);
+	paint_gradient_rectangles(data, mode->vdisplay, mode->hdisplay,
+				  0, 0, red_green_blue, &fb);
 	igt_plane_set_fb(primary, &fb);
 	set_degamma(data, primary->pipe, degamma_full);
 	igt_display_commit(&data->display);
@@ -166,7 +168,8 @@ static bool test_pipe_gamma(data_t *data,
 	igt_display_commit(&data->display);
 
 	/* Draw solid colors with no gamma transformation. */
-	paint_rectangles(data, mode, red_green_blue, &fb);
+	paint_rectangles(data, mode->vdisplay, mode->hdisplay,
+			 0, 0, red_green_blue, &fb);
 	igt_plane_set_fb(primary, &fb);
 	igt_display_commit(&data->display);
 	igt_wait_for_vblank(data->drm_fd,
@@ -177,7 +180,8 @@ static bool test_pipe_gamma(data_t *data,
 	 * Draw a gradient with gamma LUT to remap all values
 	 * to max red/green/blue.
 	 */
-	paint_gradient_rectangles(data, mode, red_green_blue, &fb);
+	paint_gradient_rectangles(data, mode->vdisplay, mode->hdisplay,
+				  0, 0, red_green_blue, &fb);
 	igt_plane_set_fb(primary, &fb);
 	igt_display_commit(&data->display);
 	igt_wait_for_vblank(data->drm_fd,
@@ -261,7 +265,8 @@ static bool test_pipe_legacy_gamma(data_t *data,
 	igt_display_commit(&data->display);
 
 	/* Draw solid colors with no gamma transformation. */
-	paint_rectangles(data, mode, red_green_blue, &fb);
+	paint_rectangles(data, mode->vdisplay, mode->hdisplay,
+			 0, 0, red_green_blue, &fb);
 	igt_plane_set_fb(primary, &fb);
 	igt_display_commit(&data->display);
 	igt_wait_for_vblank(data->drm_fd,
@@ -272,7 +277,8 @@ static bool test_pipe_legacy_gamma(data_t *data,
 	 * Draw a gradient with gamma LUT to remap all values
 	 * to max red/green/blue.
 	 */
-	paint_gradient_rectangles(data, mode, red_green_blue, &fb);
+	paint_gradient_rectangles(data, mode->vdisplay, mode->hdisplay,
+				  0, 0, red_green_blue, &fb);
 	igt_plane_set_fb(primary, &fb);
 
 	red_lut[0] = green_lut[0] = blue_lut[0] = 0;
@@ -513,7 +519,8 @@ static bool test_pipe_ctm(data_t *data,
 	disable_ctm(primary->pipe);
 	igt_display_commit(&data->display);
 
-	paint_rectangles(data, mode, after, &fb);
+	paint_rectangles(data, mode->vdisplay, mode->hdisplay,
+			 0, 0, after, &fb);
 	igt_plane_set_fb(primary, &fb);
 	set_ctm(primary->pipe, ctm_identity);
 	igt_display_commit(&data->display);
@@ -522,7 +529,8 @@ static bool test_pipe_ctm(data_t *data,
 	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_software);
 
 	/* With CTM transformation. */
-	paint_rectangles(data, mode, before, &fb);
+	paint_rectangles(data, mode->vdisplay, mode->hdisplay,
+			 0, 0, before, &fb);
 	igt_plane_set_fb(primary, &fb);
 	set_ctm(primary->pipe, ctm_matrix);
 	igt_display_commit(&data->display);
diff --git a/tests/kms_color_helper.c b/tests/kms_color_helper.c
index 55f3e409..dbcb3f34 100644
--- a/tests/kms_color_helper.c
+++ b/tests/kms_color_helper.c
@@ -41,20 +41,22 @@ uint64_t get_max_bpc(igt_output_t *output)
 }
 
 void paint_gradient_rectangles(data_t *data,
-			       drmModeModeInfo *mode,
+			       uint16_t vdisplay,
+			       uint16_t hdisplay,
+			       int x, int y,
 			       color_t *colors,
 			       struct igt_fb *fb)
 {
 	cairo_t *cr = igt_get_cairo_ctx(data->drm_fd, fb);
-	int i, l = mode->hdisplay / 3;
-	int rows_remaining = mode->hdisplay % 3;
+	int i, l = hdisplay / 3;
+	int rows_remaining = hdisplay % 3;
 
 	/* Paint 3 gradient rectangles with red/green/blue between 1.0 and
 	 * 0.5. We want to avoid 0 so each max LUTs only affect their own
 	 * rectangle.
 	 */
 	for (i = 0 ; i < 3; i++) {
-		igt_paint_color_gradient_range(cr, i * l, 0, l, mode->vdisplay,
+		igt_paint_color_gradient_range(cr, (x + (i * l)), y, l, vdisplay,
 					       colors[i].r != 0 ? 0.2 : 0,
 					       colors[i].g != 0 ? 0.2 : 0,
 					       colors[i].b != 0 ? 0.2 : 0,
@@ -64,8 +66,8 @@ void paint_gradient_rectangles(data_t *data,
 	}
 
 	if (rows_remaining > 0)
-		igt_paint_color_gradient_range(cr, i * l, 0, rows_remaining,
-					       mode->vdisplay,
+		igt_paint_color_gradient_range(cr, (x + (i * l)), y, rows_remaining,
+					       vdisplay,
 					       colors[i-1].r != 0 ? 0.2 : 0,
 					       colors[i-1].g != 0 ? 0.2 : 0,
 					       colors[i-1].b != 0 ? 0.2 : 0,
@@ -77,22 +79,24 @@ void paint_gradient_rectangles(data_t *data,
 }
 
 void paint_rectangles(data_t *data,
-		      drmModeModeInfo *mode,
+		      uint16_t vdisplay,
+		      uint16_t hdisplay,
+		      int x, int y,
 		      color_t *colors,
 		      struct igt_fb *fb)
 {
 	cairo_t *cr = igt_get_cairo_ctx(data->drm_fd, fb);
-	int i, l = mode->hdisplay / 3;
-	int rows_remaining = mode->hdisplay % 3;
+	int i, l = hdisplay / 3;
+	int rows_remaining = hdisplay % 3;
 
 	/* Paint 3 solid rectangles. */
 	for (i = 0 ; i < 3; i++) {
-		igt_paint_color(cr, i * l, 0, l, mode->vdisplay,
+		igt_paint_color(cr, (x + (i * l)), y, l, vdisplay,
 				colors[i].r, colors[i].g, colors[i].b);
 	}
 
 	if (rows_remaining > 0)
-		igt_paint_color(cr, i * l, 0, rows_remaining, mode->vdisplay,
+		igt_paint_color(cr, (x + (i * l)), y, rows_remaining, vdisplay,
 				colors[i-1].r, colors[i-1].g, colors[i-1].b);
 
 	igt_put_cairo_ctx(cr);
diff --git a/tests/kms_color_helper.h b/tests/kms_color_helper.h
index f0ae30e3..199d449c 100644
--- a/tests/kms_color_helper.h
+++ b/tests/kms_color_helper.h
@@ -51,9 +51,11 @@ typedef struct {
 	igt_pipe_crc_t *pipe_crc;
 	igt_output_t *output;
 	igt_plane_t *primary;
+	igt_plane_t *overlay;
 	drmModeModeInfo *mode;
 
 	uint32_t drm_format;
+	uint32_t drm_format_overlay;
 	uint32_t color_depth;
 	uint64_t degamma_lut_size;
 	uint64_t gamma_lut_size;
@@ -72,11 +74,15 @@ typedef struct {
 bool panel_supports_deep_color(int fd, char *output_name);
 uint64_t get_max_bpc(igt_output_t *output);
 void paint_gradient_rectangles(data_t *data,
-			       drmModeModeInfo *mode,
+			       uint16_t vdisplay,
+			       uint16_t hdisplay,
+			       int x, int y,
 			       color_t *colors,
 			       struct igt_fb *fb);
 void paint_rectangles(data_t *data,
-		      drmModeModeInfo *mode,
+		      uint16_t vdisplay,
+		      uint16_t hdisplay,
+		      int x, int y,
 		      color_t *colors,
 		      struct igt_fb *fb);
 gamma_lut_t *alloc_lut(int lut_size);
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-11-10  7:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-10  5:53 [igt-dev] [PATCH i-g-t v4 0/7] MPO + pipe color test Ananya Sharma
2022-11-10  5:53 ` [igt-dev] [PATCH i-g-t v4 1/7] tests/kms_color_helper: helper to enable " Ananya Sharma
2022-11-10  5:53 ` [igt-dev] [PATCH i-g-t v4 2/7] tests/kms_color: MPO + pipe color test for degamma Ananya Sharma
2022-11-10  5:53 ` [igt-dev] [PATCH i-g-t v4 3/7] tests/kms_color: MPO + pipe color test for gamma Ananya Sharma
2022-11-10  5:53 ` [igt-dev] [PATCH i-g-t v4 4/7] tests/kms_color: MPO + pipe color test for ctm Ananya Sharma
2022-11-10  5:53 ` [igt-dev] [PATCH i-g-t v4 5/7] tests/chamelium/kms_color_chamelium: MPO + pipe color test for degamma Ananya Sharma
2022-11-10  5:53 ` [igt-dev] [PATCH i-g-t v4 6/7] tests/chamelium/kms_color_chamelium: MPO + pipe color test for gamma Ananya Sharma
2022-11-10  5:53 ` [igt-dev] [PATCH i-g-t v4 7/7] tests/chamelium/kms_color_chamelium: MPO + pipe color test for ctm Ananya Sharma
2022-11-10  7:08 [igt-dev] [PATCH i-g-t v4 0/7] MPO + pipe color test Ananya Sharma
2022-11-10  7:08 ` [igt-dev] [PATCH i-g-t v4 1/7] tests/kms_color_helper: helper to enable " Ananya Sharma

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.