Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Karthik B S <karthik.b.s@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: jeevan.b@intel.com, sowmiya.s@intel.com,
	ankit.k.nautiyal@intel.com, Karthik B S <karthik.b.s@intel.com>
Subject: [PATCH i-g-t v2 2/2] lib/igt_kms: Add max uncompressed dotclock limit for non-joiner mode selection
Date: Wed, 25 Nov 2026 15:53:51 +0530	[thread overview]
Message-ID: <20261125102352.1905996-2-karthik.b.s@intel.com> (raw)
In-Reply-To: <20261125102352.1905996-1-karthik.b.s@intel.com>

From display 30 the kernel limits the single pipe pixel rate without
DSC to the maximum validated frequency, which is below the max dotclock
derived from CDCLK and reported in debugfs (see
intel_max_uncompressed_dotclock()). Above this limit an uncompressed
mode can't be driven by a single pipe.

intel_boundary_non_joiner_mode_found() only checks against the max
dotclock, so on a sink without DSC support it can select a boundary
mode which the kernel drives with joiner.

Add intel_get_max_uncompressed_dotclock() mirroring the kernel limits
and use it in intel_boundary_non_joiner_mode_found(), so that the
selected boundary mode stays on a single pipe irrespective of DSC
support in the sink.

v2: Use macros for the limits, rename max_clock to
    max_uncompressed_dotclock (Sowmiya)

Signed-off-by: Karthik B S <karthik.b.s@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
---
 lib/igt_kms.c | 33 +++++++++++++++++++++++++++++++--
 lib/igt_kms.h |  3 +++
 2 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 789da08b3..9c4c9b8ff 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -7223,6 +7223,32 @@ int igt_get_current_cdclk(int fd)
 	return read_and_parse_cdclk_debugfs(fd, "Current CD clock frequency:");
 }
 
+/**
+ * intel_get_max_uncompressed_dotclock:
+ * @drm_fd: drm file descriptor
+ * @max_dotclock: Max pixel clock frequency
+ *
+ * Get the maximum pixel clock a single pipe supports without DSC. This
+ * mirrors the kernel's intel_max_uncompressed_dotclock(): above this
+ * limit an uncompressed mode can't be driven by a single pipe, so only
+ * modes below it are guaranteed to use a single pipe irrespective of
+ * DSC support in the sink.
+ *
+ * Returns: The maximum uncompressed pixel clock for a single pipe.
+ */
+int intel_get_max_uncompressed_dotclock(int drm_fd, int max_dotclock)
+{
+	int dev_id = intel_get_drm_devid(drm_fd);
+	int limit = max_dotclock;
+
+	if (IS_WILDCATLAKE(dev_id))
+		limit = MAX_UNCOMPRESSED_DOTCLOCK_WCL;
+	else if (intel_display_ver(dev_id) >= 30)
+		limit = MAX_UNCOMPRESSED_DOTCLOCK_DISPLAY_30;
+
+	return min(max_dotclock, limit);
+}
+
 /**
  * intel_get_max_pipe_hdisplay:
  * @drm_fd: drm file descriptor
@@ -7356,7 +7382,9 @@ bool bigjoiner_mode_found(int drm_fd, drmModeConnector *connector,
  * @mode: libdrm mode to be filled
  *
  * Check if connector supports a mode at the platform's maximum single-pipe
- * hdisplay boundary.
+ * hdisplay boundary. The mode clock must be below the uncompressed single
+ * pipe limit, so that the kernel doesn't fall back to joiner when the sink
+ * doesn't support DSC.
  *
  * Returns: True if a valid non-joiner mode at the boundary is found,
  * false otherwise.
@@ -7365,12 +7393,13 @@ bool intel_boundary_non_joiner_mode_found(int drm_fd, drmModeConnector *connecto
 					  int max_dotclock, drmModeModeInfo *mode)
 {
 	int max_hdisplay = intel_get_max_pipe_hdisplay(drm_fd);
+	int max_uncompressed_dotclock = intel_get_max_uncompressed_dotclock(drm_fd, max_dotclock);
 
 	for (int i = 0; i < connector->count_modes; i++) {
 		drmModeModeInfo *current_mode = &connector->modes[i];
 
 		if (current_mode->hdisplay == max_hdisplay &&
-		    current_mode->clock < max_dotclock &&
+		    current_mode->clock < max_uncompressed_dotclock &&
 		    !mode_needs_joiner_exception(drm_fd, current_mode)) {
 			*mode = *current_mode;
 			return true;
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index dfcb91e02..29a4e96fc 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -154,6 +154,8 @@ const char *kmstest_dsc_output_format_str(int output_format);
 void kmstest_dump_mode(drmModeModeInfo *mode);
 #define HDISPLAY_6K_PER_PIPE 6144
 #define HDISPLAY_5K_PER_PIPE 5120
+#define MAX_UNCOMPRESSED_DOTCLOCK_DISPLAY_30 1350000
+#define MAX_UNCOMPRESSED_DOTCLOCK_WCL 937500
 
 enum hardware_pipe __intel_get_pipe_from_crtc_index(int fd, int crtc_index);
 int kmstest_get_crtc_index_from_id(int fd, int crtc_id);
@@ -1381,6 +1383,7 @@ void igt_sort_connector_modes(drmModeConnector *connector,
 bool igt_max_bpc_constraint(igt_display_t *display, igt_crtc_t *crtc,
 			    igt_output_t *output, int bpc);
 int igt_get_max_dotclock(int fd);
+int intel_get_max_uncompressed_dotclock(int drm_fd, int max_dotclock);
 int intel_get_max_pipe_hdisplay(int drm_fd);
 int igt_get_max_cdclk(int fd);
 int igt_get_current_cdclk(int fd);
-- 
2.43.0


  reply	other threads:[~2026-11-25 10:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 10:23 [PATCH i-g-t v2 1/2] tests/kms_setmode: Fix previous crtc mode lookup in joiner check Karthik B S
2026-11-25 10:23 ` Karthik B S [this message]
2026-11-25 10:42   ` [PATCH i-g-t v2 2/2] lib/igt_kms: Add max uncompressed dotclock limit for non-joiner mode selection Jani Nikula
2026-11-25 11:22     ` Karthik B S
2026-11-25 22:34 ` ✓ Xe.CI.BAT: success for series starting with [i-g-t,v2,1/2] tests/kms_setmode: Fix previous crtc mode lookup in joiner check Patchwork
2026-11-25 23:15 ` ✗ i915.CI.BAT: failure " Patchwork
2026-11-26  5:26 ` ✓ i915.CI.BAT: success " Patchwork
2026-11-26  7:45 ` ✓ Xe.CI.FULL: " Patchwork
2026-11-27  5:09 ` ✓ i915.CI.Full: " Patchwork
2026-11-27  9:43 ` 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=20261125102352.1905996-2-karthik.b.s@intel.com \
    --to=karthik.b.s@intel.com \
    --cc=ankit.k.nautiyal@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jeevan.b@intel.com \
    --cc=sowmiya.s@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