All of lore.kernel.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Daniel Vetter <daniel.vetter@intel.com>,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	DRI Development <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH 2/4] drm/i915: Drop pipe_enable checks in vblank funcs
Date: Fri, 13 Feb 2015 00:37:27 +0200	[thread overview]
Message-ID: <1423780647.3277.18.camel@ideak-mobl> (raw)
In-Reply-To: <1422959414-18968-2-git-send-email-daniel.vetter@ffwll.ch>

On Tue, 2015-02-03 at 11:30 +0100, Daniel Vetter wrote:
> With Ville's rework to use drm_crtc_vblank_on/off the core will take
> care of rejecting drm_vblank_get calls when the pipe is off. Also the
> core won't call the get_vblank_counter hooks in that case either. And
> since we've dropped ums support recently we can now remove these
> hacks, yay!
> 
> Noticed while trying to answer questions Laurent had about how the new
> atomic helpers work.
> 
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_irq.c | 52 -----------------------------------------
>  1 file changed, 52 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index 23bfe2232b6a..80f35dcffea4 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -492,31 +492,6 @@ static void i915_enable_asle_pipestat(struct drm_device *dev)
>  	spin_unlock_irq(&dev_priv->irq_lock);
>  }
>  
> -/**
> - * i915_pipe_enabled - check if a pipe is enabled
> - * @dev: DRM device
> - * @pipe: pipe to check
> - *
> - * Reading certain registers when the pipe is disabled can hang the chip.
> - * Use this routine to make sure the PLL is running and the pipe is active
> - * before reading such registers if unsure.
> - */
> -static int
> -i915_pipe_enabled(struct drm_device *dev, int pipe)
> -{
> -	struct drm_i915_private *dev_priv = dev->dev_private;
> -
> -	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
> -		/* Locking is horribly broken here, but whatever. */
> -		struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe];
> -		struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> -
> -		return intel_crtc->active;
> -	} else {
> -		return I915_READ(PIPECONF(pipe)) & PIPECONF_ENABLE;
> -	}
> -}
> -
>  /*
>   * This timing diagram depicts the video signal in and
>   * around the vertical blanking period.
> @@ -583,12 +558,6 @@ static u32 i915_get_vblank_counter(struct drm_device *dev, int pipe)
>  	unsigned long low_frame;
>  	u32 high1, high2, low, pixel, vbl_start, hsync_start, htotal;
>  
> -	if (!i915_pipe_enabled(dev, pipe)) {
> -		DRM_DEBUG_DRIVER("trying to get vblank count for disabled "
> -				"pipe %c\n", pipe_name(pipe));
> -		return 0;
> -	}

Wouldn't it make sense to still keep these as an assert (by throwing
away the !MODESET part in i915_pipe_enabled). To me it seems we could
still get here with the pipe disabled at least via drm_irq_uninstall().

> -
>  	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
>  		struct intel_crtc *intel_crtc =
>  			to_intel_crtc(dev_priv->pipe_to_crtc_mapping[pipe]);
> @@ -648,12 +617,6 @@ static u32 gm45_get_vblank_counter(struct drm_device *dev, int pipe)
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	int reg = PIPE_FRMCOUNT_GM45(pipe);
>  
> -	if (!i915_pipe_enabled(dev, pipe)) {
> -		DRM_DEBUG_DRIVER("trying to get vblank count for disabled "
> -				 "pipe %c\n", pipe_name(pipe));
> -		return 0;
> -	}
> -
>  	return I915_READ(reg);
>  }
>  
> @@ -2660,9 +2623,6 @@ static int i915_enable_vblank(struct drm_device *dev, int pipe)
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	unsigned long irqflags;
>  
> -	if (!i915_pipe_enabled(dev, pipe))
> -		return -EINVAL;
> -
>  	spin_lock_irqsave(&dev_priv->irq_lock, irqflags);
>  	if (INTEL_INFO(dev)->gen >= 4)
>  		i915_enable_pipestat(dev_priv, pipe,
> @@ -2682,9 +2642,6 @@ static int ironlake_enable_vblank(struct drm_device *dev, int pipe)
>  	uint32_t bit = (INTEL_INFO(dev)->gen >= 7) ? DE_PIPE_VBLANK_IVB(pipe) :
>  						     DE_PIPE_VBLANK(pipe);
>  
> -	if (!i915_pipe_enabled(dev, pipe))
> -		return -EINVAL;
> -
>  	spin_lock_irqsave(&dev_priv->irq_lock, irqflags);
>  	ironlake_enable_display_irq(dev_priv, bit);
>  	spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags);
> @@ -2697,9 +2654,6 @@ static int valleyview_enable_vblank(struct drm_device *dev, int pipe)
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	unsigned long irqflags;
>  
> -	if (!i915_pipe_enabled(dev, pipe))
> -		return -EINVAL;
> -
>  	spin_lock_irqsave(&dev_priv->irq_lock, irqflags);
>  	i915_enable_pipestat(dev_priv, pipe,
>  			     PIPE_START_VBLANK_INTERRUPT_STATUS);
> @@ -2713,9 +2667,6 @@ static int gen8_enable_vblank(struct drm_device *dev, int pipe)
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	unsigned long irqflags;
>  
> -	if (!i915_pipe_enabled(dev, pipe))
> -		return -EINVAL;
> -
>  	spin_lock_irqsave(&dev_priv->irq_lock, irqflags);
>  	dev_priv->de_irq_mask[pipe] &= ~GEN8_PIPE_VBLANK;
>  	I915_WRITE(GEN8_DE_PIPE_IMR(pipe), dev_priv->de_irq_mask[pipe]);
> @@ -2767,9 +2718,6 @@ static void gen8_disable_vblank(struct drm_device *dev, int pipe)
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	unsigned long irqflags;
>  
> -	if (!i915_pipe_enabled(dev, pipe))
> -		return;
> -
>  	spin_lock_irqsave(&dev_priv->irq_lock, irqflags);
>  	dev_priv->de_irq_mask[pipe] |= GEN8_PIPE_VBLANK;
>  	I915_WRITE(GEN8_DE_PIPE_IMR(pipe), dev_priv->de_irq_mask[pipe]);


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2015-02-12 22:37 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-03 10:30 [PATCH 1/4] drm/irq: Add drm_crtc_vblank_reset Daniel Vetter
2015-02-03 10:30 ` [PATCH 2/4] drm/i915: Drop pipe_enable checks in vblank funcs Daniel Vetter
2015-02-12 22:37   ` Imre Deak [this message]
2015-02-13  7:39     ` Daniel Vetter
2015-02-03 10:30 ` [PATCH 3/4] drm/i915: Flatten DRIVER_MODESET checks in i915_irq.c Daniel Vetter
2015-02-12 22:38   ` Imre Deak
2015-02-19 12:25     ` Dave Gordon
2015-02-19 13:39       ` Imre Deak
2015-02-19 13:42         ` Imre Deak
2015-02-23 11:32           ` [Intel-gfx] " Imre Deak
2015-02-03 10:30 ` [PATCH 4/4] drm/i915: Switch to drm_crtc variants of vblank functions Daniel Vetter
2015-02-12 22:57   ` Imre Deak
2015-02-13  7:46     ` [Intel-gfx] " Daniel Vetter
2015-02-03 11:31 ` [PATCH 1/4] drm/irq: Add drm_crtc_vblank_reset Laurent Pinchart
2015-02-03 11:53   ` Daniel Vetter
2015-02-04  9:31 ` [Intel-gfx] " Ville Syrjälä
2015-02-12 21:56 ` Imre Deak
2015-02-13  7:44   ` Daniel Vetter
2015-02-13 11:35     ` Imre Deak

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=1423780647.3277.18.camel@ideak-mobl \
    --to=imre.deak@intel.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=laurent.pinchart@ideasonboard.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.