public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Matt Roper <matthew.d.roper@intel.com>
Cc: Thomas Richter <richter@rus.uni-stuttgart.de>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 14/15] drm/i915: Call .update_primary_plane in intel_{enable, disable}_primary_hw_plane()
Date: Fri, 6 Jun 2014 11:40:14 +0300	[thread overview]
Message-ID: <20140606084014.GE27580@intel.com> (raw)
In-Reply-To: <20140606000231.GJ29031@intel.com>

On Thu, Jun 05, 2014 at 05:02:31PM -0700, Matt Roper wrote:
> On Thu, Jun 05, 2014 at 07:16:03PM +0300, ville.syrjala@linux.intel.com wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Make the intel_{enable,disable}_primary_hw_plane() simply call
> > .update_primary_plane(), thus eliminating the rmw from these functions
> > which should help the poor old 830M.
> > 
> > Now we can also remove the .update_primary_plane() from the
> > .crtc_enable() hooks.
> 
> This is because intel_crtc_enable_planes() ->
> intel_enable_primary_hw_plane() takes care of it for us, right?

Yes.

> Can you
> clarify that in the message?  That wasn't immediately obvious from the
> context visible in the diff.

Can do.

> 
> > This also has the nice benefit of making primary planes a bit closer to
> > the way we handle sprite planes during modesets.
> > 
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
> 
> On a somewhat related note, is there any reason not to call
> .update_primary_plane() at the end of the various sprite update
> functions in intel_sprite.c instead of calling
> intel_update_primary_plane() and intel_flush_primary_plane()?  I find
> the name similarity between intel_update_primary_plane() and
> .update_primary_plane() confusing and it looks like we might be able to
> consolidate a bit there unless I'm overlooking something.

I simply decided to leave the sprite code alone for now. Should probably
just call the .update_primary_plane hook there as well. It doesn't seem
too heavy to really compromise the atomic vblank evade thing. Though
at some point we should really start building up the plane_config thing
and then we should be able to minimize the amont of stuff we do in
that section.

> 
> 
> Matt
> 
> > ---
> >  drivers/gpu/drm/i915/intel_display.c | 92 +++++++++++-------------------------
> >  1 file changed, 27 insertions(+), 65 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> > index 74bbab9..098017a 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -2147,63 +2147,51 @@ void intel_flush_primary_plane(struct drm_i915_private *dev_priv,
> >  
> >  /**
> >   * intel_enable_primary_hw_plane - enable the primary plane on a given pipe
> > - * @dev_priv: i915 private structure
> > - * @plane: plane to enable
> > - * @pipe: pipe being fed
> > + * @plane:  plane to be enabled
> > + * @crtc: crtc for the plane
> >   *
> > - * Enable @plane on @pipe, making sure that @pipe is running first.
> > + * Enable @plane on @crtc, making sure that the pipe is running first.
> >   */
> > -static void intel_enable_primary_hw_plane(struct drm_i915_private *dev_priv,
> > -					  enum plane plane, enum pipe pipe)
> > +static void intel_enable_primary_hw_plane(struct drm_plane *plane,
> > +					  struct drm_crtc *crtc)
> >  {
> > -	struct intel_crtc *intel_crtc =
> > -		to_intel_crtc(dev_priv->pipe_to_crtc_mapping[pipe]);
> > -	int reg;
> > -	u32 val;
> > +	struct drm_i915_private *dev_priv = crtc->dev->dev_private;
> > +	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> >  
> >  	/* If the pipe isn't enabled, we can't pump pixels and may hang */
> > -	assert_pipe_enabled(dev_priv, pipe);
> > +	assert_pipe_enabled(dev_priv, intel_crtc->pipe);
> >  
> >  	if (intel_crtc->primary_enabled)
> >  		return;
> >  
> >  	intel_crtc->primary_enabled = true;
> >  
> > -	reg = DSPCNTR(plane);
> > -	val = I915_READ(reg);
> > -	WARN_ON(val & DISPLAY_PLANE_ENABLE);
> > -
> > -	I915_WRITE(reg, val | DISPLAY_PLANE_ENABLE);
> > -	intel_flush_primary_plane(dev_priv, plane);
> > +	dev_priv->display.update_primary_plane(crtc, plane->fb,
> > +					       crtc->x, crtc->y);
> >  }
> >  
> >  /**
> >   * intel_disable_primary_hw_plane - disable the primary hardware plane
> > - * @dev_priv: i915 private structure
> > - * @plane: plane to disable
> > - * @pipe: pipe consuming the data
> > + * @plane: plane to be disabled
> > + * @crtc: crtc for the plane
> >   *
> > - * Disable @plane; should be an independent operation.
> > + * Disable @plane on @crtc, making sure that the pipe is running first.
> >   */
> > -static void intel_disable_primary_hw_plane(struct drm_i915_private *dev_priv,
> > -					   enum plane plane, enum pipe pipe)
> > +static void intel_disable_primary_hw_plane(struct drm_plane *plane,
> > +					   struct drm_crtc *crtc)
> >  {
> > -	struct intel_crtc *intel_crtc =
> > -		to_intel_crtc(dev_priv->pipe_to_crtc_mapping[pipe]);
> > -	int reg;
> > -	u32 val;
> > +	struct drm_i915_private *dev_priv = crtc->dev->dev_private;
> > +	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> > +
> > +	assert_pipe_enabled(dev_priv, intel_crtc->pipe);
> >  
> >  	if (!intel_crtc->primary_enabled)
> >  		return;
> >  
> >  	intel_crtc->primary_enabled = false;
> >  
> > -	reg = DSPCNTR(plane);
> > -	val = I915_READ(reg);
> > -	WARN_ON((val & DISPLAY_PLANE_ENABLE) == 0);
> > -
> > -	I915_WRITE(reg, val & ~DISPLAY_PLANE_ENABLE);
> > -	intel_flush_primary_plane(dev_priv, plane);
> > +	dev_priv->display.update_primary_plane(crtc, plane->fb,
> > +					       crtc->x, crtc->y);
> >  }
> >  
> >  static bool need_vtd_wa(struct drm_device *dev)
> > @@ -3955,11 +3943,10 @@ static void intel_crtc_enable_planes(struct drm_crtc *crtc)
> >  	struct drm_i915_private *dev_priv = dev->dev_private;
> >  	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> >  	int pipe = intel_crtc->pipe;
> > -	int plane = intel_crtc->plane;
> >  
> >  	drm_vblank_on(dev, pipe);
> >  
> > -	intel_enable_primary_hw_plane(dev_priv, plane, pipe);
> > +	intel_enable_primary_hw_plane(crtc->primary, crtc);
> >  	intel_enable_planes(crtc);
> >  	/* The fixup needs to happen before cursor is enabled */
> >  	if (IS_G4X(dev))
> > @@ -3993,7 +3980,7 @@ static void intel_crtc_disable_planes(struct drm_crtc *crtc)
> >  	intel_crtc_dpms_overlay(intel_crtc, false);
> >  	intel_crtc_update_cursor(crtc, false);
> >  	intel_disable_planes(crtc);
> > -	intel_disable_primary_hw_plane(dev_priv, plane, pipe);
> > +	intel_disable_primary_hw_plane(crtc->primary, crtc);
> >  
> >  	drm_vblank_off(dev, pipe);
> >  }
> > @@ -4026,9 +4013,6 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc)
> >  
> >  	ironlake_set_pipeconf(crtc);
> >  
> > -	dev_priv->display.update_primary_plane(crtc, crtc->primary->fb,
> > -					       crtc->x, crtc->y);
> > -
> >  	intel_crtc->active = true;
> >  
> >  	intel_set_cpu_fifo_underrun_reporting(dev, pipe, true);
> > @@ -4133,9 +4117,6 @@ static void haswell_crtc_enable(struct drm_crtc *crtc)
> >  
> >  	intel_set_pipe_csc(crtc);
> >  
> > -	dev_priv->display.update_primary_plane(crtc, crtc->primary->fb,
> > -					       crtc->x, crtc->y);
> > -
> >  	intel_crtc->active = true;
> >  
> >  	intel_set_cpu_fifo_underrun_reporting(dev, pipe, true);
> > @@ -4614,7 +4595,6 @@ static void valleyview_modeset_global_resources(struct drm_device *dev)
> >  static void valleyview_crtc_enable(struct drm_crtc *crtc)
> >  {
> >  	struct drm_device *dev = crtc->dev;
> > -	struct drm_i915_private *dev_priv = dev->dev_private;
> >  	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> >  	struct intel_encoder *encoder;
> >  	int pipe = intel_crtc->pipe;
> > @@ -4634,9 +4614,6 @@ static void valleyview_crtc_enable(struct drm_crtc *crtc)
> >  
> >  	i9xx_set_pipeconf(intel_crtc);
> >  
> > -	dev_priv->display.update_primary_plane(crtc, crtc->primary->fb,
> > -					       crtc->x, crtc->y);
> > -
> >  	intel_crtc->active = true;
> >  
> >  	intel_set_cpu_fifo_underrun_reporting(dev, pipe, true);
> > @@ -4686,7 +4663,6 @@ static void i9xx_set_pll_dividers(struct intel_crtc *crtc)
> >  static void i9xx_crtc_enable(struct drm_crtc *crtc)
> >  {
> >  	struct drm_device *dev = crtc->dev;
> > -	struct drm_i915_private *dev_priv = dev->dev_private;
> >  	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> >  	struct intel_encoder *encoder;
> >  	int pipe = intel_crtc->pipe;
> > @@ -4705,9 +4681,6 @@ static void i9xx_crtc_enable(struct drm_crtc *crtc)
> >  
> >  	i9xx_set_pipeconf(intel_crtc);
> >  
> > -	dev_priv->display.update_primary_plane(crtc, crtc->primary->fb,
> > -					       crtc->x, crtc->y);
> > -
> >  	intel_crtc->active = true;
> >  
> >  	if (!IS_GEN2(dev))
> > @@ -10854,7 +10827,6 @@ static int intel_crtc_set_config(struct drm_mode_set *set)
> >  		ret = intel_set_mode(set->crtc, set->mode,
> >  				     set->x, set->y, set->fb);
> >  	} else if (config->fb_changed) {
> > -		struct drm_i915_private *dev_priv = dev->dev_private;
> >  		struct intel_crtc *intel_crtc = to_intel_crtc(set->crtc);
> >  
> >  		intel_crtc_wait_for_pending_flips(set->crtc);
> > @@ -10868,8 +10840,7 @@ static int intel_crtc_set_config(struct drm_mode_set *set)
> >  		 */
> >  		if (!intel_crtc->primary_enabled && ret == 0) {
> >  			WARN_ON(!intel_crtc->active);
> > -			intel_enable_primary_hw_plane(dev_priv, intel_crtc->plane,
> > -						      intel_crtc->pipe);
> > +			intel_enable_primary_hw_plane(set->crtc->primary, set->crtc);
> >  		}
> >  
> >  		/*
> > @@ -11024,9 +10995,6 @@ static void intel_shared_dpll_init(struct drm_device *dev)
> >  static int
> >  intel_primary_plane_disable(struct drm_plane *plane)
> >  {
> > -	struct drm_device *dev = plane->dev;
> > -	struct drm_i915_private *dev_priv = dev->dev_private;
> > -	struct intel_plane *intel_plane = to_intel_plane(plane);
> >  	struct intel_crtc *intel_crtc;
> >  
> >  	if (!plane->fb)
> > @@ -11049,8 +11017,7 @@ intel_primary_plane_disable(struct drm_plane *plane)
> >  		goto disable_unpin;
> >  
> >  	intel_crtc_wait_for_pending_flips(plane->crtc);
> > -	intel_disable_primary_hw_plane(dev_priv, intel_plane->plane,
> > -				       intel_plane->pipe);
> > +	intel_disable_primary_hw_plane(plane, plane->crtc);
> >  
> >  disable_unpin:
> >  	intel_unpin_fb_obj(to_intel_framebuffer(plane->fb)->obj);
> > @@ -11067,9 +11034,7 @@ intel_primary_plane_setplane(struct drm_plane *plane, struct drm_crtc *crtc,
> >  			     uint32_t src_w, uint32_t src_h)
> >  {
> >  	struct drm_device *dev = crtc->dev;
> > -	struct drm_i915_private *dev_priv = dev->dev_private;
> >  	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> > -	struct intel_plane *intel_plane = to_intel_plane(plane);
> >  	struct drm_rect dest = {
> >  		/* integer pixels */
> >  		.x1 = crtc_x,
> > @@ -11143,9 +11108,7 @@ intel_primary_plane_setplane(struct drm_plane *plane, struct drm_crtc *crtc,
> >  		}
> >  
> >  		if (intel_crtc->primary_enabled)
> > -			intel_disable_primary_hw_plane(dev_priv,
> > -						       intel_plane->plane,
> > -						       intel_plane->pipe);
> > +			intel_disable_primary_hw_plane(plane, crtc);
> >  
> >  
> >  		if (plane->fb != fb)
> > @@ -11160,8 +11123,7 @@ intel_primary_plane_setplane(struct drm_plane *plane, struct drm_crtc *crtc,
> >  		return ret;
> >  
> >  	if (!intel_crtc->primary_enabled)
> > -		intel_enable_primary_hw_plane(dev_priv, intel_crtc->plane,
> > -					      intel_crtc->pipe);
> > +		intel_enable_primary_hw_plane(plane, crtc);
> >  
> >  	return 0;
> >  }
> > -- 
> > 1.8.5.5
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> -- 
> Matt Roper
> Graphics Software Engineer
> IoTG Platform Enabling & Development
> Intel Corporation
> (916) 356-2795

-- 
Ville Syrjälä
Intel OTC

  reply	other threads:[~2014-06-06  8:40 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-05 16:15 [PATCH 00/15] drm/i915: Fix 830M/ns2501 for real, well almost ville.syrjala
2014-06-05 16:15 ` [PATCH 01/15] drm/i915: Use named initializers for gmch wm params ville.syrjala
2014-06-05 20:43   ` Chris Wilson
2014-06-05 21:02     ` Thomas Richter
2014-06-05 21:33     ` Bug reports on 830MG patches (thanks, but more trouble) Thomas Richter
2014-06-06  8:46       ` Ville Syrjälä
2014-06-06 17:24         ` Thomas Richter
2014-06-06 20:08           ` Ville Syrjälä
2014-06-06 21:09             ` Thomas Richter
2014-06-06 21:41               ` Ville Syrjälä
2014-06-08 21:29             ` [PATCH] Check for a min level when computing the watermark Thomas Richter
2014-06-06 16:38     ` [PATCH 01/15] drm/i915: Use named initializers for gmch wm params Daniel Vetter
2014-06-05 16:15 ` [PATCH 02/15] drm/i915: Fix gen2 planes B and C max watermark value ville.syrjala
2014-06-05 16:15 ` [PATCH 03/15] drm/i915: Don't get hw state from DVO chip unless DVO is enabled ville.syrjala
2014-06-06 16:39   ` Daniel Vetter
2014-06-05 16:15 ` [PATCH 04/15] drm/i915: ns2501 is on DVOB ville.syrjala
2014-06-06 16:57   ` Daniel Vetter
2014-06-06 21:46     ` Ville Syrjälä
2014-06-05 16:15 ` [PATCH 05/15] drm/i915: Enable DVO between mode_set and dpms hooks ville.syrjala
2014-06-05 16:15 ` [PATCH 06/15] drm/i915: Don't call DVO mode_set hook on DPMS changes ville.syrjala
2014-06-05 16:15 ` [PATCH 07/15] drm/i915: Kill useless ns2501_dump_regs ville.syrjala
2014-06-05 16:15 ` [PATCH 08/15] drm/i915: Rewrite ns2501 driver a bit ville.syrjala
2014-06-05 16:15 ` [PATCH 09/15] drm/i915: Ignore VBT int_crt_support on 830M ville.syrjala
2014-06-06 17:00   ` Daniel Vetter
2014-06-06 19:44     ` [PATCH v2 " ville.syrjala
2014-06-06 20:13       ` Daniel Vetter
2014-06-07 20:37         ` [Patch] Add minimum watermark level for I830 Thomas Richter
2014-06-06 21:15       ` [PATCH v2 09/15] drm/i915: Ignore VBT int_crt_support on 830M Bob Paauwe
2014-06-06 22:23         ` Daniel Vetter
2014-06-06 22:51           ` Jesse Barnes
     [not found]         ` <2094_1402093395_53923F53_2094_10301_1_CAKMK7uGAnNP4VR9+zXd0KD5v0Vo=XuDS=NhRNFRqHKcae7T4XQ@mail.gmail.com>
2014-06-07 17:32           ` Thomas Richter
2014-10-24 13:23       ` Jani Nikula
2014-10-24 14:11         ` Ville Syrjälä
2014-06-05 16:15 ` [PATCH 10/15] drm/i915: Fix DVO 2x clock enable " ville.syrjala
2014-06-05 16:16 ` [PATCH 11/15] Revert "drm/i915: Nuke pipe A quirk on i830M" ville.syrjala
2014-06-05 16:16 ` [PATCH 12/15] drm/i915: Add pipe B force quirk for 830M ville.syrjala
2014-06-05 16:16 ` [PATCH 13/15] drm/i915: Eliminate rmw from .update_primary_plane() ville.syrjala
2014-06-06  0:02   ` Matt Roper
2014-06-06 19:45   ` [PATCH v2 " ville.syrjala
2014-06-05 16:16 ` [PATCH 14/15] drm/i915: Call .update_primary_plane in intel_{enable, disable}_primary_hw_plane() ville.syrjala
2014-06-06  0:02   ` Matt Roper
2014-06-06  8:40     ` Ville Syrjälä [this message]
2014-06-06 19:46     ` [PATCH v2 " ville.syrjala
2014-06-05 16:16 ` [PATCH 15/15] drm/i915: Check pixel clock in ns2501 mode_valid hook ville.syrjala
2014-06-06 19:47 ` [PATCH 16/15] drm/i915: Pass intel_crtc to intel_disable_pipe() and intel_wait_for_pipe_off() ville.syrjala
2014-06-06 19:47   ` [PATCH 17/15] drm/i915: Disable double wide even when leaving the pipe on ville.syrjala
2014-06-06 22:09     ` [PATCH v2 " ville.syrjala
2014-06-08 23:14       ` Deadlock in intel_enable_pipe_a() Thomas Richter
2014-06-09  6:47         ` [PATCH] drm/i915: Avoid double mutex lock applying pipe A quirk during sanitize_crtc() Chris Wilson
2014-06-09  8:30           ` Ville Syrjälä
2014-06-09  8:50             ` Chris Wilson
     [not found]             ` <28223_1402303866_5395757A_28223_3428_1_20140609085045.GE16767@nuc-i3427.alporthouse.com>
2014-06-09 10:57               ` Partial success - Fixing resume from s2ram on S6010 Thomas Richter
2014-06-09 11:08                 ` Ville Syrjälä
     [not found]                 ` <28223_1402312148_539595D3_28223_4884_1_20140609110857.GM27580@intel.com>
2014-06-09 11:19                   ` Thomas Richter
2014-06-09 11:31                     ` Ville Syrjälä
     [not found]                     ` <2086_1402313568_53959B5F_2086_895_1_20140609113155.GN27580@intel.com>
2014-06-09 12:33                       ` Thomas Richter
2014-06-09 12:57                       ` Thomas Richter
2014-06-09 18:41                       ` Thomas Richter
2014-06-09 19:46                         ` [PATCH] drm/i915: Init important ns2501 registers ville.syrjala
     [not found]                         ` <28223_1402343538_53961072_28223_7661_1_1402343204-28608-1-git-send-email-ville.syrjala@linux.intel.com>
2014-06-09 20:58                           ` Thomas Richter
2014-06-09 22:29                           ` Thomas Richter
2014-06-10 14:04                             ` Ville Syrjälä
     [not found]                             ` <29040_1402409145_539710B9_29040_2220_1_20140610140430.GD27580@intel.com>
2014-06-10 16:38                               ` Thomas Richter
2014-06-18 16:03                       ` i830GM on IBM R31 works with alm_fixes5 repository Thomas Richter
2014-06-10  7:02             ` [PATCH] drm/i915: Avoid double mutex lock applying pipe A quirk during sanitize_crtc() Daniel Vetter
2014-06-10  8:53               ` Ville Syrjälä
2014-06-10  9:22                 ` Daniel Vetter
2014-06-10  6:59           ` Daniel Vetter
2014-06-10  7:13             ` Chris Wilson
2014-06-06 19:47   ` [PATCH 18/15] drm/i915: Preserve VGACNTR bits from the BIOS ville.syrjala

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=20140606084014.GE27580@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=matthew.d.roper@intel.com \
    --cc=richter@rus.uni-stuttgart.de \
    /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