diff mbox series

[1/3] drm/debug: Expose connector's max supported bpc via debugfs

Message ID 20220408065350.1485328-2-bhanuprakash.modem@intel.com (mailing list archive)
State New, archived
Headers show
Series Expose max and current bpc via debugfs | expand

Commit Message

Modem, Bhanuprakash April 8, 2022, 6:53 a.m. UTC
It's useful to know the connector's max supported bpc for IGT
testing. Expose it via a debugfs file on the connector "output_bpc".

Example: cat /sys/kernel/debug/dri/0/DP-1/output_bpc

Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
---
 drivers/gpu/drm/drm_debugfs.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

Comments

Harry Wentland April 8, 2022, 3:02 p.m. UTC | #1
On 2022-04-08 02:53, Bhanuprakash Modem wrote:
> It's useful to know the connector's max supported bpc for IGT
> testing. Expose it via a debugfs file on the connector "output_bpc".
> 
> Example: cat /sys/kernel/debug/dri/0/DP-1/output_bpc
> 
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Harry Wentland <harry.wentland@amd.com>
> Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
> ---
>  drivers/gpu/drm/drm_debugfs.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
> index 7f1b82dbaebb..33e5345c6f3e 100644
> --- a/drivers/gpu/drm/drm_debugfs.c
> +++ b/drivers/gpu/drm/drm_debugfs.c
> @@ -395,6 +395,23 @@ static int vrr_range_show(struct seq_file *m, void *data)
>  }
>  DEFINE_SHOW_ATTRIBUTE(vrr_range);
>  
> +/*
> + * Returns Connector's max supported bpc through debugfs file.
> + * Example usage: cat /sys/kernel/debug/dri/0/DP-1/max_bpc

/s/max_bpc/output_bpc

Btw, in amdgpu we have both max_bpc and output_bpc.

Harry

> + */
> +static int output_bpc_show(struct seq_file *m, void *data)
> +{
> +	struct drm_connector *connector = m->private;
> +
> +	if (connector->status != connector_status_connected)
> +		return -ENODEV;
> +
> +	seq_printf(m, "Maximum: %u\n", connector->display_info.bpc);
> +
> +	return 0;
> +}
> +DEFINE_SHOW_ATTRIBUTE(output_bpc);
> +
>  static const struct file_operations drm_edid_fops = {
>  	.owner = THIS_MODULE,
>  	.open = edid_open,
> @@ -437,6 +454,10 @@ void drm_debugfs_connector_add(struct drm_connector *connector)
>  	debugfs_create_file("vrr_range", S_IRUGO, root, connector,
>  			    &vrr_range_fops);
>  
> +	/* max bpc */
> +	debugfs_create_file("output_bpc", 0444, root, connector,
> +			    &output_bpc_fops);
> +
>  	if (connector->funcs->debugfs_init)
>  		connector->funcs->debugfs_init(connector, root);
>  }
Modem, Bhanuprakash April 8, 2022, 3:25 p.m. UTC | #2
On Fri-08-04-2022 08:32 pm, Harry Wentland wrote:
> 
> 
> On 2022-04-08 02:53, Bhanuprakash Modem wrote:
>> It's useful to know the connector's max supported bpc for IGT
>> testing. Expose it via a debugfs file on the connector "output_bpc".
>>
>> Example: cat /sys/kernel/debug/dri/0/DP-1/output_bpc
>>
>> Cc: Jani Nikula <jani.nikula@linux.intel.com>
>> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
>> Cc: Harry Wentland <harry.wentland@amd.com>
>> Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
>> ---
>>   drivers/gpu/drm/drm_debugfs.c | 21 +++++++++++++++++++++
>>   1 file changed, 21 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
>> index 7f1b82dbaebb..33e5345c6f3e 100644
>> --- a/drivers/gpu/drm/drm_debugfs.c
>> +++ b/drivers/gpu/drm/drm_debugfs.c
>> @@ -395,6 +395,23 @@ static int vrr_range_show(struct seq_file *m, void *data)
>>   }
>>   DEFINE_SHOW_ATTRIBUTE(vrr_range);
>>   
>> +/*
>> + * Returns Connector's max supported bpc through debugfs file.
>> + * Example usage: cat /sys/kernel/debug/dri/0/DP-1/max_bpc
> 
> /s/max_bpc/output_bpc
> 
> Btw, in amdgpu we have both max_bpc and output_bpc.

I'll float a new rev, Thanks.

- Bhanu

> 
> Harry
> 
>> + */
>> +static int output_bpc_show(struct seq_file *m, void *data)
>> +{
>> +	struct drm_connector *connector = m->private;
>> +
>> +	if (connector->status != connector_status_connected)
>> +		return -ENODEV;
>> +
>> +	seq_printf(m, "Maximum: %u\n", connector->display_info.bpc);
>> +
>> +	return 0;
>> +}
>> +DEFINE_SHOW_ATTRIBUTE(output_bpc);
>> +
>>   static const struct file_operations drm_edid_fops = {
>>   	.owner = THIS_MODULE,
>>   	.open = edid_open,
>> @@ -437,6 +454,10 @@ void drm_debugfs_connector_add(struct drm_connector *connector)
>>   	debugfs_create_file("vrr_range", S_IRUGO, root, connector,
>>   			    &vrr_range_fops);
>>   
>> +	/* max bpc */
>> +	debugfs_create_file("output_bpc", 0444, root, connector,
>> +			    &output_bpc_fops);
>> +
>>   	if (connector->funcs->debugfs_init)
>>   		connector->funcs->debugfs_init(connector, root);
>>   }
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
index 7f1b82dbaebb..33e5345c6f3e 100644
--- a/drivers/gpu/drm/drm_debugfs.c
+++ b/drivers/gpu/drm/drm_debugfs.c
@@ -395,6 +395,23 @@  static int vrr_range_show(struct seq_file *m, void *data)
 }
 DEFINE_SHOW_ATTRIBUTE(vrr_range);
 
+/*
+ * Returns Connector's max supported bpc through debugfs file.
+ * Example usage: cat /sys/kernel/debug/dri/0/DP-1/max_bpc
+ */
+static int output_bpc_show(struct seq_file *m, void *data)
+{
+	struct drm_connector *connector = m->private;
+
+	if (connector->status != connector_status_connected)
+		return -ENODEV;
+
+	seq_printf(m, "Maximum: %u\n", connector->display_info.bpc);
+
+	return 0;
+}
+DEFINE_SHOW_ATTRIBUTE(output_bpc);
+
 static const struct file_operations drm_edid_fops = {
 	.owner = THIS_MODULE,
 	.open = edid_open,
@@ -437,6 +454,10 @@  void drm_debugfs_connector_add(struct drm_connector *connector)
 	debugfs_create_file("vrr_range", S_IRUGO, root, connector,
 			    &vrr_range_fops);
 
+	/* max bpc */
+	debugfs_create_file("output_bpc", 0444, root, connector,
+			    &output_bpc_fops);
+
 	if (connector->funcs->debugfs_init)
 		connector->funcs->debugfs_init(connector, root);
 }