intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2 1/9] drm/i915: Dump 'output_types' in crtc state dump
Date: Wed, 11 Oct 2017 22:50:10 +0300	[thread overview]
Message-ID: <87shepo45p.fsf@intel.com> (raw)
In-Reply-To: <20171010121207.570-2-ville.syrjala@linux.intel.com>

On Tue, 10 Oct 2017, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> To make it easier to debug things let's dump the output types bitmask in
> the crtc state dump. And to make life that much better, let's pretty
> print it as a a human reaadable string as well.
>
> v2: Have the caller pass in the buffer (Chris)
>     #undef OUTPUT_TYPE (Jani)
>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_display.c | 51 ++++++++++++++++++++++++++++++++++++
>  1 file changed, 51 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 45d6e57fbe89..4938c23a3fc1 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -10674,6 +10674,52 @@ intel_dump_m_n_config(struct intel_crtc_state *pipe_config, char *id,
>  		      m_n->link_m, m_n->link_n, m_n->tu);
>  }
>  
> +#define OUTPUT_TYPE(x) [INTEL_OUTPUT_ ## x] = #x
> +
> +static const char * const output_type_str[] = {
> +	OUTPUT_TYPE(UNUSED),
> +	OUTPUT_TYPE(ANALOG),
> +	OUTPUT_TYPE(DVO),
> +	OUTPUT_TYPE(SDVO),
> +	OUTPUT_TYPE(LVDS),
> +	OUTPUT_TYPE(TVOUT),
> +	OUTPUT_TYPE(HDMI),
> +	OUTPUT_TYPE(DP),
> +	OUTPUT_TYPE(EDP),
> +	OUTPUT_TYPE(DSI),
> +	OUTPUT_TYPE(UNKNOWN),
> +	OUTPUT_TYPE(DP_MST),
> +};
> +
> +#undef OUTPUT_TYPE
> +
> +static void snprintf_output_types(char *buf, size_t len,
> +				  unsigned int output_types)
> +{
> +	char *str = buf;
> +	int i;
> +
> +	str[0] = '\0';
> +
> +	for (i = 0; i < ARRAY_SIZE(output_type_str); i++) {
> +		int r;
> +
> +		if ((output_types & BIT(i)) == 0)
> +			continue;
> +
> +		r = snprintf(str, len, "%s%s",
> +			     str != buf ? "," : "", output_type_str[i]);
> +		if (r >= len)
> +			break;
> +		str += r;
> +		len -= r;

Ugh, what a minefield this is, but AFAICT you avoided them all.

Reviewed-by: Jani Nikula <jani.nikula@intel.com>


> +
> +		output_types &= ~BIT(i);
> +	}
> +
> +	WARN_ON_ONCE(output_types != 0);
> +}
> +
>  static void intel_dump_pipe_config(struct intel_crtc *crtc,
>  				   struct intel_crtc_state *pipe_config,
>  				   const char *context)
> @@ -10684,10 +10730,15 @@ static void intel_dump_pipe_config(struct intel_crtc *crtc,
>  	struct intel_plane *intel_plane;
>  	struct intel_plane_state *state;
>  	struct drm_framebuffer *fb;
> +	char buf[64];
>  
>  	DRM_DEBUG_KMS("[CRTC:%d:%s]%s\n",
>  		      crtc->base.base.id, crtc->base.name, context);
>  
> +	snprintf_output_types(buf, sizeof(buf), pipe_config->output_types);
> +	DRM_DEBUG_KMS("output_types: %s (0x%x)\n",
> +		      buf, pipe_config->output_types);
> +
>  	DRM_DEBUG_KMS("cpu_transcoder: %s, pipe bpp: %i, dithering: %i\n",
>  		      transcoder_name(pipe_config->cpu_transcoder),
>  		      pipe_config->pipe_bpp, pipe_config->dither);

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2017-10-11 19:50 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-10 12:11 [PATCH v2 0/9] drm/i915: Cleaner DDI DP vs. HDMI split Ville Syrjala
2017-10-10 12:11 ` [PATCH v2 1/9] drm/i915: Dump 'output_types' in crtc state dump Ville Syrjala
2017-10-11 19:50   ` Jani Nikula [this message]
2017-10-10 12:12 ` [PATCH v2 2/9] drm/i915: Extract intel_ddi_clk_disable() Ville Syrjala
2017-10-11 19:52   ` Jani Nikula
2017-10-10 12:12 ` [PATCH v2 3/9] drm/i915: Extract intel_disable_ddi_buf() Ville Syrjala
2017-10-11 19:53   ` Jani Nikula
2017-10-10 12:12 ` [PATCH 4/9] drm/i915: Inline the required bits of intel_ddi_post_disable() into intel_ddi_fdi_post_disable() Ville Syrjala
2017-10-10 12:12 ` [PATCH v2 5/9] drm/i915: Split intel_ddi_post_disable() into DP vs. HDMI variants Ville Syrjala
2017-10-10 12:12 ` [PATCH 6/9] drm/i915: Remove useless eDP check from intel_ddi_pre_enable_dp() Ville Syrjala
2017-10-10 12:12 ` [PATCH 7/9] drm/i915: Split intel_disable_ddi() into DP vs. HDMI variants Ville Syrjala
2017-10-11 20:03   ` Jani Nikula
2017-10-12  9:49     ` Ville Syrjälä
2017-10-13 14:13       ` Jani Nikula
2017-10-10 12:12 ` [PATCH v2 8/9] drm/i915: Plumb crtc_state etc. directly to intel_ddi_pre_enable_{dp, hdmi}() Ville Syrjala
2017-10-13 14:25   ` Jani Nikula
2017-10-10 12:12 ` [PATCH v2 9/9] drm/i915: Split intel_enable_ddi() into DP and HDMI variants Ville Syrjala
2017-10-11 20:06   ` Jani Nikula
2017-10-13 14:20     ` Jani Nikula
2017-10-13 18:10       ` Ville Syrjälä
2017-10-10 13:07 ` ✗ Fi.CI.BAT: warning for drm/i915: Cleaner DDI DP vs. HDMI split Patchwork
2017-10-10 13:21   ` Ville Syrjälä
2017-10-13 17:03 ` ✓ Fi.CI.BAT: success " Patchwork
2017-10-13 18:16   ` Ville Syrjälä
2017-10-13 18:49     ` Jani Nikula
2017-10-14  0:10 ` ✗ Fi.CI.IGT: failure " 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=87shepo45p.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.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).