public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Ander Conselvan de Oliveira <conselvan2@gmail.com>
Cc: intel-gfx@lists.freedesktop.org, stable@vger.kernel.org
Subject: Re: [PATCH v2] drm/i915: Initialize primary plane src/dst coords when reading hw state
Date: Tue, 20 Jan 2015 11:46:57 +0200	[thread overview]
Message-ID: <20150120094657.GD19354@intel.com> (raw)
In-Reply-To: <54BE20E2.6050504@gmail.com>

On Tue, Jan 20, 2015 at 11:33:22AM +0200, Ander Conselvan de Oliveira wrote:
> On 01/20/2015 11:22 AM, Daniel Vetter wrote:
> > On Mon, Jan 19, 2015 at 03:51:47PM +0200, Ander Conselvan de Oliveira wrote:
> >> Otherwise setting the rotation property will cause the primary plane to
> >> be disabled, caused by having a 0x0 initial value.
> >>
> >> v2: Rebase on top of the move to plane helpers.
> >>
> >> Cc: stable@vger.kernel.org
> >> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=87662
> >> Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
> >
> > Testcase: igt/ksm_plane/*-suspend-*
> >
> >> ---
> >>   drivers/gpu/drm/i915/intel_display.c | 19 +++++++++++++++++++
> >>   1 file changed, 19 insertions(+)
> >>
> >> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> >> index 91d8ada..ed70ca7 100644
> >> --- a/drivers/gpu/drm/i915/intel_display.c
> >> +++ b/drivers/gpu/drm/i915/intel_display.c
> >> @@ -13327,6 +13327,23 @@ static bool primary_get_hw_state(struct intel_crtc *crtc)
> >>   	return I915_READ(DSPCNTR(crtc->plane)) & DISPLAY_PLANE_ENABLE;
> >>   }
> >>
> >> +static void primary_update_size(struct intel_crtc *crtc)
> >> +{
> >> +	struct drm_plane_state *state = crtc->base.primary->state;
> >> +
> >> +	if (!crtc->primary_enabled)
> >> +		return;
> >> +
> >> +	state->crtc_x = 0;
> >> +	state->crtc_y = 0;
> >> +	state->crtc_w = crtc->config.pipe_src_w;
> >> +	state->crtc_h = crtc->config.pipe_src_h;
> >> +	state->src_x = 0;
> >> +	state->src_y = 0;
> >> +	state->src_w = crtc->config.pipe_src_w << 16;
> >> +	state->src_h = crtc->config.pipe_src_h << 16;
> >> +}
> >> +
> >>   static void intel_modeset_readout_hw_state(struct drm_device *dev)
> >>   {
> >>   	struct drm_i915_private *dev_priv = dev->dev_private;
> >> @@ -13337,6 +13354,7 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
> >>   	int i;
> >>
> >>   	for_each_intel_crtc(dev, crtc) {
> >> +
> >
> > Spurious hunk.
> >
> >>   		memset(&crtc->config, 0, sizeof(crtc->config));
> >>
> >>   		crtc->config.quirks |= PIPE_CONFIG_QUIRK_INHERITED_MODE;
> >> @@ -13346,6 +13364,7 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
> >>
> >>   		crtc->base.enabled = crtc->active;
> >>   		crtc->primary_enabled = primary_get_hw_state(crtc);
> >> +		primary_update_size(crtc);
> >
> > I think Ville raised a really good point about the fragility of this and
> > restoring plane state correctly. I think conceptually it makes more sense
> > to restore the primary plane state together with the fb in the loop at the
> > end of intel_modeset_init. Would that still work, or is that too late for
> > when we change pipe state when sanititizing crtcs?
> 
> That should work. Actually, Chris sent a patch that did that some time 
> ago, and Ville commented that "[he was] thinking that for now these 
> would be better placed in intel_modeset_readout_hw_state() where we read 
> out the primary plane enabled state as well". [1]
> 
> So just to make it completely clear, does the problem of restoring plane 
> state correctly supersedes Ville's previous comment?

Well, I still think intel_modeset_readout_hw_state() is the right place
for this. We would just need to keep the user state and current state
clearly separated (intel_modeset_readout_hw_state() should not touch the
user state). But if that's too hard to do without massive changes, maybe
we can put it somewhere else in the meantime.

> 
> [1] 
> http://permalink.gmane.org/gmane.comp.freedesktop.xorg.drivers.intel/46466
> 
> Ander
> 
> 
> > -Daniel
> >
> >>
> >>   		DRM_DEBUG_KMS("[CRTC:%d] hw state readout: %s\n",
> >>   			      crtc->base.base.id,
> >> --
> >> 1.9.1
> >>
> >

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-01-20  9:47 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-12 15:36 [PATCH] drm/i915: Initialize primary plane src/dst coords when reading hw state Ander Conselvan de Oliveira
2015-01-12 23:34 ` Daniel Vetter
2015-01-13 11:24   ` Ville Syrjälä
2015-01-13 22:23     ` Daniel Vetter
2015-01-19 13:43       ` [PATCH i-g-t] kms_plane: Add test that suspends/resumes before getting crc Ander Conselvan de Oliveira
2015-01-20  9:35         ` Daniel Vetter
2015-01-13  0:48 ` [PATCH] drm/i915: Initialize primary plane src/dst coords when reading hw state shuang.he
2015-01-13  8:17   ` Jani Nikula
2015-01-13  8:34     ` Ander Conselvan de Oliveira
2015-01-13  8:43       ` He, Shuang
2015-01-19 13:51 ` [PATCH v2] " Ander Conselvan de Oliveira
2015-01-19 23:45   ` shuang.he
2015-01-20  9:22   ` Daniel Vetter
2015-01-20  9:32     ` Ander Conselvan de Oliveira
2015-01-20  9:33     ` Ander Conselvan de Oliveira
2015-01-20  9:46       ` Ville Syrjälä [this message]
2015-01-20  9:56         ` Daniel Vetter

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=20150120094657.GD19354@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=conselvan2@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=stable@vger.kernel.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