On Tue, Aug 12, 2014 at 03:55:12PM -0300, Paulo Zanoni wrote:
> From: Paulo Zanoni <paulo.r.zan...@intel.com>
> 
> If we're runtime suspended and try to use the plane interfaces, we
> will get a lot of WARNs saying we did the wrong thing.
> 
> We need to get runtime PM references to pin/unpin the objects, and to
> change the fences. The pin/unpin functions are the ideal places for
> this, but intel_crtc_cursor_set_obj() doesn't call them, so we also
> have to add get/put calls inside it. There is no problem if we runtime
> suspend right after these functions are finished, because the
> registers written are forwarded to system memory.
> 
> Note: for a complete fix of the cursor-dpms test case, we also need
> the patch named "drm/i915: Don't try to enable cursor from setplane
> when crtc is disabled".
> 
> v2: - Narrow the put/get calls on intel_crtc_cursor_set_obj() (Daniel)
> v3: - Make get/put also surround the fence and unpin calls (Daniel and
>       Ville).
>     - Merge all the plane changes into a single patch since they're
>       the same fix.
>     - Add the comment requested by Daniel.
> v4: - Remove spurious whitespace (Ville).
> v5: - Remove intel_crtc_update_cursor() chunk since Ville did an
>       equivalent fix in another patch (Ville).
> 
> Testcase: igt/pm_rpm/cursor
> Testcase: igt/pm_rpm/cursor-dpms
> Testcase: igt/pm_rpm/legacy-planes
> Testcase: igt/pm_rpm/legacy-planes-dpms
> Testcase: igt/pm_rpm/universal-planes
> Testcase: igt/pm_rpm/universal-planes-dpms
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81645
> Cc: sta...@vger.kernel.org
> Signed-off-by: Paulo Zanoni <paulo.r.zan...@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_display.c | 35 ++++++++++++++++++++++++++++++++++-
>  1 file changed, 34 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c 
> b/drivers/gpu/drm/i915/intel_display.c
> index a1cf052..2db9e06 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -2149,6 +2149,15 @@ intel_pin_and_fence_fb_obj(struct drm_device *dev,
>       if (need_vtd_wa(dev) && alignment < 256 * 1024)
>               alignment = 256 * 1024;
>  
> +     /*
> +      * Global gtt pte registers are special registers which actually forward
> +      * writes to a chunk of system memory. Which means that there is no risk
> +      * that the register values disappear as soon as we call
> +      * intel_runtime_pm_put(), so it is correct to wrap only the
> +      * pin/unpin/fence and not more.
> +      */
> +     intel_runtime_pm_get(dev_priv);
> +
>       dev_priv->mm.interruptible = false;
>       ret = i915_gem_object_pin_to_display_plane(obj, alignment, pipelined);
>       if (ret)
> @@ -2166,21 +2175,30 @@ intel_pin_and_fence_fb_obj(struct drm_device *dev,
>       i915_gem_object_pin_fence(obj);
>  
>       dev_priv->mm.interruptible = true;
> +     intel_runtime_pm_put(dev_priv);
>       return 0;
>  
>  err_unpin:
>       i915_gem_object_unpin_from_display_plane(obj);
>  err_interruptible:
>       dev_priv->mm.interruptible = true;
> +     intel_runtime_pm_put(dev_priv);
>       return ret;
>  }
>  
>  void intel_unpin_fb_obj(struct drm_i915_gem_object *obj)
>  {
> -     WARN_ON(!mutex_is_locked(&obj->base.dev->struct_mutex));
> +     struct drm_device *dev = obj->base.dev;
> +     struct drm_i915_private *dev_priv = dev->dev_private;
> +
> +     WARN_ON(!mutex_is_locked(&dev->struct_mutex));
> +
> +     intel_runtime_pm_get(dev_priv);
>  
>       i915_gem_object_unpin_fence(obj);
>       i915_gem_object_unpin_from_display_plane(obj);
> +
> +     intel_runtime_pm_put(dev_priv);
>  }

framebuffer objects are pinned for a very long time, and the fbcon is
permanently pinned. This should have the effect of disabling rpm
entirely.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to