From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Bhanuprakash Modem <Bhanuprakash.modem@intel.com>
Subject: [igt-dev] [PATCH i-g-t v3 3/7] tests/kms_color: Store r/g/b separately for LUT color tests
Date: Fri, 3 Sep 2021 19:27:39 +0300 [thread overview]
Message-ID: <20210903162743.29851-4-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20210903162743.29851-1-ville.syrjala@linux.intel.com>
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
Store the r/g/b values separately for each LUT. A lot of hw
has a separate 1D LUT for each channel, so with this we can
potentially do more interesting tests. Also needed for 3D LUTs
(if we should ever support them).
Reviewed-by: Bhanuprakash Modem <Bhanuprakash.modem@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
tests/kms_color_helper.c | 29 +++++++++++++++++++----------
tests/kms_color_helper.h | 2 +-
2 files changed, 20 insertions(+), 11 deletions(-)
diff --git a/tests/kms_color_helper.c b/tests/kms_color_helper.c
index 68fa5f0e42ea..8b08cdaeea5f 100644
--- a/tests/kms_color_helper.c
+++ b/tests/kms_color_helper.c
@@ -103,14 +103,19 @@ void free_lut(gamma_lut_t *gamma)
free(gamma);
}
+static void set_rgb(color_t *coeff, double value)
+{
+ coeff->r = coeff->g = coeff->b = value;
+}
+
gamma_lut_t *generate_table(int lut_size, double exp)
{
gamma_lut_t *gamma = alloc_lut(lut_size);
int i;
- gamma->coeffs[0] = 0.0;
+ set_rgb(&gamma->coeffs[0], 0.0);
for (i = 1; i < lut_size; i++)
- gamma->coeffs[i] = pow(i * 1.0 / (lut_size - 1), exp);
+ set_rgb(&gamma->coeffs[i], pow(i * 1.0 / (lut_size - 1), exp));
return gamma;
}
@@ -120,9 +125,9 @@ gamma_lut_t *generate_table_max(int lut_size)
gamma_lut_t *gamma = alloc_lut(lut_size);
int i;
- gamma->coeffs[0] = 0.0;
+ set_rgb(&gamma->coeffs[0], 0.0);
for (i = 1; i < lut_size; i++)
- gamma->coeffs[i] = 1.0;
+ set_rgb(&gamma->coeffs[i], 1.0);
return gamma;
}
@@ -133,7 +138,7 @@ gamma_lut_t *generate_table_zero(int lut_size)
int i;
for (i = 0; i < lut_size; i++)
- gamma->coeffs[i] = 0.0;
+ set_rgb(&gamma->coeffs[i], 0.0);
return gamma;
}
@@ -158,7 +163,9 @@ struct drm_color_lut *coeffs_to_lut(data_t *data,
if (IS_CHERRYVIEW(data->devid))
lut_size -= 1;
for (i = 0; i < lut_size; i++) {
- uint32_t v = (gamma->coeffs[i] * max_value);
+ uint32_t r = gamma->coeffs[i].r * max_value;
+ uint32_t g = gamma->coeffs[i].g * max_value;
+ uint32_t b = gamma->coeffs[i].b * max_value;
/*
* Hardware might encode colors on a different number of bits
@@ -166,11 +173,13 @@ struct drm_color_lut *coeffs_to_lut(data_t *data,
* Mask the lower bits not provided by the framebuffer so we
* can do CRC comparisons.
*/
- v &= mask;
+ r &= mask;
+ g &= mask;
+ b &= mask;
- lut[i].red = v;
- lut[i].green = v;
- lut[i].blue = v;
+ lut[i].red = r;
+ lut[i].green = g;
+ lut[i].blue = b;
}
if (IS_CHERRYVIEW(data->devid))
diff --git a/tests/kms_color_helper.h b/tests/kms_color_helper.h
index 88890724c2e4..3f49e7cae4c0 100644
--- a/tests/kms_color_helper.h
+++ b/tests/kms_color_helper.h
@@ -61,7 +61,7 @@ typedef struct {
typedef struct {
int size;
- double coeffs[];
+ color_t coeffs[];
} gamma_lut_t;
void paint_gradient_rectangles(data_t *data,
--
2.31.1
next prev parent reply other threads:[~2021-09-03 16:27 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-03 16:27 [igt-dev] [PATCH i-g-t v3 0/7] tests/kms_color: 3D LUT tests Ville Syrjala
2021-09-03 16:27 ` [igt-dev] [PATCH i-g-t v3 1/7] tests/kms_color_chamelium: Remove invalid LUT size tests Ville Syrjala
2021-09-12 15:30 ` Modem, Bhanuprakash
2021-09-03 16:27 ` [igt-dev] [PATCH i-g-t v3 2/7] tests/kms_color: Refactor " Ville Syrjala
2021-09-06 6:37 ` Modem, Bhanuprakash
2021-09-03 16:27 ` Ville Syrjala [this message]
2021-09-03 16:27 ` [igt-dev] [PATCH i-g-t v3 4/7] tests/kms_color: Pass pipe to " Ville Syrjala
2021-09-06 6:37 ` Modem, Bhanuprakash
2021-09-07 17:26 ` Ville Syrjälä
2021-09-03 16:27 ` [igt-dev] [PATCH i-g-t v3 5/7] tests/kms_color: Run each subtest only for a single connector Ville Syrjala
2021-09-06 6:38 ` Modem, Bhanuprakash
2021-09-07 17:34 ` Ville Syrjälä
2021-09-12 15:36 ` Modem, Bhanuprakash
2021-09-03 16:27 ` [igt-dev] [PATCH i-g-t v3 6/7] lib/kms: Add GAMMA_LUT_3D support Ville Syrjala
2021-09-03 16:27 ` [igt-dev] [PATCH i-g-t v3 7/7] tests/kms_color: Add GAMMA_LUT_3D tests Ville Syrjala
2021-09-06 6:38 ` Modem, Bhanuprakash
2021-09-03 17:25 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_color: 3D LUT tests (rev5) Patchwork
2021-09-03 19:46 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2021-09-06 6:37 ` [igt-dev] [PATCH i-g-t v3 0/7] tests/kms_color: 3D LUT tests Modem, Bhanuprakash
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=20210903162743.29851-4-ville.syrjala@linux.intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=Bhanuprakash.modem@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 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.