public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Thasleem, Mohammed" <mohammed.thasleem@intel.com>
To: <igt-dev@lists.freedesktop.org>, <kunal1.joshi@intel.com>
Subject: Re: [PATCH i-g-t] tests/kms_pipe_crc_basic: add mst suspend-resume test
Date: Tue, 6 Jan 2026 17:24:35 +0530	[thread overview]
Message-ID: <9537e13f-65b0-4fa4-849e-883145abe769@intel.com> (raw)
In-Reply-To: <20251126092412.739982-1-kunal1.joshi@intel.com>


On 26-11-2025 02:54 pm, Kunal Joshi wrote:
> Extend kms_pipe_crc_basic with an MST-specific
> suspend-resume subtest.
>
> mst-suspend-read-crc subtest does below:
> -> Enumerates MST topologies using the PATH-based helpers.
> -> Builds all non-empty subsets of up to MAX_MST_OUTPUT
>     outputs per topology.
> -> Assigns pipes in a joiner-aware way and enforces
>     link bandwidth limits.
> -> Asserts that pre and post-suspend CRCs match for each
>     tested subset.
>
> Signed-off-by: Kunal Joshi<kunal1.joshi@intel.com>
> ---
>   tests/kms_pipe_crc_basic.c | 206 +++++++++++++++++++++++++++++++++++++
>   tests/meson.build          |   3 +
>   2 files changed, 209 insertions(+)
>
> diff --git a/tests/kms_pipe_crc_basic.c b/tests/kms_pipe_crc_basic.c
> index 9750d014c..3a8cd3251 100644
> --- a/tests/kms_pipe_crc_basic.c
> +++ b/tests/kms_pipe_crc_basic.c
> @@ -32,6 +32,8 @@
>   
>   #include "igt.h"
>   #include "igt_sysfs.h"
> +#include "intel/kms_mst_helper.h"
> +#include "intel/kms_joiner_helper.h"
>   #include <errno.h>
>   #include <stdbool.h>
>   #include <stdio.h>
> @@ -77,6 +79,11 @@
>    *              CRTC does not cause issues.
>    */
>   
> +/**
> + * SUBTEST: mst-suspend-read-crc
> + * Description: MST suspend test for pipe CRC reads.
> + */
> +
>   static bool extended;
>   static enum pipe active_pipes[IGT_MAX_PIPES];
>   static uint32_t last_pipe;
> @@ -96,6 +103,194 @@ static struct {
>   	{ .r = 0.0, .g = 1.0, .b = 1.0 },
>   };
>   
> +#define MAX_MST_OUTPUT 3
> +
> +static void collect_single_crc(int drm_fd, enum pipe pipe, igt_crc_t *crc)
> +{
> +	igt_pipe_crc_t *pipe_crc;
> +
> +	pipe_crc = igt_pipe_crc_new(drm_fd, pipe, IGT_PIPE_CRC_SOURCE_AUTO);
                 -->Check if we can add error handling here...
> +	igt_pipe_crc_collect_crc(pipe_crc, crc);
> +	igt_pipe_crc_free(pipe_crc);
> +}
> +
> +static void collect_crc_for_active_outputs(igt_display_t *display,
> +					   igt_output_t **outputs,
> +					   int num_outputs,
> +					   igt_crc_t *crcs)
> +{
> +	int i;
> +
> +	for (i = 0; i < num_outputs; i++) {
> +		igt_output_t *output = outputs[i];
> +		enum pipe pipe = output->pending_pipe;
> +
> +		igt_assert(pipe >= 0 && pipe < IGT_MAX_PIPES);
> +		collect_single_crc(display->drm_fd, pipe, &crcs[i]);
> +	}
> +}
> +
> +static void run_mst_subset_and_verify(igt_display_t *display,
> +				      igt_output_t **active_outputs,
> +				      int num_active,
> +				      int n_pipes,
> +				      uint32_t master_pipes_mask,
> +				      uint32_t valid_pipes_mask)
> +{
> +	int a;
> +	igt_crc_t pre_crcs[IGT_MAX_PIPES];
> +	igt_crc_t post_crcs[IGT_MAX_PIPES];
> +	uint32_t used_pipes_mask = 0;
> +	enum igt_suspend_test stest = SUSPEND_TEST_NONE;
> +	int drm_fd = display->drm_fd;
> +
> +	igt_require_f(num_active <= n_pipes,
> +		      "Not enough pipes for MST subset\n");
> +
> +	igt_require(igt_assign_pipes_for_outputs(drm_fd,
> +						 active_outputs,
> +						 num_active,
> +						 n_pipes,
> +						 &used_pipes_mask,
> +						 master_pipes_mask,
> +						 valid_pipes_mask));
> +
> +	igt_require_f(igt_fit_modes_in_bw(display),
> +		      "Unable to fit modes in bw\n");
> +
> +	igt_display_commit2(display, COMMIT_ATOMIC);
> +
> +	igt_info("MST subset: %d outputs, n_pipes=%d\n",
> +		 num_active, n_pipes);
> +	for (a = 0; a < num_active; a++) {
> +		igt_output_t *o = active_outputs[a];
> +		drmModeModeInfo *m = igt_output_get_mode(o);
> +
> +		igt_info(" pre: output %s pipe %s mode %dx%d@%d\n",
> +			 o->name,
> 		 -->igt_info("[%d] PRE-SUSPEND: output %s -> pipe %s, mode %dx%d@%d\n",
>
>          	 a, o->name,  will give bit more clarity about which mst out is being tested...
> +			 kmstest_pipe_name(o->pending_pipe),
> +			 m ? m->hdisplay : -1,
> +			 m ? m->vdisplay : -1,
> +			 m ? m->vrefresh : 0);
> +	}
> +
> +	collect_crc_for_active_outputs(display,
> +				       active_outputs,
> +				       num_active,
> +				       pre_crcs);
> +
> +	for (a = 0; a < num_active; a++) {
> +		char *s = igt_crc_to_string(&pre_crcs[a]);
> +
> +		igt_info(" pre: output %s CRC %s\n",
> +			 active_outputs[a]->name, s);
> +		free(s);
> +	}
> +
> +	igt_system_suspend_autoresume(SUSPEND_STATE_MEM, stest);
> +
> +	collect_crc_for_active_outputs(display,
> +				       active_outputs,
> +				       num_active,
> +				       post_crcs);
> +
> +	for (a = 0; a < num_active; a++) {
> +		igt_output_t *o = active_outputs[a];
> +		drmModeModeInfo *m = igt_output_get_mode(o);
> +		char *s_post = igt_crc_to_string(&post_crcs[a]);
> +
> +		igt_info(" post: output %s CRC %s mode %dx%d@%d\n",
> +			 o->name,
                                 -->igt_info("[%d] POST-SUSPEND: output 
%s -> pipe %s, mode %dx%d@%d\n",
                                      a, o->name,    will give bit more 
clarity about which mst out is being tested...
> +			 s_post,
> +			 m ? m->hdisplay : -1,
> +			 m ? m->vdisplay : -1,
> +			 m ? m->vrefresh : 0);
> +		free(s_post);
> +	}
> +
> +	for (a = 0; a < num_active; a++)
> +		igt_assert_crc_equal(&pre_crcs[a], &post_crcs[a]);
> +}
> +
> +static void mst_suspend_read_crc(igt_display_t *display)
> +{
> +	igt_output_t *output;
> +	igt_output_t *mst_outputs[MAX_MST_OUTPUT];
> +	igt_output_t *active_outputs[MAX_MST_OUTPUT];
> +	int num_mst, i, num_active;
> +	int traversed_roots[IGT_MAX_PIPES];
> +	int num_roots = 0;
> +	uint32_t valid_pipes_mask = 0;
> +	uint32_t master_pipes_mask;
> +	int n_pipes = igt_display_get_n_pipes(display);
> +	int drm_fd = display->drm_fd;
                 -->Order declaration lines in decreasing line length.
> +
> +	for (i = 0; i < IGT_MAX_PIPES; i++) {
> +		if (display->pipes[i].valid)
> +			valid_pipes_mask |= BIT(i);
> +	}
> +
> +	igt_set_all_master_pipes_for_platform(display, &master_pipes_mask);
> +
> +	for_each_connected_output(display, output) {
> +		int root_id;
> +		bool root_seen = false;
> +
> +		root_id = igt_get_dp_mst_connector_id(output);
> +		if (root_id < 0) {
> +			igt_info("Skipping non-mst output %s\n", output->name);
> +			continue;
> +		}
> +
> +		for (i = 0; i < num_roots; i++)
> +			if (traversed_roots[i] == root_id)
> +				root_seen = true;
> +
> +		if (root_seen)
> +			continue;
> +
> +		num_mst = 0;
> +		igt_require(igt_find_all_mst_output_in_topology(drm_fd, display,
> +								output, mst_outputs,
> +								&num_mst) == 0);
> +		igt_require(num_mst > 0);
     -->i think we can give some print if no mst found?
> +
> +		if (num_roots < IGT_MAX_PIPES)
> +			traversed_roots[num_roots++] = root_id;
> +
> +		if (num_mst > MAX_MST_OUTPUT)
> +			num_mst = MAX_MST_OUTPUT;
> +
> +		/* In future if we can print name of MST hub will be great */
> +		igt_dynamic_f("mst-topo-%d", num_roots) {
> +			int mask;
> +
> +			for (mask = 1; mask < (1 << num_mst); mask++) {
                                                     ->use named 
constant insted hard cordcoded...
> +				int bit, idx = 0;
> +
> +				/* build subset for this bitmask */
> +				for (bit = 0; bit < num_mst; bit++) {
> +					if (!(mask & (1 << bit)))
> +						continue;
> +

-->what if idx, max out for supported mst output?

                                                             can we have 
check to break if idx >= mst max supporet?

> +					active_outputs[idx++] = mst_outputs[bit];
> +				}
> +
> +				num_active = idx;
> +				if (!num_active)
> +					continue;
> +
> +				igt_display_reset(display);
> +
> +				run_mst_subset_and_verify(display, active_outputs,
> +							  num_active, n_pipes,
> +							  master_pipes_mask,
> +							  valid_pipes_mask);
> +			}
> +		}
> +	}
> +}
> +
>   static bool simulation_constraint(enum pipe pipe)
>   {
>   	if (igt_run_in_simulation() && !extended &&
> @@ -456,6 +651,17 @@ igt_main_args("e", NULL, help_str, opt_handler, NULL)
>   		}
>   	}
>   
> +	igt_describe("MST suspend test for pipe CRC reads.");
> +	igt_subtest_with_dynamic("mst-suspend-read-crc") {
> +		bool found_mst_output = false;
> +
> +		for_each_connected_output(&data.display, output)
> +			found_mst_output = found_mst_output |
> +					   igt_check_output_is_dp_mst(output);
> +		igt_require_f(found_mst_output, "Need at least 1 MST output\n");
> +		mst_suspend_read_crc(&data.display);
> +	}
> +
>   	igt_describe("Check that disabling CRCs on a CRTC after having disabled the CRTC "
>   		     "does not cause issues.");
>   	igt_subtest_with_dynamic("disable-crc-after-crtc") {
> diff --git a/tests/meson.build b/tests/meson.build
> index da70c5014..59dc52492 100644
> --- a/tests/meson.build
> +++ b/tests/meson.build
> @@ -392,6 +392,9 @@ extra_sources = {
>   	'kms_dsc': [ join_paths ('intel', 'kms_dsc_helper.c') ],
>   	'kms_joiner': [ join_paths ('intel', 'kms_joiner_helper.c') ],
>   	'kms_psr2_sf':  [ join_paths ('intel', 'kms_dsc_helper.c') ],
> +        'kms_pipe_crc_basic': [
> +           join_paths ('intel', 'kms_mst_helper.c'),
> +           join_paths ('intel', 'kms_joiner_helper.c') ],
>   }
>   
>   # Extra dependencies used on core and Intel drivers

  parent reply	other threads:[~2026-01-06 11:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-26  9:24 [PATCH i-g-t] tests/kms_pipe_crc_basic: add mst suspend-resume test Kunal Joshi
2025-11-26 10:31 ` ✓ i915.CI.BAT: success for " Patchwork
2025-11-26 10:32 ` ✓ Xe.CI.BAT: " Patchwork
2025-11-26 11:50 ` ✗ Xe.CI.Full: failure " Patchwork
2025-11-26 16:59 ` ✗ i915.CI.Full: " Patchwork
2026-01-06 11:54 ` Thasleem, Mohammed [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-01-27  9:11 [PATCH i-g-t] " Kunal Joshi
2026-01-29  8:24 ` Bilal, Mohammed

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=9537e13f-65b0-4fa4-849e-883145abe769@intel.com \
    --to=mohammed.thasleem@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kunal1.joshi@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