All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Paulo Zanoni <przanoni@gmail.com>
Cc: intel-gfx@lists.freedesktop.org, Paulo Zanoni <paulo.r.zanoni@intel.com>
Subject: Re: [PATCH 14/14] drm/i915: make sure HDMI port is disabled inside set_infoframes
Date: Wed, 30 May 2012 14:15:11 +0200	[thread overview]
Message-ID: <20120530121511.GF6888@phenom.ffwll.local> (raw)
In-Reply-To: <1338234182-5021-15-git-send-email-przanoni@gmail.com>

On Mon, May 28, 2012 at 04:43:01PM -0300, Paulo Zanoni wrote:
> From: Paulo Zanoni <paulo.r.zanoni@intel.com>
> 
> This function is supposed to be used at mode set time, so prevent
> against future mistakes by adding a WARN().
> 
> Problems when calling it when the HDMI port is enabled:
>   - It may disable sending DIPs (on IVB and older), and the register
>     specification says we shouldn't disable DIPs with the HDMI port
>     enabled.
>   - It does not wait for the VSync because the pipe is disabled at
>     mode set.
> 
> The second condition can be fixed with some additional code, but the
> first one is not so easy... Ideally, code changing the infoframes
> outside of the mode set should wait for the VSync and then directly
> call the write_infoframe functions.
> 
> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>

Can't we extract this into a little assert_hdmi_port_disabled(dev_priv,
reg) like we have with e.g. assert_pch_hdmi_disabled? Difference would be
that we don't check for the pipe here ... Imo that would make the code
slight less verbose and the intention behind the check a bit clearer.
-Daniel

> ---
>  drivers/gpu/drm/i915/intel_hdmi.c |   15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index f61af21..6fda359 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -334,6 +334,9 @@ static void g4x_set_infoframes(struct drm_encoder *encoder,
>  	u32 val = I915_READ(reg);
>  	u32 port;
>  
> +	WARN(I915_READ(intel_hdmi->hdmi_reg) & SDVO_ENABLE,
> +	     "Calling set_infoframes with HDMI port enabled");
> +
>  	/* If the registers were not initialized yet, they might be zeroes,
>  	 * which means we're selecting the AVI DIP and we're setting its
>  	 * frequency to once. This seems to really confuse the HW and make
> @@ -395,6 +398,9 @@ static void ibx_set_infoframes(struct drm_encoder *encoder,
>  	u32 val = I915_READ(reg);
>  	u32 port;
>  
> +	WARN(I915_READ(intel_hdmi->hdmi_reg) & SDVO_ENABLE,
> +	     "Calling set_infoframes with HDMI port enabled");
> +
>  	/* See the big comment in g4x_set_infoframes() */
>  	val |= VIDEO_DIP_SELECT_AVI | VIDEO_DIP_FREQ_VSYNC;
>  
> @@ -451,6 +457,9 @@ static void cpt_set_infoframes(struct drm_encoder *encoder,
>  	u32 reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
>  	u32 val = I915_READ(reg);
>  
> +	WARN(I915_READ(intel_hdmi->hdmi_reg) & SDVO_ENABLE,
> +	     "Calling set_infoframes with HDMI port enabled");
> +
>  	/* See the big comment in g4x_set_infoframes() */
>  	val |= VIDEO_DIP_SELECT_AVI | VIDEO_DIP_FREQ_VSYNC;
>  
> @@ -484,6 +493,9 @@ static void vlv_set_infoframes(struct drm_encoder *encoder,
>  	u32 reg = VLV_TVIDEO_DIP_CTL(intel_crtc->pipe);
>  	u32 val = I915_READ(reg);
>  
> +	WARN(I915_READ(intel_hdmi->hdmi_reg) & SDVO_ENABLE,
> +	     "Calling set_infoframes with HDMI port enabled");
> +
>  	/* See the big comment in g4x_set_infoframes() */
>  	val |= VIDEO_DIP_SELECT_AVI | VIDEO_DIP_FREQ_VSYNC;
>  
> @@ -516,6 +528,9 @@ static void hsw_set_infoframes(struct drm_encoder *encoder,
>  	u32 reg = HSW_TVIDEO_DIP_CTL(intel_crtc->pipe);
>  	u32 val = I915_READ(reg);
>  
> +	WARN(I915_READ(intel_hdmi->hdmi_reg) & DDI_BUF_CTL_ENABLE,
> +	     "Calling set_infoframes with HDMI port enabled");
> +
>  	if (!intel_hdmi->has_hdmi_sink) {
>  		I915_WRITE(reg, 0);
>  		POSTING_READ(reg);
> -- 
> 1.7.10
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Mail: daniel@ffwll.ch
Mobile: +41 (0)79 365 57 48

      reply	other threads:[~2012-05-30 12:13 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-28 19:42 [PATCH 00/14] More HDMI fixes V2 Paulo Zanoni
2012-05-28 19:42 ` [PATCH 01/14] drm/i915: add set_infoframes to struct intel_hdmi Paulo Zanoni
2012-05-28 19:42 ` [PATCH 02/14] drm/i915: properly alternate between DVI and HDMI Paulo Zanoni
2012-05-28 19:53   ` Chris Wilson
2012-05-28 20:04     ` Paulo Zanoni
2012-05-28 19:42 ` [PATCH 03/14] drm/i915: only set the HDMI port on the DIP once Paulo Zanoni
2012-05-28 19:42 ` [PATCH 04/14] drm/i915: enable DIP before enabling each InfoFrame Paulo Zanoni
2012-05-28 19:42 ` [PATCH 05/14] drm/i915: don't wait for vblank while writing InfoFrames Paulo Zanoni
2012-05-28 19:42 ` [PATCH 06/14] drm/i915: explicitly disable the DIPs we're not using Paulo Zanoni
2012-05-28 19:42 ` [PATCH 07/14] drm/i915: disable DIP while changing the port Paulo Zanoni
2012-05-28 19:42 ` [PATCH 08/14] drm/i915: don't write 0 to DIP control at HDMI init Paulo Zanoni
2012-05-28 19:42 ` [PATCH 09/14] drm/i915: don't set SDVO_BORDER_ENABLE when we're HDMI Paulo Zanoni
2012-05-28 19:42 ` [PATCH 10/14] drm/i915: rename sdvox_reg to hdmi_reg on HDMI context Paulo Zanoni
2012-05-28 19:42 ` [PATCH 11/14] drm/i915: remove comment about HSW HDMI DIPs Paulo Zanoni
2012-05-28 19:42 ` [PATCH 12/14] drm/i915: clarify confusion between HDMI and SDVO registers Paulo Zanoni
2012-05-28 19:43 ` [PATCH 13/14] drm/i915: add some barriers when changing DIPs Paulo Zanoni
2012-05-30 21:08   ` Daniel Vetter
2012-05-28 19:43 ` [PATCH 14/14] drm/i915: make sure HDMI port is disabled inside set_infoframes Paulo Zanoni
2012-05-30 12:15   ` Daniel Vetter [this message]

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=20120530121511.GF6888@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=paulo.r.zanoni@intel.com \
    --cc=przanoni@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.