Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Shankar, Uma" <uma.shankar@intel.com>
To: "Modem, Bhanuprakash" <bhanuprakash.modem@intel.com>,
	"igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>
Subject: Re: [igt-dev] [v4 i-g-t 2/3] tests/kms_color: Add support for Deep-Color
Date: Wed, 16 Mar 2022 05:59:15 +0000	[thread overview]
Message-ID: <754a12f5cd2a4d0ca7df8612a9668f2c@intel.com> (raw)
In-Reply-To: <20220217155457.2427855-2-bhanuprakash.modem@intel.com>



> -----Original Message-----
> From: Modem, Bhanuprakash <bhanuprakash.modem@intel.com>
> Sent: Thursday, February 17, 2022 9:25 PM
> To: igt-dev@lists.freedesktop.org; Shankar, Uma <uma.shankar@intel.com>
> Cc: Modem, Bhanuprakash <bhanuprakash.modem@intel.com>
> Subject: [v4 i-g-t 2/3] tests/kms_color: Add support for Deep-Color
> 
> Add new subtests to validate deep color.
> 
> V2:
> * i915 needs atleast gen 11 to support deep-color
> * Add connector name to dynamic subtest
> V3:
> * Fix the usage of "output"
> 
> Cc: Uma Shankar <uma.shankar@intel.com>
> Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
> ---
>  tests/kms_color.c        | 96 +++++++++++++++++++++++++++++-----------
>  tests/kms_color_helper.c |  2 +-
>  tests/kms_color_helper.h |  2 +
>  3 files changed, 72 insertions(+), 28 deletions(-)
> 
> diff --git a/tests/kms_color.c b/tests/kms_color.c index 854b8f3c31..6cc4456159
> 100644
> --- a/tests/kms_color.c
> +++ b/tests/kms_color.c
> @@ -29,7 +29,6 @@ IGT_TEST_DESCRIPTION("Test Color Features at Pipe level");
> static void test_pipe_degamma(data_t *data,
>  			      igt_plane_t *primary)
>  {
> -	igt_output_t *output;
>  	igt_display_t *display = &data->display;
>  	gamma_lut_t *degamma_linear, *degamma_full;
>  	color_t red_green_blue[] = {
> @@ -48,17 +47,14 @@ static void test_pipe_degamma(data_t *data,
>  	degamma_linear = generate_table(data->degamma_lut_size, 1.0);
>  	degamma_full = generate_table_max(data->degamma_lut_size);
> 
> -	output = igt_get_single_output_for_pipe(&data->display, primary->pipe-
> >pipe);
> -	igt_require(output);
> -
> -	igt_output_set_pipe(output, primary->pipe->pipe);
> -	mode = igt_output_get_mode(output);
> +	igt_output_set_pipe(data->output, primary->pipe->pipe);
> +	mode = igt_output_get_mode(data->output);
> 
>  	/* Create a framebuffer at the size of the output. */
>  	fb_id = igt_create_fb(data->drm_fd,
>  			      mode->hdisplay,
>  			      mode->vdisplay,
> -			      DRM_FORMAT_XRGB8888,
> +			      data->drm_format,
>  			      DRM_FORMAT_MOD_LINEAR,
>  			      &fb);
>  	igt_assert(fb_id);
> @@ -66,7 +62,7 @@ static void test_pipe_degamma(data_t *data,
>  	fb_modeset_id = igt_create_fb(data->drm_fd,
>  				      mode->hdisplay,
>  				      mode->vdisplay,
> -				      DRM_FORMAT_XRGB8888,
> +				      data->drm_format,
>  				      DRM_FORMAT_MOD_LINEAR,
>  				      &fb_modeset);
>  	igt_assert(fb_modeset_id);
> @@ -103,7 +99,7 @@ static void test_pipe_degamma(data_t *data,
> 
>  	disable_degamma(primary->pipe);
>  	igt_plane_set_fb(primary, NULL);
> -	igt_output_set_pipe(output, PIPE_NONE);
> +	igt_output_set_pipe(data->output, PIPE_NONE);
>  	igt_display_commit(&data->display);
>  	igt_remove_fb(data->drm_fd, &fb);
>  	igt_remove_fb(data->drm_fd, &fb_modeset); @@ -119,7 +115,6 @@ static
> void test_pipe_degamma(data_t *data,  static void test_pipe_gamma(data_t *data,
>  			    igt_plane_t *primary)
>  {
> -	igt_output_t *output;
>  	igt_display_t *display = &data->display;
>  	gamma_lut_t *gamma_full;
>  	color_t red_green_blue[] = {
> @@ -136,17 +131,14 @@ static void test_pipe_gamma(data_t *data,
> 
>  	gamma_full = generate_table_max(data->gamma_lut_size);
> 
> -	output = igt_get_single_output_for_pipe(&data->display, primary->pipe-
> >pipe);
> -	igt_require(output);
> -
> -	igt_output_set_pipe(output, primary->pipe->pipe);
> -	mode = igt_output_get_mode(output);
> +	igt_output_set_pipe(data->output, primary->pipe->pipe);
> +	mode = igt_output_get_mode(data->output);
> 
>  	/* Create a framebuffer at the size of the output. */
>  	fb_id = igt_create_fb(data->drm_fd,
>  			      mode->hdisplay,
>  			      mode->vdisplay,
> -			      DRM_FORMAT_XRGB8888,
> +			      data->drm_format,
>  			      DRM_FORMAT_MOD_LINEAR,
>  			      &fb);
>  	igt_assert(fb_id);
> @@ -154,7 +146,7 @@ static void test_pipe_gamma(data_t *data,
>  	fb_modeset_id = igt_create_fb(data->drm_fd,
>  				      mode->hdisplay,
>  				      mode->vdisplay,
> -				      DRM_FORMAT_XRGB8888,
> +				      data->drm_format,
>  				      DRM_FORMAT_MOD_LINEAR,
>  				      &fb_modeset);
>  	igt_assert(fb_modeset_id);
> @@ -190,7 +182,7 @@ static void test_pipe_gamma(data_t *data,
> 
>  	disable_gamma(primary->pipe);
>  	igt_plane_set_fb(primary, NULL);
> -	igt_output_set_pipe(output, PIPE_NONE);
> +	igt_output_set_pipe(data->output, PIPE_NONE);
>  	igt_display_commit(&data->display);
>  	igt_remove_fb(data->drm_fd, &fb);
>  	igt_remove_fb(data->drm_fd, &fb_modeset); @@ -439,7 +431,6 @@ static
> bool test_pipe_ctm(data_t *data,
>  		0.0, 0.0, 1.0
>  	};
>  	gamma_lut_t *degamma_linear, *gamma_linear;
> -	igt_output_t *output;
>  	bool ret = true;
>  	igt_display_t *display = &data->display;
>  	drmModeModeInfo *mode;
> @@ -452,17 +443,14 @@ static bool test_pipe_ctm(data_t *data,
>  	degamma_linear = generate_table(data->degamma_lut_size, 1.0);
>  	gamma_linear = generate_table(data->gamma_lut_size, 1.0);
> 
> -	output = igt_get_single_output_for_pipe(&data->display, primary->pipe-
> >pipe);
> -	igt_require(output);
> -
> -	igt_output_set_pipe(output, primary->pipe->pipe);
> -	mode = igt_output_get_mode(output);
> +	igt_output_set_pipe(data->output, primary->pipe->pipe);
> +	mode = igt_output_get_mode(data->output);
> 
>  	/* Create a framebuffer at the size of the output. */
>  	fb_id = igt_create_fb(data->drm_fd,
>  			      mode->hdisplay,
>  			      mode->vdisplay,
> -			      DRM_FORMAT_XRGB8888,
> +			      data->drm_format,
>  			      DRM_FORMAT_MOD_LINEAR,
>  			      &fb);
>  	igt_assert(fb_id);
> @@ -470,7 +458,7 @@ static bool test_pipe_ctm(data_t *data,
>  	fb_modeset_id = igt_create_fb(data->drm_fd,
>  				      mode->hdisplay,
>  				      mode->vdisplay,
> -				      DRM_FORMAT_XRGB8888,
> +				      data->drm_format,
>  				      DRM_FORMAT_MOD_LINEAR,
>  				      &fb_modeset);
>  	igt_assert(fb_modeset_id);
> @@ -516,7 +504,7 @@ static bool test_pipe_ctm(data_t *data,
>  	ret &= !igt_skip_crc_compare || igt_check_crc_equal(&crc_software,
> &crc_hardware);
> 
>  	igt_plane_set_fb(primary, NULL);
> -	igt_output_set_pipe(output, PIPE_NONE);
> +	igt_output_set_pipe(data->output, PIPE_NONE);
>  	igt_remove_fb(data->drm_fd, &fb);
>  	igt_remove_fb(data->drm_fd, &fb_modeset);
> 
> @@ -686,12 +674,14 @@ run_tests_for_pipe(data_t *data, enum pipe p)
> 
> INTEL_PIPE_CRC_SOURCE_AUTO);
> 
>  		igt_display_require_output_on_pipe(&data->display, p);
> +		data->output = igt_get_single_output_for_pipe(&data->display, p);
>  	}
> 
>  	/* We assume an 8bits depth per color for degamma/gamma LUTs
>  	 * for CRC checks with framebuffer references. */
>  	data->color_depth = 8;
>  	delta = 1.0 / (1 << data->color_depth);
> +	data->drm_format = DRM_FORMAT_XRGB8888;
> 
>  	igt_describe("Check the color transformation from red to blue");
>  	igt_subtest_f("pipe-%s-ctm-red-to-blue", kmstest_pipe_name(p)) { @@ -
> 866,6 +856,58 @@ run_tests_for_pipe(data_t *data, enum pipe p)
>  	igt_subtest_f("pipe-%s-legacy-gamma-reset", kmstest_pipe_name(p))
>  		test_pipe_legacy_gamma_reset(data, primary);
> 
> +	igt_describe("Verify that deep color works correctly");
> +	igt_subtest_with_dynamic_f("pipe-%s-deep-color", kmstest_pipe_name(p)) {
> +		igt_output_t *output;
> +		color_t blue_green_blue[] = {
> +			{ 0.0, 0.0, 1.0 },
> +			{ 0.0, 1.0, 0.0 },
> +			{ 0.0, 0.0, 1.0 }
> +		};
> +		double ctm[] = { 0.0, 0.0, 0.0,
> +				0.0, 1.0, 0.0,
> +				1.0, 0.0, 1.0 };
> +
> +		if (is_i915_device(data->drm_fd))
> +			igt_require_f((intel_display_ver(data->devid) >= 11),
> +					"At least GEN 11 is required to validate
> Deep-color.\n");
> +
> +		for_each_valid_output_on_pipe(&data->display, p, output) {
> +			drmModeConnector *connector = output-
> >config.connector;
> +
> +			if (!is_max_bpc_supported(output))
> +				continue;
> +
> +			if (!is_panel_supports_deep_color(data->drm_fd,
> connector))
> +				continue;
> +
> +			data->color_depth = 10;
> +			data->drm_format = DRM_FORMAT_XRGB2101010;
> +			data->output = output;
> +			igt_output_set_prop_value(output,
> IGT_CONNECTOR_MAX_BPC, 10);
> +
> +			igt_dynamic_f("gamma-%s", output->name) {
> +				igt_output_set_pipe(data->output, PIPE_NONE);
> +				test_pipe_gamma(data, primary);
> +			}
> +
> +			igt_dynamic_f("degamma-%s", output->name) {
> +				igt_output_set_pipe(data->output, PIPE_NONE);
> +				test_pipe_degamma(data, primary);
> +			}
> +
> +			igt_dynamic_f("ctm-%s", output->name) {
> +				igt_output_set_pipe(data->output, PIPE_NONE);
> +				igt_assert(test_pipe_ctm(data, primary,
> +							 red_green_blue,
> +							 blue_green_blue, ctm));
> +			}
> +
> +			igt_output_set_prop_value(output,
> IGT_CONNECTOR_MAX_BPC, 12);

Should we not get the max bpc supported and set to default what was set earlier. It may not be set to 12
earlier so would be good to restore the value set earlier.

> +			break;
> +		}
> +	}
> +
>  	igt_fixture {
>  		disable_degamma(primary->pipe);
>  		disable_gamma(primary->pipe);
> diff --git a/tests/kms_color_helper.c b/tests/kms_color_helper.c index
> 6b3af02b00..b0abe5507e 100644
> --- a/tests/kms_color_helper.c
> +++ b/tests/kms_color_helper.c
> @@ -206,7 +206,7 @@ struct drm_color_lut *coeffs_to_lut(data_t *data,
>  	uint32_t mask;
> 
>  	if (is_i915_device(data->drm_fd))
> -		mask = ((1 << color_depth) - 1) << 8;
> +		mask = ((1 << color_depth) - 1) << (16 - color_depth);
>  	else
>  		mask = max_value;
> 
> diff --git a/tests/kms_color_helper.h b/tests/kms_color_helper.h index
> 992087ac9c..4e381a1c28 100644
> --- a/tests/kms_color_helper.h
> +++ b/tests/kms_color_helper.h
> @@ -49,7 +49,9 @@ typedef struct {
>  	uint32_t devid;
>  	igt_display_t display;
>  	igt_pipe_crc_t *pipe_crc;
> +	igt_output_t *output;
> 
> +	uint32_t drm_format;
>  	uint32_t color_depth;
>  	uint64_t degamma_lut_size;
>  	uint64_t gamma_lut_size;
> --
> 2.35.0

  reply	other threads:[~2022-03-16  5:59 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-24 11:23 [igt-dev] [PATCH i-g-t 0/3] New subtests for deep color Bhanuprakash Modem
2022-01-24 11:23 ` [igt-dev] [PATCH i-g-t 1/3] tests/kms_color_helper: Read deep-color capability from EDID Bhanuprakash Modem
2022-01-26 13:15   ` [igt-dev] [v2 " Bhanuprakash Modem
2022-01-27  6:44     ` [igt-dev] [v3 " Bhanuprakash Modem
2022-02-01  9:05       ` [igt-dev] [v4 " Bhanuprakash Modem
2022-02-08  4:11         ` [igt-dev] [v5 " Bhanuprakash Modem
2022-02-17 15:54           ` [igt-dev] [v6 " Bhanuprakash Modem
2022-02-18  9:49             ` Petri Latvala
2022-03-16  5:53             ` Shankar, Uma
2022-01-24 11:23 ` [igt-dev] [PATCH i-g-t 2/3] tests/kms_color: Add support for Deep-Color Bhanuprakash Modem
2022-01-26 13:15   ` [igt-dev] [v2 " Bhanuprakash Modem
2022-02-08  4:12     ` [igt-dev] [v3 " Bhanuprakash Modem
2022-02-17 15:54       ` [igt-dev] [v4 " Bhanuprakash Modem
2022-03-16  5:59         ` Shankar, Uma [this message]
2022-01-24 11:23 ` [igt-dev] [PATCH i-g-t 3/3] HAX: Add deep-color tests to BAT Bhanuprakash Modem
2022-01-26 13:15   ` [igt-dev] [v2 " Bhanuprakash Modem
2022-01-24 14:35 ` [igt-dev] ✓ Fi.CI.BAT: success for New subtests for deep color Patchwork
2022-01-24 17:36 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2022-01-26 13:15 ` [igt-dev] [v2 i-g-t 0/3] " Bhanuprakash Modem
2022-01-26 17:40 ` [igt-dev] ✗ Fi.CI.BAT: failure for New subtests for deep color (rev4) Patchwork
2022-01-27  4:54   ` Modem, Bhanuprakash
2022-01-27  4:58     ` Modem, Bhanuprakash
2022-01-27  7:32 ` [igt-dev] ✓ Fi.CI.BAT: success for New subtests for deep color (rev5) Patchwork
2022-01-27 10:37 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2022-01-30 20:47 ` [igt-dev] ✓ Fi.CI.IGT: success " Patchwork
2022-02-01 12:41 ` [igt-dev] ✓ Fi.CI.BAT: success for New subtests for deep color (rev6) Patchwork
2022-02-01 16:55 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2022-02-08  4:42 ` [igt-dev] ✓ Fi.CI.BAT: success for New subtests for deep color (rev8) Patchwork
2022-02-08  6:27 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2022-02-17 17:04 ` [igt-dev] ✓ Fi.CI.BAT: success for New subtests for deep color (rev10) Patchwork
2022-02-18  3:04 ` [igt-dev] ✗ Fi.CI.IGT: failure " 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=754a12f5cd2a4d0ca7df8612a9668f2c@intel.com \
    --to=uma.shankar@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox