From: Daniel Vetter <daniel@ffwll.ch>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 3/3] drm/i915: Boost GPU frequency if we detect outstanding pageflips
Date: Tue, 17 Jun 2014 23:16:24 +0200 [thread overview]
Message-ID: <20140617211623.GS5821@phenom.ffwll.local> (raw)
In-Reply-To: <1402404416-12127-3-git-send-email-chris@chris-wilson.co.uk>
On Tue, Jun 10, 2014 at 01:46:56PM +0100, Chris Wilson wrote:
> If we hit a vblank and see that have a pageflip queue but not yet
> processed, ensure that the GPU is running at maximum in order to clear
> the backlog. Pageflips are only queued for the following vblank, if we
> miss it, there will be a visible stutter. Boosting the GPU frequency
> doesn't prevent us from missing the target vblank, but it should help
> the subsequent frames hitting theirs.
>
> v2: Reorder vblank vs flip-complete so that we only check for a missed
> flip after processing the completion events, and avoid spurious boosts.
>
> v3: Rename missed_vblank
> v4: Rebase
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Found one more: boost_work never gets cancelled. Probably not want we
want. I guess the best place is in the gt powersave suspend function, since
at that point interrupts are no more.
First patch from this series is merged now.
-Daniel
> ---
> drivers/gpu/drm/i915/i915_drv.h | 1 +
> drivers/gpu/drm/i915/intel_display.c | 6 ++++++
> drivers/gpu/drm/i915/intel_drv.h | 1 +
> drivers/gpu/drm/i915/intel_pm.c | 15 +++++++++++++++
> 4 files changed, 23 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 10dd80a12658..33ed0c6b8a9c 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -910,6 +910,7 @@ struct intel_gen6_power_mgmt {
>
> bool enabled;
> struct delayed_work delayed_resume_work;
> + struct work_struct boost_work;
>
> /*
> * Protects RPS/RC6 register access and PCU communication.
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 5261c145e633..89a4d01fefb4 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -9326,6 +9326,7 @@ void intel_check_page_flip(struct drm_device *dev, int pipe)
> struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe];
> struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> unsigned long flags;
> + bool missed_vblank;
>
> if (crtc == NULL)
> return;
> @@ -9336,7 +9337,12 @@ void intel_check_page_flip(struct drm_device *dev, int pipe)
> intel_crtc->unpin_work->flip_queued_vblank, drm_vblank_count(dev, pipe));
> page_flip_completed(intel_crtc);
> }
> + missed_vblank = (intel_crtc->unpin_work != NULL &&
> + drm_vblank_count(dev, pipe) - intel_crtc->unpin_work->flip_queued_vblank > 1);
> spin_unlock_irqrestore(&dev->event_lock, flags);
> +
> + if (missed_vblank)
> + intel_queue_rps_boost(dev);
> }
>
> static int intel_crtc_page_flip(struct drm_crtc *crtc,
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 10665716eb10..2e3c65812e72 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -969,6 +969,7 @@ void ironlake_teardown_rc6(struct drm_device *dev);
> void gen6_update_ring_freq(struct drm_device *dev);
> void gen6_rps_idle(struct drm_i915_private *dev_priv);
> void gen6_rps_boost(struct drm_i915_private *dev_priv);
> +void intel_queue_rps_boost(struct drm_device *dev);
> void intel_aux_display_runtime_get(struct drm_i915_private *dev_priv);
> void intel_aux_display_runtime_put(struct drm_i915_private *dev_priv);
> void intel_runtime_pm_get(struct drm_i915_private *dev_priv);
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index b06f896740b5..ab760e5abc9a 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -6722,6 +6722,19 @@ int vlv_freq_opcode(struct drm_i915_private *dev_priv, int val)
> return DIV_ROUND_CLOSEST(4 * mul * val, dev_priv->mem_freq) + 0xbd - 6;
> }
>
> +static void __intel_rps_boost_work(struct work_struct *work)
> +{
> + gen6_rps_boost(container_of(work, struct drm_i915_private, rps.boost_work));
> +}
> +
> +void intel_queue_rps_boost(struct drm_device *dev)
> +{
> + struct drm_i915_private *dev_priv = to_i915(dev);
> +
> + if (INTEL_INFO(dev)->gen >= 6)
> + queue_work(dev_priv->wq, &dev_priv->rps.boost_work);
> +}
> +
> void intel_pm_setup(struct drm_device *dev)
> {
> struct drm_i915_private *dev_priv = dev->dev_private;
> @@ -6730,6 +6743,8 @@ void intel_pm_setup(struct drm_device *dev)
>
> INIT_DELAYED_WORK(&dev_priv->rps.delayed_resume_work,
> intel_gen6_powersave_work);
> + INIT_WORK(&dev_priv->rps.boost_work,
> + __intel_rps_boost_work);
>
> dev_priv->pm.suspended = false;
> dev_priv->pm.irqs_disabled = false;
> --
> 2.0.0
>
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
next prev parent reply other threads:[~2014-06-17 21:16 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-10 12:46 [PATCH 1/3] drm/i915: Check for a stalled page flip after each vblank Chris Wilson
2014-06-10 12:46 ` [PATCH 2/3] drm/i915: Decouple the stuck pageflip on modeset Chris Wilson
2014-06-17 21:33 ` Daniel Vetter
2014-06-10 12:46 ` [PATCH 3/3] drm/i915: Boost GPU frequency if we detect outstanding pageflips Chris Wilson
2014-06-17 21:16 ` Daniel Vetter [this message]
2014-06-10 13:46 ` [PATCH 1/3] drm/i915: Check for a stalled page flip after each vblank Ville Syrjälä
2014-06-11 10:47 ` [PATCH] " Chris Wilson
2014-06-24 12:44 ` Jani Nikula
2014-06-24 12:46 ` Chris Wilson
-- strict thread matches above, loose matches on Subject: below --
2014-06-10 10:04 [PATCH 1/3] " Chris Wilson
2014-06-10 10:04 ` [PATCH 3/3] drm/i915: Boost GPU frequency if we detect outstanding pageflips Chris Wilson
2014-06-10 11:41 ` Ville Syrjälä
2014-06-10 11:49 ` Chris Wilson
2014-06-10 12:32 ` Ville Syrjälä
2014-05-30 16:16 [PATCH 1/3] drm/i915: Check for a stalled page flip after each vblank Chris Wilson
2014-05-30 16:16 ` [PATCH 3/3] drm/i915: Boost GPU frequency if we detect outstanding pageflips Chris Wilson
2014-06-02 8:53 ` Daniel Vetter
2014-06-02 11:29 ` Chris Wilson
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=20140617211623.GS5821@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=chris@chris-wilson.co.uk \
--cc=daniel.vetter@ffwll.ch \
--cc=intel-gfx@lists.freedesktop.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 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.