Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Harry Wentland <harry.wentland@amd.com>
To: Alex Hung <alex.hung@amd.com>, igt-dev@lists.freedesktop.org
Cc: brian.starkey@arm.com, maxime@cerno.tech
Subject: Re: [igt-dev] [PATCH 3/3][i-g-t][V2] tests/kms_writeback: support DRM_FORMAT_XRGB2101010 for writeback
Date: Fri, 15 Sep 2023 11:10:13 -0400	[thread overview]
Message-ID: <56f6859d-6a77-419f-aa42-38061adbd203@amd.com> (raw)
In-Reply-To: <20230906223730.3979103-4-alex.hung@amd.com>

On 2023-09-06 18:37, Alex Hung wrote:
> Add new subtests for DRM_FORMAT_XRGB2101010 when it is supported.
> The change also checks supported color formats and runs or skips
> accordingly.
> 
> Signed-off-by: Alex Hung <alex.hung@amd.com>
> ---
>  tests/kms_writeback.c | 140 ++++++++++++++++++++++++++++++++++--------
>  1 file changed, 113 insertions(+), 27 deletions(-)
> 
> diff --git a/tests/kms_writeback.c b/tests/kms_writeback.c
> index fce6554ce..110139547 100644
> --- a/tests/kms_writeback.c
> +++ b/tests/kms_writeback.c
> @@ -40,6 +40,14 @@
>   *              writeback; it validates bad and good combination, check color
>   *              format, and check the output result by using CRC.
>   *
> + * SUBTEST: writeback-check-output-XRGB2101010
> + * Description: Check XRGB2101010 writeback output with CRC validation
> + * Driver requirement: i915, xe

That's BS. This whole suite was written initially for one of the ARM
SoCs, so that should be supported at least. VKMS as well, and now amdgpu.

I know this is a copy-paste by you but this kind of stuff (originally put
here by Bhanuprakash) does nothing to dispel the notion that a good chunk
of this test suite is still treated as Intel GPU Tools. Let's not
perpetuate that thinking.

> + * Functionality: kms_core
> + * Mega feature: General Display Features
> + * Run type: FULL
> + * Test category: functionality test
> + *
>   * SUBTEST: writeback-check-output
>   * Description: Check writeback output with CRC validation
>   * Driver requirement: i915, xe
> @@ -48,6 +56,14 @@
>   * Run type: FULL
>   * Test category: functionality test
>   *
> + * SUBTEST: writeback-fb-id-XRGB2101010
> + * Description: Validate WRITEBACK_FB_ID with valid and invalid options
> + * Driver requirement: i915, xe

Same here. Let's drop this line or fix it.

> + * Functionality: kms_core
> + * Mega feature: General Display Features
> + * Run type: FULL
> + * Test category: functionality test
> + *
>   * SUBTEST: writeback-fb-id
>   * Description: Validate WRITEBACK_FB_ID with valid and invalid options
>   * Driver requirement: i915, xe
> @@ -89,12 +105,23 @@ typedef struct {
>  	bool dump_check;
>  	bool wb_fmt;
>  	uint32_t format;
> +	uint64_t supported_colors;
>  	int mode_index;
>  	drmModeModeInfo user_mode;
>  } data_t;
>  
>  static data_t data;
>  
> +static const uint32_t fourcc[] = {
> +	DRM_FORMAT_XRGB8888,
> +	DRM_FORMAT_XRGB2101010,
> +};
> +
> +enum {
> +	XRGB8888 = 1 << 0,
> +	XRGB2101010 = 1 << 1,
> +};
> +
>  static drmModePropertyBlobRes *get_writeback_formats_blob(igt_output_t *output)
>  {
>  	drmModePropertyBlobRes *blob = NULL;
> @@ -119,32 +146,38 @@ static bool check_writeback_config(igt_display_t *display, igt_output_t *output,
>  {
>  	igt_fb_t input_fb, output_fb;
>  	igt_plane_t *plane;
> -	uint32_t writeback_format = DRM_FORMAT_XRGB8888;
>  	uint64_t modifier = DRM_FORMAT_MOD_LINEAR;
>  	int width, height, ret;
> +	uint16_t i;
>  
>  	igt_output_override_mode(output, &override_mode);
>  
>  	width = override_mode.hdisplay;
>  	height = override_mode.vdisplay;
>  
> -	ret = igt_create_fb(display->drm_fd, width, height,
> -			    DRM_FORMAT_XRGB8888, modifier, &input_fb);
> -	igt_assert(ret >= 0);
> +	for (i = 0; i < sizeof(fourcc) / sizeof(uint32_t); i++) {
>  
> -	ret = igt_create_fb(display->drm_fd, width, height,
> -			    writeback_format, modifier, &output_fb);
> -	igt_assert(ret >= 0);
> +		ret = igt_create_fb(display->drm_fd, width, height,
> +				    fourcc[i], modifier, &input_fb);
> +		igt_assert(ret >= 0);
>  
> -	plane = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
> -	igt_plane_set_fb(plane, &input_fb);
> -	igt_output_set_writeback_fb(output, &output_fb);
> +		ret = igt_create_fb(display->drm_fd, width, height,
> +				    fourcc[i], modifier, &output_fb);
> +		igt_assert(ret >= 0);
>  
> -	ret = igt_display_try_commit_atomic(display, DRM_MODE_ATOMIC_TEST_ONLY |
> -					    DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
> -	igt_plane_set_fb(plane, NULL);
> -	igt_remove_fb(display->drm_fd, &input_fb);
> -	igt_remove_fb(display->drm_fd, &output_fb);
> +		plane = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
> +		igt_plane_set_fb(plane, &input_fb);
> +		igt_output_set_writeback_fb(output, &output_fb);
> +
> +		ret = igt_display_try_commit_atomic(display, DRM_MODE_ATOMIC_TEST_ONLY |
> +						    DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
> +		igt_plane_set_fb(plane, NULL);
> +		igt_remove_fb(display->drm_fd, &input_fb);
> +		igt_remove_fb(display->drm_fd, &output_fb);
> +
> +		if (!ret)
> +			data.supported_colors |= 1 << i;
> +	}
>  
>  	return !ret;
>  }
> @@ -310,7 +343,7 @@ static void fill_fb(igt_fb_t *fb, uint32_t pixel)
>  	uint32_t *ptr;
>  	int64_t pixel_count, i;
>  
> -	igt_assert(fb->drm_format == DRM_FORMAT_XRGB8888);
> +	igt_assert(fb->drm_format == DRM_FORMAT_XRGB8888 || fb->drm_format == DRM_FORMAT_XRGB2101010);
>  
>  	ptr = igt_fb_map_buffer(fb->fd, fb);
>  	igt_assert(ptr);
> @@ -335,14 +368,21 @@ static void get_and_wait_out_fence(igt_output_t *output)
>  }
>  
>  static void writeback_sequence(igt_output_t *output, igt_plane_t *plane,
> -				igt_fb_t *in_fb, igt_fb_t *out_fbs[], int n_commits)
> +			       igt_fb_t *in_fb, igt_fb_t *out_fbs[],
> +			       int n_commits, uint32_t fourcc_color)
>  {
>  	int i = 0;
> -	uint32_t in_fb_colors[2] = { 0x42ff0000, 0x4200ff00 };
> +	uint32_t *in_fb_colors;
> +	uint32_t in_fb_colors_8bits[2] = { 0x42ff0000, 0x4200ff00 };
> +	uint32_t in_fb_colors_10bits[2] = { 0x3ff00000, 0x000ffc00 };
>  	uint32_t clear_color = 0xffffffff;
> -
>  	igt_crc_t cleared_crc, out_expected;
>  
> +	if (fourcc_color == DRM_FORMAT_XRGB2101010)
> +		in_fb_colors = in_fb_colors_10bits;
> +	else
> +		in_fb_colors = in_fb_colors_8bits;
> +
>  	for (i = 0; i < n_commits; i++) {
>  		/* Change the input color each time */
>  		fill_fb(in_fb, in_fb_colors[i % 2]);
> @@ -390,32 +430,33 @@ static void writeback_sequence(igt_output_t *output, igt_plane_t *plane,
>  }
>  
>  static void writeback_check_output(igt_output_t *output, igt_plane_t *plane,
> -				   igt_fb_t *input_fb, igt_fb_t *output_fb)
> +				   igt_fb_t *input_fb, igt_fb_t *output_fb,
> +				   uint32_t fourcc_color)
>  {
>  	igt_fb_t *out_fbs[2] = { 0 };
>  	igt_fb_t second_out_fb;
>  	unsigned int fb_id;
>  
>  	/* One commit, with a writeback. */
> -	writeback_sequence(output, plane, input_fb, &output_fb, 1);
> +	writeback_sequence(output, plane, input_fb, &output_fb, 1, fourcc_color);
>  
>  	/* Two commits, the second with no writeback */
>  	out_fbs[0] = output_fb;
> -	writeback_sequence(output, plane, input_fb, out_fbs, 2);
> +	writeback_sequence(output, plane, input_fb, out_fbs, 2, fourcc_color);
>  
>  	/* Two commits, both with writeback */
>  	out_fbs[1] = output_fb;
> -	writeback_sequence(output, plane, input_fb, out_fbs, 2);
> +	writeback_sequence(output, plane, input_fb, out_fbs, 2, fourcc_color);
>  
>  	fb_id = igt_create_fb(output_fb->fd, output_fb->width, output_fb->height,
> -			      DRM_FORMAT_XRGB8888,
> +			      fourcc_color,
>  			      igt_fb_mod_to_tiling(0),
>  			      &second_out_fb);
>  	igt_require(fb_id > 0);
>  
>  	/* Two commits, with different writeback buffers */
>  	out_fbs[1] = &second_out_fb;
> -	writeback_sequence(output, plane, input_fb, out_fbs, 2);
> +	writeback_sequence(output, plane, input_fb, out_fbs, 2, fourcc_color);
>  
>  	igt_remove_fb(output_fb->fd, &second_out_fb);
>  }
> @@ -537,7 +578,7 @@ igt_main_args("b:c:f:dl", long_options, help_str, opt_handler, NULL)
>  	igt_display_t display;
>  	igt_output_t *output;
>  	igt_plane_t *plane;
> -	igt_fb_t input_fb;
> +	igt_fb_t input_fb, input_fb_10bit;
>  	drmModeModeInfo mode;
>  	unsigned int fb_id;
>  
> @@ -570,6 +611,14 @@ igt_main_args("b:c:f:dl", long_options, help_str, opt_handler, NULL)
>  				      DRM_FORMAT_MOD_LINEAR,
>  				      &input_fb);
>  		igt_assert(fb_id >= 0);
> +
> +		fb_id = igt_create_fb(display.drm_fd, mode.hdisplay,
> +				      mode.vdisplay,
> +				      DRM_FORMAT_XRGB2101010,
> +				      DRM_FORMAT_MOD_LINEAR,
> +				      &input_fb_10bit);
> +		igt_assert(fb_id >= 0);
> +
>  		igt_plane_set_fb(plane, &input_fb);
>  
>  		if (data.list_modes)
> @@ -629,6 +678,7 @@ igt_main_args("b:c:f:dl", long_options, help_str, opt_handler, NULL)
>  		igt_fb_t output_fb;
>  
>  		igt_skip_on(data.dump_check || data.list_modes);
> +		igt_skip_on_f(!(data.supported_colors & XRGB8888),"%.4s is unsupported\n", (char*) &fourcc[0]);

I think this code would be clearer if you used DRM_FORMAT_XRGB8888
here instead of fourcc[0].

>  		fb_id = igt_create_fb(display.drm_fd, mode.hdisplay, mode.vdisplay,
>  				      DRM_FORMAT_XRGB8888,
>  				      DRM_FORMAT_MOD_LINEAR,
> @@ -640,18 +690,53 @@ igt_main_args("b:c:f:dl", long_options, help_str, opt_handler, NULL)
>  		igt_remove_fb(display.drm_fd, &output_fb);
>  	}
>  
> +	igt_describe("Validate XRGB2101010 WRITEBACK_FB_ID with valid and invalid options");
> +	igt_subtest("writeback-fb-id-XRGB2101010") {
> +		igt_fb_t output_fb;
> +
> +		igt_skip_on(data.dump_check || data.list_modes);
> +		igt_skip_on_f(!(data.supported_colors & XRGB2101010), "%.4s is unsupported\n", (char*) &fourcc[1]);

Please use DRM_FORMAT_XRGB2101010 here instead of fourcc[1]. It makes it
much clearer what's happening. Same in all the places below that use
fourcc[x].

Harry

> +		fb_id = igt_create_fb(display.drm_fd, mode.hdisplay, mode.vdisplay,
> +				      DRM_FORMAT_XRGB2101010,
> +				      DRM_FORMAT_MOD_LINEAR,
> +				      &output_fb);
> +		igt_require(fb_id > 0);
> +
> +		writeback_fb_id(output, &input_fb_10bit, &output_fb);
> +
> +		igt_remove_fb(display.drm_fd, &output_fb);
> +	}
> +
>  	igt_describe("Check writeback output with CRC validation");
>  	igt_subtest("writeback-check-output") {
>  		igt_fb_t output_fb;
>  
>  		igt_skip_on(data.dump_check || data.list_modes);
> +		igt_skip_on_f(!(data.supported_colors & XRGB8888), "%.4s is unsupported\n", (char*) &fourcc[0]);
>  		fb_id = igt_create_fb(display.drm_fd, mode.hdisplay, mode.vdisplay,
>  				      DRM_FORMAT_XRGB8888,
>  				      igt_fb_mod_to_tiling(0),
>  				      &output_fb);
>  		igt_require(fb_id > 0);
>  
> -		writeback_check_output(output, plane, &input_fb, &output_fb);
> +		writeback_check_output(output, plane, &input_fb, &output_fb, fourcc[0]);
> +
> +		igt_remove_fb(display.drm_fd, &output_fb);
> +	}
> +
> +	igt_describe("Check XRGB2101010 writeback output with CRC validation");
> +	igt_subtest("writeback-check-output-XRGB2101010") {
> +		igt_fb_t output_fb;
> +
> +		igt_skip_on(data.dump_check || data.list_modes);
> +		igt_skip_on_f(!(data.supported_colors & XRGB2101010), "%.4s is unsupported\n", (char*) &fourcc[1]);
> +		fb_id = igt_create_fb(display.drm_fd, mode.hdisplay, mode.vdisplay,
> +				      DRM_FORMAT_XRGB2101010,
> +				      igt_fb_mod_to_tiling(0),
> +				      &output_fb);
> +		igt_require(fb_id > 0);
> +
> +		writeback_check_output(output, plane, &input_fb_10bit, &output_fb, fourcc[1]);
>  
>  		igt_remove_fb(display.drm_fd, &output_fb);
>  	}
> @@ -659,6 +744,7 @@ igt_main_args("b:c:f:dl", long_options, help_str, opt_handler, NULL)
>  	igt_fixture {
>  		detach_crtc(&display, output);
>  		igt_remove_fb(display.drm_fd, &input_fb);
> +		igt_remove_fb(display.drm_fd, &input_fb_10bit);
>  		igt_display_fini(&display);
>  		drm_close_driver(display.drm_fd);
>  	}

  reply	other threads:[~2023-09-15 15:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-06 22:37 [igt-dev] [PATCH 0/3][i-g-t][V2] kms_writeback: support DRM_FORMAT_XRGB2101010 in kms_writeback Alex Hung
2023-09-06 22:37 ` [igt-dev] [PATCH 1/3][i-g-t][V2] lib/igt_fb: use the entire 32 bit for fnv1a_crc Alex Hung
2023-09-06 22:37 ` [igt-dev] [PATCH 2/3][i-g-t][V2] lib/igt_fb: add 10 bits (XRGB2101010) supports in fnv1a_crc Alex Hung
2023-09-06 22:37 ` [igt-dev] [PATCH 3/3][i-g-t][V2] tests/kms_writeback: support DRM_FORMAT_XRGB2101010 for writeback Alex Hung
2023-09-15 15:10   ` Harry Wentland [this message]
2023-09-25  8:50     ` Kamil Konieczny
2023-09-07  0:00 ` [igt-dev] ✗ Fi.CI.BAT: failure for kms_writeback: support DRM_FORMAT_XRGB2101010 in kms_writeback Patchwork
2023-09-07 17:58 ` [igt-dev] ✓ Fi.CI.BAT: success for kms_writeback: support DRM_FORMAT_XRGB2101010 in kms_writeback (rev2) Patchwork
2023-09-07 18:01 ` [igt-dev] ✓ CI.xeBAT: " Patchwork
2023-09-07 20:03 ` [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=56f6859d-6a77-419f-aa42-38061adbd203@amd.com \
    --to=harry.wentland@amd.com \
    --cc=alex.hung@amd.com \
    --cc=brian.starkey@arm.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=maxime@cerno.tech \
    /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