[v2] drm/i915/hdmi: add debugfs to contorl HDMI bpc

Lee, Shawn C shawn.c.lee at intel.com
Mon Aug 11 06:46:55 UTC 2025


On Fri, Aug 08, 2025 at 09:40:00AM +0000, Imre Deak C wrote:
>On Fri, Aug 08, 2025 at 09:16:02AM +0000, Lee Shawn C wrote:
>> 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.
>
>How come this doesn't get reset after a hotplug as you described for the case when the property is used,
>even though both the property and this debug entries use the same state variable? (Not saying that the reset
>happing after a hotplug is a valid justification for a new debugfs entry, the hotplug could be also handled by the user,
>but you could argue the debugfs entry is more convenient.)
>

Hi Imre, thank you for the prompt response.

https://elixir.bootlin.com/linux/v6.16/source/drivers/gpu/drm/i915/display/intel_hdmi.c#L2672
The max_bpc_property and max_bpc values are initialized during connector initialization process.

https://elixir.bootlin.com/linux/v6.16/source/drivers/gpu/drm/drm_atomic.c#L468
The max_bpc will be restored to info->bpc (from EDID) at drm_atomic_connector_check() everytime.

When max_bpc_property is available, this funciton also compares max_bpc with max_requested_bpc
and updates max_bpc to the smaller of the two values.

The i915 display driver then relies on this max_bpc value to determine whether to update the pipe bpp value in compute_sink_pipe_bpp().
Therefore, we can simply update max_requested_bpc to affect pipe bpp output. And no additional driver changes are required.

Best regards,
Shawn

>Have you also considered enabling the force_link_bpp debugfs entry for all HDMI connectors instead?
>
>> Cc: Shankar Uma <uma.shankar at intel.com>
>> Cc: Jani Nikula <jani.nikula at intel.com>
>> Cc: Imre Deak <imre.deak at intel.com>
>> Cc: Vidya Srinivas <vidya.srinivas at intel.com>
>> Signed-off-by: Lee Shawn C <shawn.c.lee at 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
>> 
> 


More information about the Intel-gfx mailing list