All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
	igt-dev@lists.freedesktop.org
Cc: Lyude Paul <lyude@redhat.com>
Subject: Re: [PATCH i-g-t 1/5] tests/nouveau_crc: Extract {setup,cleanup}_test()
Date: Fri, 06 Mar 2026 13:00:32 +0200	[thread overview]
Message-ID: <151de89dadffe3ab8112f5fa03bcf3f9c17fd882@intel.com> (raw)
In-Reply-To: <20260305134038.6995-2-ville.syrjala@linux.intel.com>

On Thu, 05 Mar 2026, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Prep for dynamic subtests by extracting the per-subtest setup/cleanup
> fixtures to separate functions.
>
> Cc: Lyude Paul <lyude@redhat.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

> ---
>  tests/nouveau_crc.c | 89 +++++++++++++++++++++++++--------------------
>  1 file changed, 50 insertions(+), 39 deletions(-)
>
> diff --git a/tests/nouveau_crc.c b/tests/nouveau_crc.c
> index c080ded3e621..393414339ab0 100644
> --- a/tests/nouveau_crc.c
> +++ b/tests/nouveau_crc.c
> @@ -317,6 +317,54 @@ static void test_source_outp_inactive(data_t *data)
>  	destroy_crc_colors(data, colors, n_colors);
>  }
>  
> +static void setup_test(data_t *data)
> +{
> +	int dir;
> +
> +	igt_display_require_output_on_crtc(data->crtc);
> +
> +	/* Disable the output from the previous iteration of pipe tests, if there is
> +	 * one
> +	 */
> +	if (data->output) {
> +		igt_output_set_crtc(data->output, NULL);
> +		igt_display_commit(&data->display);
> +	}
> +
> +	data->output = igt_get_single_output_for_crtc(data->crtc);
> +	data->mode = igt_output_get_mode(data->output);
> +
> +	/* None of these tests need to perform modesets, just page flips. So running
> +	 * display setup here is fine
> +	 */
> +	igt_output_set_crtc(data->output,
> +			    data->crtc);
> +	data->primary = igt_output_get_plane(data->output, 0);
> +	igt_create_color_fb(data->drm_fd,
> +			    data->mode->hdisplay,
> +			    data->mode->vdisplay,
> +			    DRM_FORMAT_XRGB8888,
> +			    DRM_FORMAT_MOD_LINEAR,
> +			    0.0, 0.0, 0.0,
> +			    &data->default_fb);
> +	igt_plane_set_fb(data->primary, &data->default_fb);
> +	igt_display_commit(&data->display);
> +
> +	dir = igt_debugfs_crtc_dir(data->drm_fd,
> +				   data->crtc->pipe,
> +				   O_DIRECTORY);
> +	igt_require_fd(dir);
> +	data->nv_crc_dir = openat(dir, "nv_crc", O_DIRECTORY);
> +	close(dir);
> +	igt_require_fd(data->nv_crc_dir);
> +}
> +
> +static void cleanup_test(data_t *data)
> +{
> +	igt_remove_fb(data->drm_fd, &data->default_fb);
> +	close(data->nv_crc_dir);
> +}
> +
>  data_t data = {0};
>  
>  #define pipe_test(name) igt_subtest_f("pipe-%s-" name, kmstest_pipe_name(pipe))
> @@ -337,46 +385,10 @@ int igt_main()
>  
>  	for_each_pipe_static(pipe) {
>  		igt_fixture() {
> -			int dir;
> -
>  			data.crtc = igt_crtc_for_pipe(&data.display, pipe);
>  			igt_require(data.crtc->valid);
> -			igt_display_require_output_on_crtc(data.crtc);
>  
> -			/* Disable the output from the previous iteration of pipe tests, if there is
> -			 * one
> -			 */
> -			if (data.output) {
> -				igt_output_set_crtc(data.output, NULL);
> -				igt_display_commit(&data.display);
> -			}
> -
> -			data.output = igt_get_single_output_for_crtc(data.crtc);
> -			data.mode = igt_output_get_mode(data.output);
> -
> -			/* None of these tests need to perform modesets, just page flips. So running
> -			 * display setup here is fine
> -			 */
> -			igt_output_set_crtc(data.output,
> -					    data.crtc);
> -			data.primary = igt_output_get_plane(data.output, 0);
> -			igt_create_color_fb(data.drm_fd,
> -					    data.mode->hdisplay,
> -					    data.mode->vdisplay,
> -					    DRM_FORMAT_XRGB8888,
> -					    DRM_FORMAT_MOD_LINEAR,
> -					    0.0, 0.0, 0.0,
> -					    &data.default_fb);
> -			igt_plane_set_fb(data.primary, &data.default_fb);
> -			igt_display_commit(&data.display);
> -
> -			dir = igt_debugfs_crtc_dir(data.drm_fd,
> -						   data.crtc->pipe,
> -						   O_DIRECTORY);
> -			igt_require_fd(dir);
> -			data.nv_crc_dir = openat(dir, "nv_crc", O_DIRECTORY);
> -			close(dir);
> -			igt_require_fd(data.nv_crc_dir);
> +			setup_test(&data);
>  		}
>  
>  		/* We don't need to test this on every pipe, but the setup is the same */
> @@ -414,8 +426,7 @@ int igt_main()
>  			test_source_outp_inactive(&data);
>  
>  		igt_fixture() {
> -			igt_remove_fb(data.drm_fd, &data.default_fb);
> -			close(data.nv_crc_dir);
> +			cleanup_test(&data);
>  		}
>  	}

-- 
Jani Nikula, Intel

  reply	other threads:[~2026-03-06 11:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-05 13:40 [PATCH i-g-t 0/5] kms: A bit more cleanup around igt_kms Ville Syrjala
2026-03-05 13:40 ` [PATCH i-g-t 1/5] tests/nouveau_crc: Extract {setup,cleanup}_test() Ville Syrjala
2026-03-06 11:00   ` Jani Nikula [this message]
2026-03-06 20:57   ` Lyude Paul
2026-03-05 13:40 ` [PATCH i-g-t 2/5] tests/nouveau_crc: Convert to dynamic subtests Ville Syrjala
2026-03-06 11:13   ` Jani Nikula
2026-03-06 11:38     ` Ville Syrjälä
2026-03-05 13:40 ` [PATCH i-g-t 3/5] tests/nouveau_crc: Use igt_first_crtc() instead of igt_crtc_for_pipe() Ville Syrjala
2026-03-06 11:14   ` Jani Nikula
2026-03-06 20:57   ` Lyude Paul
2026-03-05 13:40 ` [PATCH i-g-t 4/5] lib/kms: Make igt_first_crtc() skip if no CRTCs are around Ville Syrjala
2026-03-06 11:17   ` Jani Nikula
2026-03-05 13:40 ` [PATCH i-g-t 5/5] lib/kms: Make igt_first_crtc_with_single_output() skip if no CRTC/output can be found Ville Syrjala
2026-03-06 11:19   ` Jani Nikula
2026-03-05 23:16 ` ✗ Xe.CI.BAT: failure for kms: A bit more cleanup around igt_kms Patchwork
2026-03-05 23:20 ` ✓ i915.CI.BAT: success " Patchwork
2026-03-06 16:32 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-03-07  3:53 ` ✓ i915.CI.Full: success " 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=151de89dadffe3ab8112f5fa03bcf3f9c17fd882@intel.com \
    --to=jani.nikula@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=lyude@redhat.com \
    --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.