intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Lee Shawn C <shawn.c.lee@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Lee Shawn C <shawn.c.lee@intel.com>,
	Shankar Uma <uma.shankar@intel.com>,
	Jani Nikula <jani.nikula@intel.com>,
	Imre Deak <imre.deak@intel.com>,
	Vidya Srinivas <vidya.srinivas@intel.com>
Subject: [v2] drm/i915/hdmi: add debugfs to contorl HDMI bpc
Date: Fri,  8 Aug 2025 09:16:02 +0000	[thread overview]
Message-ID: <20250808091602.288323-1-shawn.c.lee@intel.com> (raw)
In-Reply-To: <20250806042053.3570558-1-shawn.c.lee@intel.com>

While performing HDMI compliance testing, test equipment may request
different bpc output for signal measurement. However, display driver
typically determines the maximum available bpc based on HW bandwidth.

Introduce a new debugfs that allows user to configure dedicated bpc
manually, and making HDMI compliance test much easier.

v2: Using exist variable max_requested_bpc.

Cc: Shankar Uma <uma.shankar@intel.com>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Imre Deak <imre.deak@intel.com>
Cc: Vidya Srinivas <vidya.srinivas@intel.com>
Signed-off-by: Lee Shawn C <shawn.c.lee@intel.com>
---
 .../drm/i915/display/intel_display_debugfs.c  | 46 +++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.c b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
index ce3f9810c42d..5ef2bcffefc5 100644
--- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c
+++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
@@ -1208,6 +1208,47 @@ static const struct file_operations i915_dsc_fractional_bpp_fops = {
 	.write = i915_dsc_fractional_bpp_write
 };
 
+static int i915_force_bpc_show(struct seq_file *m, void *data)
+{
+	struct intel_connector *connector = m->private;
+	struct drm_connector *conn = &connector->base;
+
+	seq_printf(m, "%u\n", conn->state->max_requested_bpc);
+
+	return 0;
+}
+
+static ssize_t i915_force_bpc_write(struct file *file,
+				       const char __user *ubuf,
+				       size_t len, loff_t *offp)
+{
+	struct seq_file *m = file->private_data;
+	struct intel_connector *connector = m->private;
+	struct intel_display *display = to_intel_display(connector);
+	struct drm_connector *conn = &connector->base;
+	int new_bpc, ret;
+
+	ret = kstrtoint_from_user(ubuf, len, 0, &new_bpc);
+	if (ret < 0)
+		return ret;
+
+	switch (new_bpc) {
+	case 8:
+	case 10:
+	case 12:
+		break;
+	default:
+		drm_dbg_kms(display->drm, "Invalid bpc value (%u)\n", new_bpc);
+		return -EINVAL;
+	}
+
+	conn->state->max_requested_bpc = new_bpc;
+
+	*offp += len;
+	return len;
+}
+DEFINE_SHOW_STORE_ATTRIBUTE(i915_force_bpc);
+
 /*
  * Returns the Current CRTC's bpc.
  * Example usage: cat /sys/kernel/debug/dri/0/crtc-0/i915_current_bpc
@@ -1359,6 +1400,11 @@ void intel_connector_debugfs_add(struct intel_connector *connector)
 	    connector_type == DRM_MODE_CONNECTOR_HDMIB)
 		debugfs_create_file("i915_lpsp_capability", 0444, root,
 				    connector, &i915_lpsp_capability_fops);
+
+	if (connector_type == DRM_MODE_CONNECTOR_HDMIA ||
+	    connector_type == DRM_MODE_CONNECTOR_HDMIB)
+		debugfs_create_file("i915_force_bpc", 0644, root,
+				    connector, &i915_force_bpc_fops);
 }
 
 /**
-- 
2.34.1


  parent reply	other threads:[~2025-08-08  9:16 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-06  4:20 [PATCH] drm/i915/hdmi: add debugfs to contorl HDMI bpc Lee Shawn C
2025-08-06 13:27 ` Jani Nikula
2025-08-06 14:05 ` Imre Deak
2025-08-06 14:19   ` Imre Deak
2025-08-06 22:40     ` Lee, Shawn C
2025-08-06 16:31 ` ✓ i915.CI.BAT: success for " Patchwork
2025-08-06 19:15 ` ✓ i915.CI.Full: " Patchwork
2025-08-08  9:16 ` Lee Shawn C [this message]
2025-08-08  9:39   ` [v2] " Imre Deak
2025-08-11  6:46     ` Lee, Shawn C
2025-08-14 17:35       ` Imre Deak
2025-08-21  8:20         ` Lee, Shawn C
2025-08-08 10:29 ` ✓ i915.CI.BAT: success for drm/i915/hdmi: add debugfs to contorl HDMI bpc (rev2) Patchwork
2025-08-08 13:22 ` ✗ i915.CI.Full: failure " Patchwork
2025-08-26  7:05 ` [v3] drm/i915/hdmi: add debugfs to contorl HDMI bpc Lee Shawn C
2025-08-26  7:48   ` Jani Nikula
2025-08-26  7:53     ` Lee, Shawn C
2025-08-26  8:01 ` [v4] " Lee Shawn C
2025-08-27  9:23   ` Imre Deak
2025-08-26  8:13 ` ✗ i915.CI.BAT: failure for drm/i915/hdmi: add debugfs to contorl HDMI bpc (rev3) Patchwork
2025-08-26 11:29 ` ✓ i915.CI.BAT: success for drm/i915/hdmi: add debugfs to contorl HDMI bpc (rev4) Patchwork
2025-08-26 17:23 ` ✓ i915.CI.Full: " Patchwork
2025-08-28  8:06 ` [PATCH 1/2] drm/i915/hdmi: add debugfs to contorl HDMI bpc Lee Shawn C
2025-08-28  8:06   ` [PATCH 2/2] drm/i915: compute pipe bpp from link bandwidth management Lee Shawn C
2025-08-28 14:10     ` Imre Deak
2025-08-28 14:03   ` [PATCH 1/2] drm/i915/hdmi: add debugfs to contorl HDMI bpc Imre Deak
2025-09-01  5:57 ` [PATCH 0/2] drm/i915: control HDMI output bpc Lee Shawn C
2025-09-01  5:57   ` [PATCH 1/2] drm/i915/hdmi: add debugfs to contorl HDMI bpc Lee Shawn C
2025-09-01  5:57   ` [PATCH 2/2] drm/i915: compute pipe bpp from link bandwidth management Lee Shawn C
2025-09-01  8:30 ` ✓ i915.CI.BAT: success for drm/i915/hdmi: add debugfs to contorl HDMI bpc (rev7) Patchwork
2025-09-01 11:12 ` ✓ i915.CI.Full: " Patchwork
2025-09-02 10:55   ` Imre Deak

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=20250808091602.288323-1-shawn.c.lee@intel.com \
    --to=shawn.c.lee@intel.com \
    --cc=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=uma.shankar@intel.com \
    --cc=vidya.srinivas@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;
as well as URLs for NNTP newsgroup(s).