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 1/4] tests/kms_color: Refactor invalid LUT size tests
Date: Fri, 3 Sep 2021 05:04:30 +0000	[thread overview]
Message-ID: <DM8PR11MB5719FC27CFD8565570B9BD2D8DCF9@DM8PR11MB5719.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20210514132643.30709-2-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 1/4] tests/kms_color: Refactor invalid LUT
> size tests
> 
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Reuse the same code for all invalid LUT size tests.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  tests/kms_color_helper.c | 81 +++++++++++++---------------------------
>  1 file changed, 26 insertions(+), 55 deletions(-)
> 
> diff --git a/tests/kms_color_helper.c b/tests/kms_color_helper.c
> index 5f223a88129f..f9fde340f4b7 100644
> --- a/tests/kms_color_helper.c
> +++ b/tests/kms_color_helper.c
> @@ -277,77 +277,48 @@ pipe_set_property_blob(igt_pipe_t *pipe,
>  				       COMMIT_ATOMIC : COMMIT_LEGACY);
>  }
> 
> -void
> -invalid_gamma_lut_sizes(data_t *data)
> +static void
> +invalid_lut_sizes(data_t *data, enum igt_atomic_crtc_properties prop, int
> size)
>  {
>  	igt_display_t *display = &data->display;
>  	igt_pipe_t *pipe = &display->pipes[0];
> -	size_t gamma_lut_size = data->gamma_lut_size *
> -				sizeof(struct drm_color_lut);
> -	struct drm_color_lut *gamma_lut;
> +	struct drm_color_lut *lut;
> +	size_t lut_size = size * sizeof(lut[0]);
> 
> -	igt_require(igt_pipe_obj_has_prop(pipe, IGT_CRTC_GAMMA_LUT));
> +	igt_require(igt_pipe_obj_has_prop(pipe, prop));
> 
> -	gamma_lut = malloc(gamma_lut_size * 2);
> +	lut = malloc(lut_size * 2);
> 
>  	igt_display_commit2(display,
>  			    display->is_atomic ?
>  			    COMMIT_ATOMIC : COMMIT_LEGACY);
> 
> -	igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_GAMMA_LUT,
> -					     gamma_lut, 1), -EINVAL);
> -	igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_GAMMA_LUT,
> -					     gamma_lut, gamma_lut_size + 1),
> -					     -EINVAL);
> -	igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_GAMMA_LUT,
> -					     gamma_lut, gamma_lut_size - 1),
> -					     -EINVAL);
> -	igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_GAMMA_LUT,
> -					     gamma_lut, gamma_lut_size +
> -					     sizeof(struct drm_color_lut)),
> -					     -EINVAL);
> -	igt_assert_eq(pipe_set_property_blob_id(pipe, IGT_CRTC_GAMMA_LUT,
> -		      pipe->crtc_id), -EINVAL);
> -	igt_assert_eq(pipe_set_property_blob_id(pipe, IGT_CRTC_GAMMA_LUT,
> -		      4096 * 4096), -EINVAL);
> +	igt_assert_eq(pipe_set_property_blob(pipe, prop, lut,
> +					     1), -EINVAL);
> +	igt_assert_eq(pipe_set_property_blob(pipe, prop, lut,
> +					     lut_size + 1), -EINVAL);
> +	igt_assert_eq(pipe_set_property_blob(pipe, prop, lut,
> +					     lut_size - 1), -EINVAL);
> +	igt_assert_eq(pipe_set_property_blob(pipe, prop, lut,
> +					     lut_size + sizeof(struct drm_color_lut)), -
> EINVAL);
> +	igt_assert_eq(pipe_set_property_blob_id(pipe, prop,
> +						pipe->crtc_id), -EINVAL);
> +	igt_assert_eq(pipe_set_property_blob_id(pipe, prop,
> +						4096 * 4096), -EINVAL);
> 
> -	free(gamma_lut);
> +	free(lut);
> +}
> +
> +void
> +invalid_gamma_lut_sizes(data_t *data)
> +{
> +	return invalid_lut_sizes(data, IGT_CRTC_GAMMA_LUT, data-
> >gamma_lut_size);
 
data->gamma_lut_size can be NULL.

gamma_lut_size in struct data_t is not initialized before calling the
invalid_gamma_lut_sizes() 

igt_runner will run gamma test first which will cache gamma_lut_size &
then try to run the size tests, so we didn't see any issue.
If we try to run the size tests alone, we may get improper result.

Anyway it is not related this patch, but we must fix this at caller.

>  }
> 
>  void
>  invalid_degamma_lut_sizes(data_t *data)
>  {
> -	igt_display_t *display = &data->display;
> -	igt_pipe_t *pipe = &display->pipes[0];
> -	size_t degamma_lut_size = data->degamma_lut_size *
> -				  sizeof(struct drm_color_lut);
> -	struct drm_color_lut *degamma_lut;
> -
> -	igt_require(igt_pipe_obj_has_prop(pipe, IGT_CRTC_DEGAMMA_LUT));
> -
> -	degamma_lut = malloc(degamma_lut_size * 2);
> -
> -	igt_display_commit2(display, display->is_atomic ?
> -			    COMMIT_ATOMIC : COMMIT_LEGACY);
> -
> -	igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_DEGAMMA_LUT,
> -					     degamma_lut, 1), -EINVAL);
> -	igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_DEGAMMA_LUT,
> -					     degamma_lut, degamma_lut_size + 1),
> -					     -EINVAL);
> -	igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_DEGAMMA_LUT,
> -					     degamma_lut, degamma_lut_size - 1),
> -					     -EINVAL);
> -	igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_DEGAMMA_LUT,
> -					     degamma_lut, degamma_lut_size +
> -					     sizeof(struct drm_color_lut)),
> -					     -EINVAL);
> -	igt_assert_eq(pipe_set_property_blob_id(pipe, IGT_CRTC_DEGAMMA_LUT,
> -						pipe->crtc_id), -EINVAL);
> -	igt_assert_eq(pipe_set_property_blob_id(pipe, IGT_CRTC_DEGAMMA_LUT,
> -						4096 * 4096), -EINVAL);
> -
> -	free(degamma_lut);
> +	return invalid_lut_sizes(data, IGT_CRTC_DEGAMMA_LUT, data-
> >degamma_lut_size);
>  }
> 
>  void invalid_ctm_matrix_sizes(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 [this message]
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
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=DM8PR11MB5719FC27CFD8565570B9BD2D8DCF9@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.