Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Karthik B S <karthik.b.s@intel.com>
To: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>,
	<igt-dev@lists.freedesktop.org>
Cc: Vinod Govindapillai <vinod.govindapillai@intel.com>
Subject: Re: [PATCH i-g-t] lib/igt_kms: add --connector option to filter outputs by name
Date: Fri, 5 Jun 2026 09:42:26 +0530	[thread overview]
Message-ID: <e2c76ae3-a99e-4843-932b-e956a37eb524@intel.com> (raw)
In-Reply-To: <20260603152140.3501317-1-juhapekka.heikkila@gmail.com>

Hi JP,

On 6/3/2026 8:51 PM, Juha-Pekka Heikkila wrote:
> Add a global --connector command line option and IGT_CONNECTOR
> environment variable which allow restrict KMS tests to subset

Nit: 'allow restrict' -> 'allows restricting'

Can be updated during merge.

Reviewed-by: Karthik B S <karthik.b.s@intel.com>

> of connectors by name. Matching is done with strstr(), so "HDMI"
> selects all HDMI connectors, "DP" all DisplayPort connectors, and
> "DP-1" only DP-1.
>
> The filter is applied in the two core output-iteration primitives,
> for_each_connected_output() and igt_crtc_connector_valid(), so all
> higher-level macros (for_each_valid_output_on_crtc,
> for_each_crtc_with_valid_output, for_each_crtc_with_single_output)
> honor it automatically.
>
> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
> ---
>   lib/igt_core.c | 12 ++++++++++++
>   lib/igt_core.h | 12 ++++++++++++
>   lib/igt_kms.h  | 27 ++++++++++++++++++++++++++-
>   3 files changed, 50 insertions(+), 1 deletion(-)
>
> diff --git a/lib/igt_core.c b/lib/igt_core.c
> index dc3ac5304..5198d4ec5 100644
> --- a/lib/igt_core.c
> +++ b/lib/igt_core.c
> @@ -358,6 +358,7 @@ enum {
>   	OPT_HOOK,
>   	OPT_HELP_HOOK,
>   	OPT_DEVICE,
> +	OPT_CONNECTOR,
>   	OPT_VERSION,
>   	OPT_HELP = 'h'
>   };
> @@ -951,6 +952,7 @@ static void print_usage(const char *help_str, bool output_on_stderr)
>   		   "  --help-description\n"
>   		   "  --describe\n"
>   		   "  --device filters\n"
> +		   "  --connector <name>\n"
>   		   "  --version\n"
>   		   "  --help|-h\n");
>   	if (help_str)
> @@ -1119,6 +1121,10 @@ static void common_init_env(void)
>   		igt_rc_device = strdup(env);
>   	}
>   
> +	env = getenv("IGT_CONNECTOR");
> +	if (env)
> +		igt_connector_filter = strdup(env);
> +
>   	env = getenv("IGT_RUNNER_SOCKET_FD");
>   	if (env) {
>   		set_runner_socket(atoi(env));
> @@ -1147,6 +1153,7 @@ static int common_init(int *argc, char **argv,
>   		{"hook",              required_argument, NULL, OPT_HOOK},
>   		{"help-hook",         no_argument,       NULL, OPT_HELP_HOOK},
>   		{"device",            required_argument, NULL, OPT_DEVICE},
> +		{"connector",         required_argument, NULL, OPT_CONNECTOR},
>   		{"version",           no_argument,       NULL, OPT_VERSION},
>   		{"help",              no_argument,       NULL, OPT_HELP},
>   		{0, 0, 0, 0}
> @@ -1300,6 +1307,10 @@ static int common_init(int *argc, char **argv,
>   			}
>   			igt_device_filter_add(optarg);
>   			break;
> +		case OPT_CONNECTOR:
> +			assert(optarg);
> +			igt_connector_filter = strdup(optarg);
> +			break;
>   		case OPT_VERSION:
>   			print_version();
>   			ret = -1;
> @@ -1440,6 +1451,7 @@ int igt_subtest_init_parse_opts(int *argc, char **argv,
>   }
>   
>   enum igt_log_level igt_log_level = IGT_LOG_INFO;
> +char *igt_connector_filter;
>   
>   /**
>    * igt_simple_init_parse_opts:
> diff --git a/lib/igt_core.h b/lib/igt_core.h
> index 7ee9ceddd..8e468cc74 100644
> --- a/lib/igt_core.h
> +++ b/lib/igt_core.h
> @@ -1354,6 +1354,18 @@ void igt_log_buffer_inspect(igt_buffer_log_handler_t check, void *data);
>   
>   extern enum igt_log_level igt_log_level;
>   
> +/**
> + * igt_connector_filter:
> + *
> + * Global connector name filter, set via the '--connector' command line option
> + * or the 'IGT_CONNECTOR' environment variable. When non-NULL, KMS output
> + * iteration macros (e.g. for_each_connected_output(),
> + * for_each_valid_output_on_crtc()) only enumerate outputs whose name contains
> + * this string (matched with strstr()). NULL means no filtering
> + * (all outputs are enumerated).
> + */
> +extern char *igt_connector_filter;
> +
>   /**
>    * igt_warn_on:
>    * @condition: condition to test
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index c2a3099de..3d59b0d93 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -32,11 +32,13 @@
>   #include <stdbool.h>
>   #include <stdint.h>
>   #include <stddef.h>
> +#include <string.h>
>   #include <assert.h>
>   #include <limits.h>
>   
>   #include <xf86drmMode.h>
>   
> +#include "igt_core.h"
>   #include "igt_fb.h"
>   #include "ioctl_wrappers.h"
>   
> @@ -672,6 +674,27 @@ static inline bool igt_output_is_connected(igt_output_t *output)
>   	return false;
>   }
>   
> +/**
> + * igt_output_matches_connector_filter:
> + * @output: #igt_output_t to check.
> + *
> + * Checks whether the given @output passes the global connector filter set via
> + * the '--connector' command line option (or the 'IGT_CONNECTOR' environment
> + * variable). The match is done with strstr(), so e.g. "HDMI" matches all HDMI
> + * connectors.
> + *
> + * Returns: True if no filter is set or the @output's name contains the filter
> + * string, otherwise False.
> + */
> +static inline bool igt_output_matches_connector_filter(igt_output_t *output)
> +{
> +	if (!igt_connector_filter)
> +		return true;
> +
> +	return output->name &&
> +	       strstr(output->name, igt_connector_filter);
> +}
> +
>   /**
>    * igt_crtc_connector_valid:
>    * @crtc: CRTC to check.
> @@ -682,6 +705,7 @@ static inline bool igt_output_is_connected(igt_output_t *output)
>   static inline bool igt_crtc_connector_valid(igt_crtc_t *crtc, igt_output_t *output)
>   {
>   	return igt_output_is_connected(output) &&
> +		igt_output_matches_connector_filter(output) &&
>   		output->config.valid_crtc_index_mask & (1 << crtc->crtc_index);
>   }
>   
> @@ -708,7 +732,8 @@ static inline bool igt_crtc_connector_valid(igt_crtc_t *crtc, igt_output_t *outp
>    */
>   #define for_each_connected_output(display, output)		\
>   	for_each_output((display), (output))	\
> -		for_each_if ((igt_output_is_connected((output))))
> +		for_each_if ((igt_output_is_connected((output))) && \
> +			     igt_output_matches_connector_filter((output)))
>   
>   /**
>    * for_each_disconnected_output:

      parent reply	other threads:[~2026-06-05  4:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-03 15:21 [PATCH i-g-t] lib/igt_kms: add --connector option to filter outputs by name Juha-Pekka Heikkila
2026-06-03 17:27 ` ✓ Xe.CI.BAT: success for " Patchwork
2026-06-03 17:29 ` ✓ i915.CI.BAT: " Patchwork
2026-06-04  5:38 ` ✓ Xe.CI.FULL: " Patchwork
2026-06-04 15:16 ` ✗ i915.CI.Full: failure " Patchwork
2026-06-05  4:12 ` Karthik B S [this message]

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=e2c76ae3-a99e-4843-932b-e956a37eb524@intel.com \
    --to=karthik.b.s@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=juhapekka.heikkila@gmail.com \
    --cc=vinod.govindapillai@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