From: Jeevan B <jeevan.b@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: kunal1.joshi@intel.com, suraj.kandpal@intel.com
Subject: [PATCH i-g-t 3/6] lib/igt_kms: add helpers for connector type
Date: Mon, 24 Nov 2025 23:57:53 +0530 [thread overview]
Message-ID: <20251124182804.2095722-4-jeevan.b@intel.com> (raw)
In-Reply-To: <20251124182804.2095722-1-jeevan.b@intel.com>
From: Kunal Joshi <kunal1.joshi@intel.com>
Introduce helpers for checking output
connector type, reuse same mechanism for
output_is_internal_panel.
Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com>
---
lib/igt_kms.c | 74 ++++++++++++++++++++++++++++------
lib/igt_kms.h | 9 ++++-
tests/intel/kms_dsc_helper.c | 2 +-
tests/intel/kms_pm_backlight.c | 2 +-
tests/kms_atomic_transition.c | 4 +-
tests/kms_hdr.c | 2 +-
6 files changed, 74 insertions(+), 19 deletions(-)
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 8973ffdb2..c03cfed09 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -3501,22 +3501,70 @@ igt_plane_t *igt_pipe_get_plane_type_index(igt_pipe_t *pipe, int plane_type,
}
/**
- * output_is_internal_panel:
+ * igt_output_type_in_mask - test connector type membership
+ * @output: output (may be NULL)
+ * @mask: bitmask where bit N corresponds to DRM_MODE_CONNECTOR_* value N
+ *
+ * Returns: true if @output has a connector and its connector_type bit is set
+ * in @mask. Safe for DRM_MODE_CONNECTOR_Unknown (0). If @output or its
+ * connector is NULL, returns false.
+ */
+bool igt_output_type_in_mask(igt_output_t *output, uint64_t mask)
+{
+ unsigned int type;
+
+ if (!output || !output->config.connector)
+ return false;
+
+ type = output->config.connector->connector_type;
+
+ return (mask & CONNECTOR_TYPE_BIT(type)) != 0;
+}
+
+/**
+ * igt_output_is_dp_family - classify DP/eDP as DP family
+ * @output: output
+ *
+ * Returns: true if @output is DisplayPort or eDP.
+ */
+bool igt_output_is_dp_family(igt_output_t *output)
+{
+ uint64_t mask =
+ CONNECTOR_TYPE_BIT(DRM_MODE_CONNECTOR_DisplayPort) |
+ CONNECTOR_TYPE_BIT(DRM_MODE_CONNECTOR_eDP);
+
+ return igt_output_type_in_mask(output, mask);
+}
+
+/**
+ * igt_output_is_hdmi - classify HDMI connectors
+ * @output: output
+ *
+ * Returns: true if @output is HDMI (A or B).
+ */
+bool igt_output_is_hdmi(igt_output_t *output)
+{
+ uint64_t mask =
+ CONNECTOR_TYPE_BIT(DRM_MODE_CONNECTOR_HDMIA) |
+ CONNECTOR_TYPE_BIT(DRM_MODE_CONNECTOR_HDMIB);
+
+ return igt_output_type_in_mask(output, mask);
+}
+
+/**
+ * igt_output_is_internal_panel:
* @output: Target output
*
* Returns: True if the given @output type is internal else False.
*/
-bool output_is_internal_panel(igt_output_t *output)
+bool igt_output_is_internal_panel(igt_output_t *output)
{
- switch (output->config.connector->connector_type) {
- case DRM_MODE_CONNECTOR_LVDS:
- case DRM_MODE_CONNECTOR_eDP:
- case DRM_MODE_CONNECTOR_DSI:
- case DRM_MODE_CONNECTOR_DPI:
- return true;
- default:
- return false;
- }
+ uint64_t mask = CONNECTOR_TYPE_BIT(DRM_MODE_CONNECTOR_LVDS) |
+ CONNECTOR_TYPE_BIT(DRM_MODE_CONNECTOR_eDP) |
+ CONNECTOR_TYPE_BIT(DRM_MODE_CONNECTOR_DSI) |
+ CONNECTOR_TYPE_BIT(DRM_MODE_CONNECTOR_DPI);
+
+ return igt_output_type_in_mask(output, mask);
}
igt_output_t **__igt_pipe_populate_outputs(igt_display_t *display, igt_output_t **chosen_outputs)
@@ -3543,7 +3591,7 @@ igt_output_t **__igt_pipe_populate_outputs(igt_display_t *display, igt_output_t
uint32_t pipe_mask = output->config.valid_crtc_idx_mask & full_pipe_mask;
bool found = false;
- if (output_is_internal_panel(output)) {
+ if (igt_output_is_internal_panel(output)) {
/*
* Internal panel should be assigned to pipe A
* if possible, so make sure they're enumerated
@@ -3571,7 +3619,7 @@ igt_output_t **__igt_pipe_populate_outputs(igt_display_t *display, igt_output_t
* Overwrite internal panel if not assigned,
* external outputs are faster to do modesets
*/
- output_is_internal_panel(chosen_outputs[j]))
+ igt_output_is_internal_panel(chosen_outputs[j]))
chosen_outputs[j] = output;
}
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index f7ff0b17e..cd9f6840a 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -578,7 +578,14 @@ igt_plane_t *igt_pipe_get_plane_type(igt_pipe_t *pipe, int plane_type);
int igt_pipe_count_plane_type(igt_pipe_t *pipe, int plane_type);
igt_plane_t *igt_pipe_get_plane_type_index(igt_pipe_t *pipe, int plane_type,
int index);
-bool output_is_internal_panel(igt_output_t *output);
+#ifndef CONNECTOR_TYPE_BIT
+#define CONNECTOR_TYPE_BIT(e) (1ULL << (e))
+#endif
+
+bool igt_output_type_in_mask(igt_output_t *output, uint64_t mask);
+bool igt_output_is_dp_family(igt_output_t *output);
+bool igt_output_is_hdmi(igt_output_t *output);
+bool igt_output_is_internal_panel(igt_output_t *output);
igt_output_t *igt_get_single_output_for_pipe(igt_display_t *display, enum pipe pipe);
void igt_pipe_request_out_fence(igt_pipe_t *pipe);
diff --git a/tests/intel/kms_dsc_helper.c b/tests/intel/kms_dsc_helper.c
index cea4304e4..4f23c39af 100644
--- a/tests/intel/kms_dsc_helper.c
+++ b/tests/intel/kms_dsc_helper.c
@@ -74,7 +74,7 @@ bool is_dsc_supported_by_sink(int drmfd, igt_output_t *output)
return false;
}
- if (!output_is_internal_panel(output) &&
+ if (!igt_output_is_internal_panel(output) &&
!igt_is_fec_supported(drmfd, output->name)) {
igt_info("DSC cannot be enabled without FEC on %s\n",
output->name);
diff --git a/tests/intel/kms_pm_backlight.c b/tests/intel/kms_pm_backlight.c
index a0ecf2b0e..27c31d695 100644
--- a/tests/intel/kms_pm_backlight.c
+++ b/tests/intel/kms_pm_backlight.c
@@ -239,7 +239,7 @@ igt_main
igt_display_require(&display, drm_open_driver(DRIVER_INTEL | DRIVER_XE));
for_each_connected_output(&display, output) {
- if (!output_is_internal_panel(output))
+ if (!igt_output_is_internal_panel(output))
continue;
if (found)
diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index 419afe4dd..f97fc000d 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -1225,11 +1225,11 @@ igt_main_args("", long_opts, help_str, opt_handler, &data)
* panels with long power cycle delays.
*/
if ((transition_tests[i].type == TRANSITION_MODESET) &&
- output_is_internal_panel(output))
+ igt_output_is_internal_panel(output))
continue;
if ((transition_tests[i].type == TRANSITION_MODESET_FAST) &&
- !output_is_internal_panel(output))
+ !igt_output_is_internal_panel(output))
continue;
if (pipe_count == 2 * count && !data.extended)
diff --git a/tests/kms_hdr.c b/tests/kms_hdr.c
index 40187275b..3a931ac9e 100644
--- a/tests/kms_hdr.c
+++ b/tests/kms_hdr.c
@@ -734,7 +734,7 @@ static void test_hdr(data_t *data, uint32_t flags)
continue;
}
- if ((flags & TEST_BRIGHTNESS) && !output_is_internal_panel(output)) {
+ if ((flags & TEST_BRIGHTNESS) && !igt_output_is_internal_panel(output)) {
igt_info("%s: Can't run brightness test on non-internal panel.\n",
igt_output_name(output));
continue;
--
2.43.0
next prev parent reply other threads:[~2025-11-24 18:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-24 18:27 [PATCH i-g-t 0/6] RFC: Add new test for eDP data override Jeevan B
2025-11-24 18:27 ` [PATCH i-g-t 1/6] tests/intel/kms_dp_link_training: rename to tests/intel/kms_link_training Jeevan B
2025-11-24 18:27 ` [PATCH i-g-t 2/6] tests/intel/kms_dp_linktrain_fallback: rename to tests/intel/kms_linktrain_fallback Jeevan B
2025-11-24 18:27 ` Jeevan B [this message]
2025-11-24 18:27 ` [PATCH i-g-t 4/6] tests/intel/kms_link_training: extend test for eDP connector Jeevan B
2025-11-24 18:27 ` [PATCH i-g-t 5/6] lib/igt_kms: Add helper to get eDP/DP supported link rates Jeevan B
2025-11-24 18:27 ` [PATCH i-g-t 6/6] RFC: tests/intel/kms_link_training: Add edp-data-override subtest Jeevan B
-- strict thread matches above, loose matches on Subject: below --
2025-10-15 10:17 [PATCH i-g-t 0/6] extend link training test cases for eDP connector Kunal Joshi
2025-10-15 10:17 ` [PATCH i-g-t 3/6] lib/igt_kms: add helpers for connector type Kunal Joshi
2025-10-27 5:51 ` B, Jeevan
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=20251124182804.2095722-4-jeevan.b@intel.com \
--to=jeevan.b@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=kunal1.joshi@intel.com \
--cc=suraj.kandpal@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.