public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Alex Hung <alex.hung@amd.com>
To: igt-dev@lists.freedesktop.org, mwen@igalia.com
Subject: Re: [igt-dev] [PATCH i-g-t] tests/kms_color: check degamma and gamma props in CTM subtests
Date: Fri, 4 Nov 2022 15:01:07 -0600	[thread overview]
Message-ID: <78bd66c0-45d3-6d55-ee1e-e23c371cdbdb@amd.com> (raw)
In-Reply-To: <20221103184021.13961-1-mwen@igalia.com>

Hi Melissa,

Thanks for helping out.

The "set_luts" is not necessary because free_lut() already checks NULL 
pointers. See inline comments.

On 2022-11-03 12:40, Melissa Wen wrote:
> Some CTM subtests generate and set degamma/gamma LUTs without checking
> if these properties are supported by the driver. Therefore, if degamma
> and gamma are used in the subtest, check the color properties before
> generate and set LUTs. If these properties are not supported, these
> subtests will skip instead of failing.
> 
> Signed-off-by: Melissa Wen <mwen@igalia.com>
> ---
>   tests/kms_color.c | 20 +++++++++++++-------
>   1 file changed, 13 insertions(+), 7 deletions(-)
> 
> diff --git a/tests/kms_color.c b/tests/kms_color.c
> index e4dc2465..e0222c42 100644
> --- a/tests/kms_color.c
> +++ b/tests/kms_color.c
> @@ -463,7 +463,7 @@ static bool test_pipe_ctm(data_t *data,
>   	};
>   	gamma_lut_t *degamma_linear, *gamma_linear;
>   	igt_output_t *output = data->output;
> -	bool ret = true;
> +	bool set_luts, ret = true;

set_luts is not needed.

>   	igt_display_t *display = &data->display;
>   	drmModeModeInfo *mode = data->mode;
>   	struct igt_fb fb_modeset, fb;
> @@ -472,9 +472,6 @@ static bool test_pipe_ctm(data_t *data,
>   
>   	igt_require(igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_CTM));
>   
> -	degamma_linear = generate_table(data->degamma_lut_size, 1.0);
> -	gamma_linear = generate_table(data->gamma_lut_size, 1.0);
> -
>   	igt_output_set_pipe(output, primary->pipe->pipe);
>   	igt_output_override_mode(output, mode);
>   
> @@ -501,7 +498,14 @@ static bool test_pipe_ctm(data_t *data,
>   	 * representing intermediate values between 0 and 1.0 causes
>   	 * rounding issues and inaccuracies leading to crc mismatch.
>   	 */
> -	if (memcmp(before, after, sizeof(color_t))) {
> +	set_luts = memcmp(before, after, sizeof(color_t));
> +	if (set_luts) {

The above if condition can just stay the same since set_luts is not 
needed afterwards.

> +		igt_require(igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_DEGAMMA_LUT));
> +		igt_require(igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_GAMMA_LUT));
> +
> +		degamma_linear = generate_table(data->degamma_lut_size, 1.0);
> +		gamma_linear = generate_table(data->gamma_lut_size, 1.0);
> +
>   		set_degamma(data, primary->pipe, degamma_linear);
>   		set_gamma(data, primary->pipe, gamma_linear);
>   	} else {
> @@ -542,8 +546,10 @@ static bool test_pipe_ctm(data_t *data,
>   	igt_remove_fb(data->drm_fd, &fb);
>   	igt_remove_fb(data->drm_fd, &fb_modeset);
>   
> -	free_lut(degamma_linear);
> -	free_lut(gamma_linear);
> +	if (set_luts) {
> +		free_lut(degamma_linear);
> +		free_lut(gamma_linear);
> +	}

set_luts is not needed, so no changes here because free_lut() checks 
NULL pointers, like in the function "test_pipe_legacy_gamma_reset".

>   
>   	return ret;
>   }



      parent reply	other threads:[~2022-11-04 21:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-03 18:40 [igt-dev] [PATCH i-g-t] tests/kms_color: check degamma and gamma props in CTM subtests Melissa Wen
2022-11-03 19:21 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2022-11-04 15:44 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2022-11-04 21:01 ` Alex Hung [this message]

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=78bd66c0-45d3-6d55-ee1e-e23c371cdbdb@amd.com \
    --to=alex.hung@amd.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=mwen@igalia.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox