Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t v2 2/9] tests/kms_color: Use named initializers
Date: Tue, 11 Apr 2023 19:15:47 +0300	[thread overview]
Message-ID: <20230411161555.10001-3-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20230411161555.10001-1-ville.syrjala@linux.intel.com>

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

Use named initializers to make it actually possible to figure out
what is happening. And sprinkle some missing commas around while
at it.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 tests/kms_color.c | 202 +++++++++++++++++++++++++++-------------------
 1 file changed, 118 insertions(+), 84 deletions(-)

diff --git a/tests/kms_color.c b/tests/kms_color.c
index 369dc8057d83..84a8eabe5484 100644
--- a/tests/kms_color.c
+++ b/tests/kms_color.c
@@ -35,7 +35,7 @@ static bool test_pipe_degamma(data_t *data,
 	color_t red_green_blue[] = {
 		{ 1.0, 0.0, 0.0 },
 		{ 0.0, 1.0, 0.0 },
-		{ 0.0, 0.0, 1.0 }
+		{ 0.0, 0.0, 1.0 },
 	};
 	drmModeModeInfo *mode = data->mode;
 	struct igt_fb fb_modeset, fb;
@@ -127,7 +127,7 @@ static bool test_pipe_gamma(data_t *data,
 	color_t red_green_blue[] = {
 		{ 1.0, 0.0, 0.0 },
 		{ 0.0, 1.0, 0.0 },
-		{ 0.0, 0.0, 1.0 }
+		{ 0.0, 0.0, 1.0 },
 	};
 	drmModeModeInfo *mode = data->mode;
 	struct igt_fb fb_modeset, fb;
@@ -215,7 +215,7 @@ static bool test_pipe_legacy_gamma(data_t *data,
 	color_t red_green_blue[] = {
 		{ 1.0, 0.0, 0.0 },
 		{ 0.0, 1.0, 0.0 },
-		{ 0.0, 0.0, 1.0 }
+		{ 0.0, 0.0, 1.0 },
 	};
 	drmModeCrtc *kms_crtc;
 	uint32_t i, legacy_lut_size;
@@ -324,7 +324,7 @@ static bool test_pipe_legacy_gamma_reset(data_t *data,
 	const double ctm_identity[] = {
 		1.0, 0.0, 0.0,
 		0.0, 1.0, 0.0,
-		0.0, 0.0, 1.0
+		0.0, 0.0, 1.0,
 	};
 	drmModeCrtc *kms_crtc;
 	gamma_lut_t *degamma_linear = NULL, *gamma_zero;
@@ -461,7 +461,7 @@ static bool test_pipe_ctm(data_t *data,
 	const double ctm_identity[] = {
 		1.0, 0.0, 0.0,
 		0.0, 1.0, 0.0,
-		0.0, 0.0, 1.0
+		0.0, 0.0, 1.0,
 	};
 	gamma_lut_t *degamma_linear = NULL, *gamma_linear = NULL;
 	igt_output_t *output = data->output;
@@ -569,16 +569,18 @@ static void test_pipe_limited_range_ctm(data_t *data,
 	color_t red_green_blue_limited[] = {
 		{ limited_result, 0.0, 0.0 },
 		{ 0.0, limited_result, 0.0 },
-		{ 0.0, 0.0, limited_result }
+		{ 0.0, 0.0, limited_result },
 	};
 	color_t red_green_blue_full[] = {
 		{ 0.5, 0.0, 0.0 },
 		{ 0.0, 0.5, 0.0 },
-		{ 0.0, 0.0, 0.5 }
+		{ 0.0, 0.0, 0.5 },
+	};
+	double ctm[] = {
+		1.0, 0.0, 0.0,
+		0.0, 1.0, 0.0,
+		0.0, 0.0, 1.0,
 	};
-	double ctm[] = { 1.0, 0.0, 0.0,
-			0.0, 1.0, 0.0,
-			0.0, 0.0, 1.0 };
 	gamma_lut_t *degamma_linear, *gamma_linear;
 	igt_output_t *output;
 	bool has_broadcast_rgb_output = false;
@@ -743,7 +745,7 @@ run_ctm_tests_for_pipe(data_t *data, enum pipe p,
 	color_t red_green_blue[] = {
 		{ 1.0, 0.0, 0.0 },
 		{ 0.0, 1.0, 0.0 },
-		{ 0.0, 0.0, 1.0 }
+		{ 0.0, 0.0, 1.0 },
 	};
 
 	test_setup(data, p);
@@ -799,16 +801,18 @@ run_deep_color_tests_for_pipe(data_t *data, enum pipe p)
 	color_t blue_green_blue[] = {
 		{ 0.0, 0.0, 1.0 },
 		{ 0.0, 1.0, 0.0 },
-		{ 0.0, 0.0, 1.0 }
+		{ 0.0, 0.0, 1.0 },
 	};
 	color_t red_green_blue[] = {
 		{ 1.0, 0.0, 0.0 },
 		{ 0.0, 1.0, 0.0 },
 		{ 0.0, 0.0, 1.0 }
 	};
-	double ctm[] = { 0.0, 0.0, 0.0,
-			 0.0, 1.0, 0.0,
-			 1.0, 0.0, 1.0 };
+	double ctm[] = {
+		0.0, 0.0, 0.0,
+		0.0, 1.0, 0.0,
+		1.0, 0.0, 1.0,
+	};
 
 	if (is_i915_device(data->drm_fd))
 		igt_require_f((intel_display_ver(data->devid) >= 11),
@@ -924,17 +928,22 @@ run_tests_for_pipe(data_t *data)
 		bool (*test_t)(data_t*, igt_plane_t*);
 		const char *desc;
 	} gamma_degamma_tests[] = {
-		{ "degamma", test_pipe_degamma,
-		  "Verify that degamma LUT transformation works correctly" },
-
-		{ "gamma", test_pipe_gamma,
-		  "Verify that gamma LUT transformation works correctly" },
-
-		{ "legacy-gamma", test_pipe_legacy_gamma,
-		  "Verify that legacy gamma LUT transformation works correctly" },
-
-		{ "legacy-gamma-reset", test_pipe_legacy_gamma_reset,
-		  "Verify that setting the legacy gamma LUT resets the gamma LUT set through GAMMA_LUT property" },
+		{ .name = "degamma",
+		  .test_t = test_pipe_degamma,
+		  .desc = "Verify that degamma LUT transformation works correctly",
+		},
+		{ .name = "gamma",
+		  .test_t = test_pipe_gamma,
+		  .desc = "Verify that gamma LUT transformation works correctly",
+		},
+		{ .name = "legacy-gamma",
+		  .test_t = test_pipe_legacy_gamma,
+		  .desc = "Verify that legacy gamma LUT transformation works correctly",
+		},
+		{ .name = "legacy-gamma-reset",
+		  .test_t = test_pipe_legacy_gamma_reset,
+		  .desc = "Verify that setting the legacy gamma LUT resets the gamma LUT set through GAMMA_LUT property",
+		},
 	};
 	struct {
 		const char *name;
@@ -943,71 +952,96 @@ run_tests_for_pipe(data_t *data)
 		double ctm[9];
 		const char *desc;
 	} ctm_tests[] = {
-		{ "ctm-red-to-blue", 0,
-			{{ 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"
+		{ .name = "ctm-red-to-blue",
+		  .colors = {
+			  { 0.0, 0.0, 1.0 },
+			  { 0.0, 1.0, 0.0 },
+			  { 0.0, 0.0, 1.0 },
+		  },
+		  .ctm = {
+			  0.0, 0.0, 0.0,
+			  0.0, 1.0, 0.0,
+			  1.0, 0.0, 1.0,
+		  },
+		  .desc = "Check the color transformation from red to blue",
 		},
-		{ "ctm-green-to-red", 0,
-			{{ 1.0, 0.0, 0.0 },
-			 { 1.0, 0.0, 0.0 },
-			 { 0.0, 0.0, 1.0 }},
-		  { 1.0, 1.0, 0.0,
-		    0.0, 0.0, 0.0,
-		    0.0, 0.0, 1.0 },
-		  "Check the color transformation from green to red"
+		{ .name = "ctm-green-to-red",
+		  .colors = {
+			  { 1.0, 0.0, 0.0 },
+			  { 1.0, 0.0, 0.0 },
+			  { 0.0, 0.0, 1.0 },
+		  },
+		  .ctm = {
+			  1.0, 1.0, 0.0,
+			  0.0, 0.0, 0.0,
+			  0.0, 0.0, 1.0,
+		  },
+		  .desc = "Check the color transformation from green to red",
 		},
-		{ "ctm-blue-to-red", 0,
-			{{ 1.0, 0.0, 0.0 },
-			 { 0.0, 1.0, 0.0 },
-			 { 1.0, 0.0, 0.0 }},
-		  { 1.0, 0.0, 1.0,
-		    0.0, 1.0, 0.0,
-		    0.0, 0.0, 0.0 },
-		  "Check the color transformation from blue to red"
+		{ .name = "ctm-blue-to-red",
+		  .colors = {
+			  { 1.0, 0.0, 0.0 },
+			  { 0.0, 1.0, 0.0 },
+			  { 1.0, 0.0, 0.0 },
+		  },
+		  .ctm = {
+			  1.0, 0.0, 1.0,
+			  0.0, 1.0, 0.0,
+			  0.0, 0.0, 0.0,
+		  },
+		  .desc = "Check the color transformation from blue to red",
 		},
-		{ "ctm-max", 0,
-			{{ 1.0, 0.0, 0.0 },
-			 { 0.0, 1.0, 0.0 },
-			 { 0.0, 0.0, 1.0 }},
-		  { 100.0, 0.0, 0.0,
-		    0.0, 100.0, 0.0,
-		    0.0, 0.0, 100.0 },
-		  "Check the color transformation for maximum transparency"
+		{ .name = "ctm-max",
+		  .colors = {
+			  { 1.0, 0.0, 0.0 },
+			  { 0.0, 1.0, 0.0 },
+			  { 0.0, 0.0, 1.0 },
+		  },
+		  .ctm = { 100.0, 0.0, 0.0,
+			  0.0, 100.0, 0.0,
+			  0.0, 0.0, 100.0,
+		  },
+		  .desc = "Check the color transformation for maximum transparency",
 		},
-		{ "ctm-negative", 0,
-			{{ 0.0, 0.0, 0.0 },
-			 { 0.0, 0.0, 0.0 },
-			 { 0.0, 0.0, 0.0 }},
-		  { -1.0, 0.0, 0.0,
-		    0.0, -1.0, 0.0,
-		    0.0, 0.0, -1.0 },
-		  "Check the color transformation for negative transparency"
+		{ .name = "ctm-negative",
+		  .colors = {
+			  { 0.0, 0.0, 0.0 },
+			  { 0.0, 0.0, 0.0 },
+			  { 0.0, 0.0, 0.0 },
+		  },
+		  .ctm = {
+			  -1.0,  0.0,  0.0,
+			   0.0, -1.0,  0.0,
+			   0.0,  0.0, -1.0,
+		  },
+		  .desc = "Check the color transformation for negative transparency",
 		},
-		{ "ctm-0-25", 5,
-			{{ 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"
+		{ .name = "ctm-0-25",
+		  .iter = 5,
+		  .ctm = {
+			  0.25, 0.0,  0.0,
+			  0.0,  0.25, 0.0,
+			  0.0,  0.0,  0.25,
+		  },
+		  .desc = "Check the color transformation for 0.25 transparency",
 		},
-		{ "ctm-0-50", 5,
-			{{ 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"
+		{ .name = "ctm-0-50",
+		  .iter = 5,
+		  .ctm = {
+			  0.5,  0.0,  0.0,
+			  0.0,  0.5,  0.0,
+			  0.0,  0.0,  0.5,
+		  },
+		  .desc = "Check the color transformation for 0.5 transparency",
 		},
-		{ "ctm-0-75", 7,
-			{{ 0.0, }, { 0.0, }, { 0.0, }},
-		  { 0.75, 0.0,  0.0,
-		    0.0,  0.75, 0.0,
-		    0.0,  0.0,  0.75 },
-		  "Check the color transformation for 0.75 transparency"
+		{ .name = "ctm-0-75",
+		  .iter = 7,
+		  .ctm = {
+			  0.75, 0.0,  0.0,
+			  0.0,  0.75, 0.0,
+			  0.0,  0.0,  0.75,
+		  },
+		  .desc = "Check the color transformation for 0.75 transparency",
 		},
 	};
 	int i;
-- 
2.39.2

  parent reply	other threads:[~2023-04-11 16:16 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-11 16:15 [igt-dev] [PATCH i-g-t v2 0/9] tests/kms_color: Improve CTM tests Ville Syrjala
2023-04-11 16:15 ` [igt-dev] [PATCH i-g-t v2 1/9] tests/kms_color: Use legacy LUT for chopping off the lsbs Ville Syrjala
2023-05-04 21:21   ` Shankar, Uma
2023-04-11 16:15 ` Ville Syrjala [this message]
2023-05-04 21:23   ` [igt-dev] [PATCH i-g-t v2 2/9] tests/kms_color: Use named initializers Shankar, Uma
2023-04-11 16:15 ` [igt-dev] [PATCH i-g-t v2 3/9] tests/kms_color: Make loads of stuff static const Ville Syrjala
2023-05-04 21:26   ` Shankar, Uma
2023-04-11 16:15 ` [igt-dev] [PATCH i-g-t v2 4/9] tests/kms_color: Pass down the colors used to paint the fb Ville Syrjala
2023-05-04 21:28   ` Shankar, Uma
2023-04-11 16:15 ` [igt-dev] [PATCH i-g-t v2 5/9] tests/kms_color: Get rid of hand coded "expected_colors" Ville Syrjala
2023-05-04 21:39   ` Shankar, Uma
2023-04-11 16:15 ` [igt-dev] [PATCH i-g-t v2 6/9] tests/kms_color: Add and additional "signed" subtest Ville Syrjala
2023-05-04 21:43   ` Shankar, Uma
2023-04-11 16:15 ` [igt-dev] [PATCH i-g-t v2 7/9] tests/kms_color: Dump the CTM before/after color values Ville Syrjala
2023-05-04 21:44   ` Shankar, Uma
2023-04-11 16:15 ` [igt-dev] [PATCH i-g-t v2 8/9] tests/kms_color: Move dynamic subtests up one level Ville Syrjala
2023-05-04 21:46   ` Shankar, Uma
2023-04-11 16:15 ` [igt-dev] [PATCH i-g-t v2 9/9] tests/intel-ci/fast-feedback: Run ctm tests Ville Syrjala
2023-04-11 17:51 ` [igt-dev] ✗ Fi.CI.BAT: failure for tests/kms_color: Improve CTM tests (rev2) Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230411161555.10001-3-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox