Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Nautiyal, Ankit K" <ankit.k.nautiyal@intel.com>
To: Swati Sharma <swati2.sharma@intel.com>, <igt-dev@lists.freedesktop.org>
Cc: <santhosh.reddy.guddati@intel.com>
Subject: Re: [PATCH i-g-t 3/6] tests/intel/kms_cdclk: Add conditions to filter valid outputs
Date: Mon, 3 Feb 2025 19:35:59 +0530	[thread overview]
Message-ID: <389958a3-b669-4ddd-9f30-d94db65e9ce5@intel.com> (raw)
In-Reply-To: <20241230190315.48821-4-swati2.sharma@intel.com>


On 12/31/2024 12:33 AM, Swati Sharma wrote:
> Conditions are added to filter valid outputs. Also, highres and
> lowres of valid outputs are stored in an array to be re-used
> later.

Imperative mood.

Also mention why the condition are added.

Perhaps to check if both low res and high res are same there would be no 
cdclk transition.

>
> Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
> ---
>   tests/intel/kms_cdclk.c | 52 +++++++++++++++++++++++++++++------------
>   1 file changed, 37 insertions(+), 15 deletions(-)
>
> diff --git a/tests/intel/kms_cdclk.c b/tests/intel/kms_cdclk.c
> index e78d22e1d..dfc64ae2e 100644
> --- a/tests/intel/kms_cdclk.c
> +++ b/tests/intel/kms_cdclk.c
> @@ -261,8 +261,10 @@ static void test_mode_transition_on_all_outputs(data_t *data)
>   	igt_display_t *display = &data->display;
>   	int debugfs_fd = data->debugfs_fd;
>   	drmModeModeInfo *mode, mode_hi, mode_lo;
> +	drmModeModeInfo mode_highres[IGT_MAX_PIPES] = {0}, mode_lowres[IGT_MAX_PIPES] = {0};
> +	igt_output_t *valid_outputs[IGT_MAX_PIPES] = {NULL};
>   	igt_output_t *output;
> -	int valid_outputs = 0;
> +	int count = 0;
>   	int cdclk_ref, cdclk_new;
>   	uint16_t width = 0, height = 0;
>   	struct igt_fb fb;
> @@ -273,31 +275,51 @@ static void test_mode_transition_on_all_outputs(data_t *data)
>   	do_cleanup_display(display);
>   	igt_display_reset(display);
>   
> -	for_each_connected_output(&data->display, output)
> -		valid_outputs++;
> -
> -	i = 0;
>   	for_each_connected_output(display, output) {
> -		mode = igt_output_get_mode(output);
> +		drmModeModeInfo highres_mode;
> +		drmModeModeInfo lowres_mode;
> +
> +		highres_mode = *igt_output_get_highres_mode(output);
> +		igt_require_f(highres_mode.hdisplay >= HDISPLAY_4K && highres_mode.vdisplay >= VDISPLAY_4K &&
> +			      highres_mode.vrefresh >= VREFRESH, "Mode >= 4K not found on output %s.\n",
> +			      igt_output_name(output));
> +
> +		lowres_mode = *get_lowres_mode(output);
> +
> +		if (highres_mode.hdisplay == lowres_mode.hdisplay &&
> +		    highres_mode.vdisplay == lowres_mode.vdisplay) {
> +			igt_info("Highest and lowest mode resolutions are same on output %s; no transition will occur, skipping\n",
> +				  igt_output_name(output));
> +			continue;
> +		}
> +
> +		valid_outputs[count++] = output;
> +	}
> +
> +	igt_skip_on_f(count < 2,
> +		      "Number of valid outputs (%d) must be greater than or equal to 2\n", count);
> +
> +	for (int k = 0; k < count; k++) {

Do we need two loops?

At least highres mode and lowres mode can be stored in the previous loop 
itself.

> +		mode_highres[k] = *igt_output_get_highres_mode(valid_outputs[k]);
> +		mode_lowres[k] = *get_lowres_mode(valid_outputs[k]);
> +
> +		mode = igt_output_get_mode(valid_outputs[k]);
>   		igt_assert(mode);
>   
> +		// Update the maximum width and height for the framebuffer

I dont think we need these comments.


>   		width = max(width, mode->hdisplay);
>   		height = max(height, mode->vdisplay);
>   
> -		mode_hi = *igt_output_get_highres_mode(output);
> -		igt_require_f(mode_hi.hdisplay >= HDISPLAY_4K && mode_hi.vdisplay >= VDISPLAY_4K &&
> -			      mode_hi.vrefresh >= VREFRESH, "Mode >= 4K not found on output %s.\n",
> -			      igt_output_name(output));
> -
> -		igt_output_set_pipe(output, i);
> -		igt_output_override_mode(output, &mode_hi);
> -		i++;
> +		igt_output_set_pipe(valid_outputs[k], k);
> +		igt_output_override_mode(valid_outputs[k], &mode_highres[k]);
>   	}
> +
>   	igt_require(intel_pipe_output_combo_valid(display));
> -	igt_display_reset(display);
>   
> +	// Create a framebuffer with the maximum dimensions calculated earlier

Ditto.

Regards,

Ankit

>   	igt_create_pattern_fb(data->drm_fd, width, height, DRM_FORMAT_XRGB8888,
>   			      DRM_FORMAT_MOD_LINEAR, &fb);
> +
>   	i = 0;
>   	for_each_connected_output(display, output) {
>   		pipe = &display->pipes[i];

  reply	other threads:[~2025-02-03 14:06 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-30 19:03 [PATCH i-g-t 0/6] tests/intel/kms_cdclk: Refactor mode setting and CD clock verification Swati Sharma
2024-12-30 19:03 ` [PATCH i-g-t 1/6] lib/igt_kms: Add highres() and lowres() func Swati Sharma
2025-01-27 11:32   ` Reddy Guddati, Santhosh
2025-01-28  5:51     ` Reddy Guddati, Santhosh
2025-02-03 13:47   ` Nautiyal, Ankit K
2024-12-30 19:03 ` [PATCH i-g-t 2/6] tests/intel/kms_cdclk: Modify highest resolution restriction Swati Sharma
2024-12-30 19:03 ` [PATCH i-g-t 3/6] tests/intel/kms_cdclk: Add conditions to filter valid outputs Swati Sharma
2025-02-03 14:05   ` Nautiyal, Ankit K [this message]
2024-12-30 19:03 ` [PATCH i-g-t 4/6] tests/intel/kms_cdclk: Introduce set_mode() Swati Sharma
2025-02-03 14:11   ` Nautiyal, Ankit K
2024-12-30 19:03 ` [PATCH i-g-t 5/6] tests/intel/kms_cdclk.c: Modify skip condition Swati Sharma
2025-02-03 14:12   ` Nautiyal, Ankit K
2024-12-30 19:03 ` [PATCH i-g-t 6/6] tests/intel/kms_cdclk: Add get_max_cdclk_freq() Swati Sharma
2024-12-30 19:43 ` ✓ i915.CI.BAT: success for tests/intel/kms_cdclk: Refactor mode setting and CD clock verification (rev2) Patchwork
2024-12-30 19:47 ` ✓ Xe.CI.BAT: " Patchwork
2024-12-30 21:56 ` ✗ i915.CI.Full: failure " Patchwork
2024-12-30 22:20 ` ✗ Xe.CI.Full: " 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=389958a3-b669-4ddd-9f30-d94db65e9ce5@intel.com \
    --to=ankit.k.nautiyal@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=santhosh.reddy.guddati@intel.com \
    --cc=swati2.sharma@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox