public inbox for intel-gfx@lists.freedesktop.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>,
	stable@vger.kernel.org
Subject: Re: [Intel-gfx] [PATCH] drm/i915: fix cursor handling when runtime suspended
Date: Thu, 24 Jul 2014 00:35:25 +0200	[thread overview]
Message-ID: <20140723223525.GH15237@phenom.ffwll.local> (raw)
In-Reply-To: <1406151060-23853-1-git-send-email-przanoni@gmail.com>

On Wed, Jul 23, 2014 at 06:30:59PM -0300, Paulo Zanoni wrote:
> From: Paulo Zanoni <paulo.r.zanoni@intel.com>
> 
> If we're runtime suspended and try to use the cursor interfaces, we
> will get a lot of WARNs saying we did the wrong thing.
> 
> For intel_crtc_update_cursor(), all we need to do is return if the
> CRTC is not active, since writing the registers won't really have any
> effect if the screen is not visible, and we will write the registers
> later when enabling the screen.
> 
> For intel_crtc_cursor_set_obj(), we just get the proper power domain
> reference, since this function does a lot of stuff.
> 
> Testcase: igt/pm_rpm/cursor
> Testcase: igt/pm_rpm/cursor-dpms
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81645
> Cc: stable@vger.kernel.org
> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_display.c | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index d1e9570..c8f36b0 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -8151,6 +8151,9 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
>  	if (base == 0 && intel_crtc->cursor_base == 0)
>  		return;
>  
> +	if (!intel_crtc->active)
> +		return;

Don't we need the same trick in intel_crtc_cursor_set_obj? This gets
called if the cursor object changes (instead of just moving it around).
> +
>  	I915_WRITE(CURPOS(pipe), pos);
>  
>  	if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev) || IS_BROADWELL(dev))
> @@ -8181,6 +8184,8 @@ static int intel_crtc_cursor_set_obj(struct drm_crtc *crtc,
>  	uint32_t addr;
>  	int ret;
>  
> +	intel_display_power_get(dev_priv, POWER_DOMAIN_PIPE(pipe));

This shouldn't be needed - if intel_crtc->active is set, we do hold a
reference to the pipe power domain already. There's no way the pipe would
be able to run otherwise ;-)
-Daniel

> +
>  	/* if we want to turn off the cursor ignore width and height */
>  	if (!obj) {
>  		DRM_DEBUG_KMS("cursor off\n");
> @@ -8195,13 +8200,14 @@ static int intel_crtc_cursor_set_obj(struct drm_crtc *crtc,
>  			(width == 128 && height == 128 && !IS_GEN2(dev)) ||
>  			(width == 256 && height == 256 && !IS_GEN2(dev)))) {
>  		DRM_DEBUG("Cursor dimension not supported\n");
> -		return -EINVAL;
> +		ret = -EINVAL;
> +		goto fail;
>  	}
>  
>  	if (obj->base.size < width * height * 4) {
>  		DRM_DEBUG_KMS("buffer is too small\n");
>  		ret = -ENOMEM;
> -		goto fail;
> +		goto fail_unref;
>  	}
>  
>  	/* we only need to pin inside GTT if cursor is non-phy */
> @@ -8275,13 +8281,16 @@ static int intel_crtc_cursor_set_obj(struct drm_crtc *crtc,
>  
>  	intel_frontbuffer_flip(dev, INTEL_FRONTBUFFER_CURSOR(pipe));
>  
> +	intel_display_power_put(dev_priv, POWER_DOMAIN_PIPE(pipe));
>  	return 0;
>  fail_unpin:
>  	i915_gem_object_unpin_from_display_plane(obj);
>  fail_locked:
>  	mutex_unlock(&dev->struct_mutex);
> -fail:
> +fail_unref:
>  	drm_gem_object_unreference_unlocked(&obj->base);
> +fail:
> +	intel_display_power_put(dev_priv, POWER_DOMAIN_PIPE(pipe));
>  	return ret;
>  }
>  
> -- 
> 2.0.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

  parent reply	other threads:[~2014-07-23 22:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-23 21:30 [PATCH] drm/i915: fix cursor handling when runtime suspended Paulo Zanoni
2014-07-23 21:31 ` [PATCH] tests/pm_rpm: add cursor subtests Paulo Zanoni
2014-07-23 22:35 ` Daniel Vetter [this message]
2014-07-23 22:41   ` [Intel-gfx] [PATCH] drm/i915: fix cursor handling when runtime suspended Daniel Vetter
2014-07-23 23:38     ` Paulo Zanoni
2014-07-24  7:35       ` 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=20140723223525.GH15237@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=paulo.r.zanoni@intel.com \
    --cc=przanoni@gmail.com \
    --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