All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Modem, Bhanuprakash" <bhanuprakash.modem@intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
	"igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>
Subject: Re: [igt-dev] [PATCH i-g-t 2/4] tests/kms_color: Store r/g/b separately for LUT color tests
Date: Fri, 3 Sep 2021 05:04:46 +0000	[thread overview]
Message-ID: <DM8PR11MB571998976BCFC3C91B8D0DA38DCF9@DM8PR11MB5719.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20210514132643.30709-3-ville.syrjala@linux.intel.com>

> From: igt-dev <igt-dev-bounces@lists.freedesktop.org> On Behalf Of Ville
> Syrjala
> Sent: Friday, May 14, 2021 6:57 PM
> To: igt-dev@lists.freedesktop.org
> Subject: [igt-dev] [PATCH i-g-t 2/4] tests/kms_color: Store r/g/b separately
> for LUT color tests
> 
> 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).
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

LGTM
Reviewed-by: Bhanuprakash Modem <Bhanuprakash.modem@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 f9fde340f4b7..7f9a30e625b6 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.26.3
> 
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2021-09-03  5:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-14 13:26 [igt-dev] [PATCH i-g-t 0/4] tests/kms_color: 3D LUT tests Ville Syrjala
2021-05-14 13:26 ` [igt-dev] [PATCH i-g-t 1/4] tests/kms_color: Refactor invalid LUT size tests Ville Syrjala
2021-09-03  5:04   ` Modem, Bhanuprakash
2021-09-03 15:14     ` Ville Syrjälä
2021-05-14 13:26 ` [igt-dev] [PATCH i-g-t 2/4] tests/kms_color: Store r/g/b separately for LUT color tests Ville Syrjala
2021-09-03  5:04   ` Modem, Bhanuprakash [this message]
2021-05-14 13:26 ` [igt-dev] [PATCH i-g-t 3/4] lib/kms: Add GAMMA_LUT_3D support Ville Syrjala
2021-09-03  5:05   ` Modem, Bhanuprakash
2021-05-14 13:26 ` [igt-dev] [PATCH i-g-t 4/4] tests/kms_color: Add GAMMA_LUT_3D tests Ville Syrjala
2021-09-03  5:05   ` Modem, Bhanuprakash
2021-09-03 15:18     ` Ville Syrjälä
2021-05-14 14:26 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_color: 3D LUT tests Patchwork
2021-05-14 18:25 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2021-06-01 16:31 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_color: 3D LUT tests (rev2) Patchwork
2021-06-01 21:23 ` [igt-dev] ✓ Fi.CI.IGT: " 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=DM8PR11MB571998976BCFC3C91B8D0DA38DCF9@DM8PR11MB5719.namprd11.prod.outlook.com \
    --to=bhanuprakash.modem@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=ville.syrjala@linux.intel.com \
    /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.