From: Sebastian Brzezinka <sebastian.brzezinka@intel.com>
To: Mohammed Bilal <mohammed.bilal@intel.com>,
<igt-dev@lists.freedesktop.org>
Cc: <jeevan.b@intel.com>, <kunal1.joshi@intel.com>,
<karthik.b.s@intel.com>, <sameer.lattannavar@intel.com>
Subject: Re: [PATCH i-g-t v4 1/2] lib/igt_chamelium: Add igt_chamelium_get_port() helper and connector_test() macro
Date: Fri, 19 Dec 2025 13:49:57 +0100 [thread overview]
Message-ID: <DF27FCZIC1Q2.3G2DE3SN10OUW@intel.com> (raw)
In-Reply-To: <20251215150717.1190726-2-mohammed.bilal@intel.com>
Hi Mohammed,
On Mon Dec 15, 2025 at 4:07 PM CET, Mohammed Bilal wrote:
> Add a helper to retrieve the first matching Chamelium port and introduce
> a connector_test macro to streamline connector-based subtests with
> automatic lookup and clean skipping.
>
> Signed-off-by: Mohammed Bilal <mohammed.bilal@intel.com>
> ---
> lib/igt_chamelium.c | 22 ++++++++++++++++++++++
> lib/igt_chamelium.h | 26 ++++++++++++++++++++++++++
> 2 files changed, 48 insertions(+)
>
> diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c
> index cb240a7df..95fd9dd4b 100644
> --- a/lib/igt_chamelium.c
> +++ b/lib/igt_chamelium.c
> @@ -3260,6 +3260,28 @@ bool chamelium_wait_all_configured_ports_connected(struct chamelium *chamelium,
> return wait_for_connected_state(drm_fd, connectors, connectors_count);
> }
>
> +/**
> + * igt_chamelium_get_port - Locate the first port matching a connector type
> + *
> + * Finds and returns the first Chamelium port that matches the requested
> + * connector type. Iterates through the provided port list and compares
> + * each port’s connector type. Returns NULL when no matching port exists.
> + */
> +
> +struct chamelium_port *
> +igt_chamelium_get_port(struct chamelium_port **ports,
> + int port_count, int connector_type)
> +{
> + int i;
> +
> + for (i = 0; i < port_count; i++) {
> + if (chamelium_port_get_type(ports[i]) == connector_type)
> + return ports[i];
> + }
> +
> + return NULL;
> +}
> +
> igt_constructor {
> /* Frame dumps can be large, so we need to be able to handle very large
> * responses
> diff --git a/lib/igt_chamelium.h b/lib/igt_chamelium.h
> index b5d13ddc8..2733e3a11 100644
> --- a/lib/igt_chamelium.h
> +++ b/lib/igt_chamelium.h
> @@ -274,4 +274,30 @@ bool chamelium_plug_all(struct chamelium *chamelium);
> bool chamelium_wait_all_configured_ports_connected(struct chamelium *chamelium,
> int drm_fd);
>
> +struct chamelium_port *igt_chamelium_get_port(struct chamelium_port **ports,
> + int port_count, int connector_type);
> +
> +/**
> + * connector_test() - Run a subtest bound to a specific connector type
> + *
> + * This macro wraps a subtest and automatically resolves the required
> + * Chamelium port using igt_chamelium_get_port(). If the requested
> + * connector type is not present, the subtest is skipped cleanly.
> + *
> + * Helps avoid repeated connector-lookup logic and provides a uniform
> + * pattern for connector-specific subtests.
> + */
> +
> +#define connector_test(name, connector_type, test_fn, ...) \
> + do { \
> + igt_subtest(name) { \
> + struct chamelium_port *port = \
> + igt_chamelium_get_port(data.ports, data.port_count, \
> + DRM_MODE_CONNECTOR_##connector_type); \
> + if (!port) \
> + igt_skip(#connector_type " connector not available\n"); \
> + test_fn(&data, port, ##__VA_ARGS__); \
> + } \
> + } while (0)
> +
> #endif /* IGT_CHAMELIUM_H */
Overal, looks good to me.
Reviewed-by: Sebastian Brzezinka <sebastian.brzezinka@intel.com>
--
Best regards,
Sebastian
next prev parent reply other threads:[~2025-12-19 12:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-15 15:07 [PATCH i-g-t v4 0/2] Fix chamelium port allocation during igt_fixture Mohammed Bilal
2025-12-15 15:07 ` [PATCH i-g-t v4 1/2] lib/igt_chamelium: Add igt_chamelium_get_port() helper and connector_test() macro Mohammed Bilal
2025-12-19 12:49 ` Sebastian Brzezinka [this message]
2025-12-15 15:07 ` [PATCH i-g-t v4 2/2] tests/chamelium/kms_chamelium_hpd: use helper function for connector lookup in DP/HDMI/VGA tests Mohammed Bilal
2025-12-15 23:48 ` ✗ i915.CI.BAT: failure for Fix chamelium port allocation during igt_fixture (rev2) Patchwork
2025-12-16 1:00 ` ✗ Xe.CI.BAT: " Patchwork
2025-12-16 11:12 ` ✗ 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=DF27FCZIC1Q2.3G2DE3SN10OUW@intel.com \
--to=sebastian.brzezinka@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=jeevan.b@intel.com \
--cc=karthik.b.s@intel.com \
--cc=kunal1.joshi@intel.com \
--cc=mohammed.bilal@intel.com \
--cc=sameer.lattannavar@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.