From 112280ac8fb4be183e4ccc7ea1a3b0ac88ffd03c Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 8 Sep 2010 16:30:16 +0100 Subject: [PATCH 2/2] RFC: drm/i915: Drop fb pin on DPMS_OFF In order to handle disable_functions() where the fb is decoupled from the crtc we need to unpin the fb during DPMS off. We need to stop calling dpms() from prepare/commit! Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=29857 Reported-by: Sitsofe Wheeler Signed-off-by: Chris Wilson --- drivers/gpu/drm/i915/intel_display.c | 28 ++++++++++++++++++++++++++-- 1 files changed, 26 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 4b23646..93b6215 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -2364,6 +2364,28 @@ static void intel_clear_scanline_wait(struct drm_device *dev) } } +static int intel_pin_crtc(struct drm_crtc *crtc) +{ + struct drm_device *dev = crtc->dev; + int ret; + + mutex_lock(&dev->struct_mutex); + ret = intel_pin_and_fence_fb_obj(dev, + to_intel_framebuffer(crtc->fb)->obj); + mutex_unlock(&dev->struct_mutex); + + return ret; +} + +static void intel_unpin_crtc(struct drm_crtc *crtc) +{ + struct drm_device *dev = crtc->dev; + + mutex_lock(&dev->struct_mutex); + i915_gem_object_unpin(to_intel_framebuffer(crtc->fb)->obj); + mutex_unlock(&dev->struct_mutex); +} + /** * Sets the power management mode of the pipe and plane. */ @@ -2389,9 +2411,10 @@ static void intel_crtc_dpms(struct drm_crtc *crtc, int mode) * properly hidden and there are no pending waits prior to * disabling the pipe. */ - if (mode == DRM_MODE_DPMS_ON) + if (mode == DRM_MODE_DPMS_ON) { + (void) intel_pin_crtc(crtc); intel_update_watermarks(dev); - else + } else intel_crtc_update_cursor(crtc); dev_priv->display.dpms(crtc, mode); @@ -2405,6 +2428,7 @@ static void intel_crtc_dpms(struct drm_crtc *crtc, int mode) intel_clear_scanline_wait(dev); intel_update_watermarks(dev); + intel_unpin_crtc(crtc); } if (!dev->primary->master) -- 1.7.1