From: Pranay Samala <pranay.samala@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: karthik.b.s@intel.com, sameer.lattannavar@intel.com,
pranay.samala@intel.com
Subject: [PATCH i-g-t 1/2] lib/igt_kms: Make helper use out-parameter
Date: Mon, 23 Mar 2026 10:40:48 +0530 [thread overview]
Message-ID: <20260323051049.2627387-2-pranay.samala@intel.com> (raw)
In-Reply-To: <20260323051049.2627387-1-pranay.samala@intel.com>
Convert igt_get_non_joiner_mode() helper from returning a mode
pointer to returning bool and filling an output parameter.
Returning connector-owned pointer becomes invalid after connecter
state changes/resets. Hence copying into called-owned argument,
which keeps data stable and safe.
Also update the doc for the new argument and return semantics.
Fixes: e404926ca0d7 ("lib/igt_kms: Add helper to get non-joiner mode")
Signed-off-by: Pranay Samala <pranay.samala@intel.com>
---
lib/igt_kms.c | 10 ++++++----
lib/igt_kms.h | 2 +-
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 197ed15d1..118890014 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -7057,13 +7057,14 @@ bool ultrajoiner_mode_found(int drm_fd, drmModeConnector *connector,
* igt_get_non_joiner_mode:
* @drm_fd: drm file descriptor
* @output: pointer to the output structure
+ * @mode: a pointer to a drm mode structure
*
* Finds the display mode from the output that does not require
* Big Joiner or Ultra Joiner.
*
- * Returns: Pointer to non-joiner mode, or NULL if not found.
+ * Returns: True if non-joiner mode found.
*/
-drmModeModeInfo *igt_get_non_joiner_mode(int drm_fd, igt_output_t *output)
+bool igt_get_non_joiner_mode(int drm_fd, igt_output_t *output, drmModeModeInfo *mode)
{
drmModeConnector *connector;
int max_dotclock;
@@ -7077,11 +7078,12 @@ drmModeModeInfo *igt_get_non_joiner_mode(int drm_fd, igt_output_t *output)
/* Check if mode requires joiner */
if (!igt_bigjoiner_possible(drm_fd, current_mode, max_dotclock) &&
!igt_ultrajoiner_possible(drm_fd, current_mode, max_dotclock)) {
- return current_mode;
+ *mode = *current_mode;
+ return true;
}
}
- return NULL;
+ return false;
}
/**
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 71ed4604e..d63836588 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -1259,7 +1259,7 @@ bool igt_ultrajoiner_possible(int drmfd, drmModeModeInfo *mode, int max_dotclock
bool ultrajoiner_mode_found(int drm_fd, drmModeConnector *connector,
int max_dotclock, drmModeModeInfo *mode);
bool igt_has_force_joiner_debugfs(int drmfd, char *conn_name);
-drmModeModeInfo *igt_get_non_joiner_mode(int drm_fd, igt_output_t *output);
+bool igt_get_non_joiner_mode(int drm_fd, igt_output_t *output, drmModeModeInfo *mode);
bool is_joiner_mode(int drm_fd, igt_output_t *output);
bool igt_check_force_joiner_status(int drmfd, char *connector_name);
bool igt_check_bigjoiner_support(igt_display_t *display);
--
2.34.1
next prev parent reply other threads:[~2026-03-23 5:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-23 5:10 [PATCH i-g-t 0/2] Fix non-joiner mode helper and use it in test Pranay Samala
2026-03-23 5:10 ` Pranay Samala [this message]
2026-03-23 9:25 ` [PATCH i-g-t 1/2] lib/igt_kms: Make helper use out-parameter Jani Nikula
2026-03-23 5:10 ` [PATCH i-g-t 2/2] tests/intel/kms_sharpness_filter: Use stable non-joiner mode for joiner bypass Pranay Samala
2026-03-23 7:29 ` Garg, Nemesa
2026-03-23 9:29 ` Jani Nikula
2026-03-23 13:02 ` Samala, Pranay
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=20260323051049.2627387-2-pranay.samala@intel.com \
--to=pranay.samala@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=karthik.b.s@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox