intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Bhanuprakash Modem <bhanuprakash.modem@intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH] drm/i915/display/debugfs: Add connector debugfs for "output_bpc"
Date: Fri, 01 Apr 2022 15:40:43 +0300	[thread overview]
Message-ID: <877d897z90.fsf@intel.com> (raw)
In-Reply-To: <20220329060731.785476-1-bhanuprakash.modem@intel.com>

On Tue, 29 Mar 2022, Bhanuprakash Modem <bhanuprakash.modem@intel.com> wrote:
> This new debugfs will expose the connector's max supported bpc
> and the bpc currently using. It is very useful for verifying
> whether we enter the correct output color depth from IGT.
>
> Example:
> cat /sys/kernel/debug/dri/0/DP-1/output_bpc
> Current: 8
> Maximum: 10
>
> V2: Add connector's max bpc to i915_display_info
>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Uma Shankar <uma.shankar@intel.com>
> Cc: Swati Sharma <swati2.sharma@intel.com>
> Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@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 c1e74a13a0828..694d27f3b109c 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
> @@ -663,6 +663,8 @@ static void intel_connector_info(struct seq_file *m,
>  	seq_puts(m, "\tHDCP version: ");
>  	intel_hdcp_info(m, intel_connector);
>  
> +	seq_printf(m, "\tmax bpc: %u\n", connector->display_info.bpc);
> +
>  	intel_panel_info(m, intel_connector);
>  
>  	seq_printf(m, "\tmodes:\n");
> @@ -2275,6 +2277,47 @@ static const struct file_operations i915_dsc_bpp_fops = {
>  	.write = i915_dsc_bpp_write
>  };
>  
> +/*
> + * Returns the maximum output bpc for the connector.
> + * Example usage: cat /sys/kernel/debug/dri/0/DP-1/output_bpc
> + */
> +static int output_bpc_show(struct seq_file *m, void *data)
> +{
> +	struct drm_connector *connector = m->private;
> +	struct drm_device *dev = connector->dev;
> +	struct drm_crtc *crtc;
> +	struct intel_crtc_state *crtc_state;
> +	struct intel_encoder *encoder = intel_attached_encoder(to_intel_connector(connector));
> +	int res;
> +
> +	if (!encoder)
> +		return -ENODEV;
> +
> +	res = drm_modeset_lock_single_interruptible(&dev->mode_config.connection_mutex);
> +	if (res)
> +		return res;
> +
> +	crtc = connector->state->crtc;
> +	if (connector->status != connector_status_connected || !crtc) {
> +		res = -ENODEV;
> +		goto unlock;
> +	}
> +
> +	crtc_state = to_intel_crtc_state(crtc->state);
> +	if (!crtc_state->hw.active)
> +		goto unlock;
> +
> +	seq_printf(m, "Current: %u\n", crtc_state->pipe_bpp / 3);
> +	seq_printf(m, "Maximum: %u\n", connector->display_info.bpc);
> +	res = 0;
> +
> +unlock:
> +	drm_modeset_unlock(&dev->mode_config.connection_mutex);
> +
> +	return res;
> +}
> +DEFINE_SHOW_ATTRIBUTE(output_bpc);

Looks like an excessive amount of code for a single value.

BR,
Jani.

> +
>  /**
>   * intel_connector_debugfs_add - add i915 specific connector debugfs files
>   * @connector: pointer to a registered drm_connector
> @@ -2330,6 +2373,9 @@ void intel_connector_debugfs_add(struct intel_connector *intel_connector)
>  	    connector->connector_type == DRM_MODE_CONNECTOR_HDMIB)
>  		debugfs_create_file("i915_lpsp_capability", 0444, root,
>  				    connector, &i915_lpsp_capability_fops);
> +
> +	debugfs_create_file("output_bpc", 0444, root,
> +			    connector, &output_bpc_fops);
>  }
>  
>  /**

-- 
Jani Nikula, Intel Open Source Graphics Center

  reply	other threads:[~2022-04-01 12:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-28  7:50 [Intel-gfx] [PATCH] drm/i915/display/debugfs: Add connector debugfs for "output_bpc" Bhanuprakash Modem
2022-03-28  8:07 ` [Intel-gfx] ✗ Fi.CI.DOCS: warning for " Patchwork
2022-03-28  8:22 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-03-28  9:14 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2022-03-29  6:07 ` [Intel-gfx] [PATCH] " Bhanuprakash Modem
2022-04-01 12:40   ` Jani Nikula [this message]
2022-04-04  8:57     ` Modem, Bhanuprakash
2022-04-04 10:46       ` Jani Nikula
2022-04-04 12:06         ` Modem, Bhanuprakash
2022-04-04 15:41         ` Daniel Vetter
2022-04-08 10:36           ` Modem, Bhanuprakash
2022-03-29  6:48 ` [Intel-gfx] ✗ Fi.CI.DOCS: warning for drm/i915/display/debugfs: Add connector debugfs for "output_bpc" (rev2) Patchwork
2022-03-29  7:10 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-03-29  8:25 ` [Intel-gfx] ✓ Fi.CI.IGT: " 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=877d897z90.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=bhanuprakash.modem@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /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).