From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t v2 5/9] tests/kms_color: Get rid of hand coded "expected_colors"
Date: Tue, 11 Apr 2023 19:15:50 +0300 [thread overview]
Message-ID: <20230411161555.10001-6-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>
Instead of specifying the expected colors by hand just apply
the ctm to the fb colors and let the computer do the work for
us.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
tests/kms_color.c | 59 +++++++++++++++++------------------------------
1 file changed, 21 insertions(+), 38 deletions(-)
diff --git a/tests/kms_color.c b/tests/kms_color.c
index e3fe2aea4695..d430ee12aaa3 100644
--- a/tests/kms_color.c
+++ b/tests/kms_color.c
@@ -735,10 +735,18 @@ out:
test_cleanup(data);
}
+static void transform_color(color_t *color, const double *ctm, double offset)
+{
+ color_t tmp = *color;
+
+ color->r = ctm[0] * tmp.r + ctm[1] * tmp.g + ctm[2] * tmp.b + offset;
+ color->g = ctm[3] * tmp.r + ctm[4] * tmp.g + ctm[5] * tmp.b + offset;
+ color->b = ctm[6] * tmp.r + ctm[7] * tmp.g + ctm[8] * tmp.b + offset;
+}
+
static void
run_ctm_tests_for_pipe(data_t *data, enum pipe p,
const color_t *fb_colors,
- const color_t *expected_colors,
const double *ctm,
int iter)
{
@@ -758,14 +766,13 @@ run_ctm_tests_for_pipe(data_t *data, enum pipe p,
if (!pipe_output_combo_valid(data, p))
goto out;
+ if (!iter)
+ iter = 1;
+
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, fb_colors,
- expected_colors, ctm);
-
/*
* We tests a few values around the expected result because
* it depends on the hardware we're dealing with, we can either
@@ -773,15 +780,18 @@ run_ctm_tests_for_pipe(data_t *data, enum pipe p,
* for odd number of items in the LUTs.
*/
for (i = 0; i < iter; i++) {
- float c = ctm[0] + delta * (i - (iter / 2));
- color_t expected_colors_local[] = {
- { .r = c, },
- { .g = c, },
- { .b = c, },
+ color_t expected_colors[3] = {
+ fb_colors[0],
+ fb_colors[1],
+ fb_colors[2],
};
+ transform_color(&expected_colors[0], ctm, delta * (i - (iter / 2)));
+ transform_color(&expected_colors[1], ctm, delta * (i - (iter / 2)));
+ transform_color(&expected_colors[2], ctm, delta * (i - (iter / 2)));
+
if (test_pipe_ctm(data, data->primary, fb_colors,
- expected_colors_local, ctm)) {
+ expected_colors, ctm)) {
success = true;
break;
}
@@ -953,17 +963,11 @@ run_tests_for_pipe(data_t *data)
const char *name;
int iter;
const color_t *fb_colors;
- color_t colors[3];
double ctm[9];
const char *desc;
} ctm_tests[] = {
{ .name = "ctm-red-to-blue",
.fb_colors = colors_rgb,
- .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,
@@ -973,11 +977,6 @@ run_tests_for_pipe(data_t *data)
},
{ .name = "ctm-green-to-red",
.fb_colors = colors_rgb,
- .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,
@@ -987,11 +986,6 @@ run_tests_for_pipe(data_t *data)
},
{ .name = "ctm-blue-to-red",
.fb_colors = colors_rgb,
- .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,
@@ -1001,11 +995,6 @@ run_tests_for_pipe(data_t *data)
},
{ .name = "ctm-max",
.fb_colors = colors_rgb,
- .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,
@@ -1014,11 +1003,6 @@ run_tests_for_pipe(data_t *data)
},
{ .name = "ctm-negative",
.fb_colors = colors_rgb,
- .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,
@@ -1075,7 +1059,6 @@ run_tests_for_pipe(data_t *data)
for_each_pipe(&data->display, pipe) {
run_ctm_tests_for_pipe(data, pipe,
ctm_tests[i].fb_colors,
- ctm_tests[i].colors,
ctm_tests[i].ctm,
ctm_tests[i].iter);
}
--
2.39.2
next prev 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 ` [igt-dev] [PATCH i-g-t v2 2/9] tests/kms_color: Use named initializers Ville Syrjala
2023-05-04 21:23 ` 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 ` Ville Syrjala [this message]
2023-05-04 21:39 ` [igt-dev] [PATCH i-g-t v2 5/9] tests/kms_color: Get rid of hand coded "expected_colors" 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-6-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