Message ID | 1364315146-20542-3-git-send-email-jbarnes@virtuousgeek.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com> On Tue, Mar 26, 2013 at 1:25 PM, Jesse Barnes <jbarnes@virtuousgeek.org>wrote: > With the other bits in place, we can do this safely. > > v2: disable backlight on suspend to prevent premature enablement on resume > v3: disable CRTCs on suspend to allow RTD3 (Kristen) > > Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org> > --- > drivers/gpu/drm/i915/i915_drv.c | 14 +++++++++++--- > drivers/gpu/drm/i915/intel_fb.c | 3 +++ > 2 files changed, 14 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_drv.c > b/drivers/gpu/drm/i915/i915_drv.c > index 6c4b13c..bf57e1c 100644 > --- a/drivers/gpu/drm/i915/i915_drv.c > +++ b/drivers/gpu/drm/i915/i915_drv.c > @@ -458,6 +458,7 @@ bool i915_semaphore_is_enabled(struct drm_device *dev) > static int i915_drm_freeze(struct drm_device *dev) > { > struct drm_i915_private *dev_priv = dev->dev_private; > + struct drm_crtc *crtc; > > /* ignore lid events during suspend */ > mutex_lock(&dev_priv->modeset_restore_lock); > @@ -481,10 +482,14 @@ static int i915_drm_freeze(struct drm_device *dev) > > > cancel_delayed_work_sync(&dev_priv->rps.delayed_resume_work); > > - intel_modeset_disable(dev); > - > drm_irq_uninstall(dev); > dev_priv->enable_hotplug_processing = false; > + /* > + * Disable CRTCs directly since we want to preserve sw > state > + * for _thaw. > + */ > + list_for_each_entry(crtc, &dev->mode_config.crtc_list, > head) > + dev_priv->display.crtc_disable(crtc); > } > > i915_save_state(dev); > @@ -562,7 +567,10 @@ static int __i915_drm_thaw(struct drm_device *dev) > drm_irq_install(dev); > > intel_modeset_init_hw(dev); > - intel_modeset_setup_hw_state(dev, false); > + > + drm_modeset_lock_all(dev); > + intel_modeset_setup_hw_state(dev, true); > + drm_modeset_unlock_all(dev); > > /* > * ... but also need to make sure that hotplug processing > diff --git a/drivers/gpu/drm/i915/intel_fb.c > b/drivers/gpu/drm/i915/intel_fb.c > index f203418..8d81c929 100644 > --- a/drivers/gpu/drm/i915/intel_fb.c > +++ b/drivers/gpu/drm/i915/intel_fb.c > @@ -150,6 +150,9 @@ static int intelfb_create(struct drm_fb_helper *helper, > } > info->screen_size = size; > > + /* This driver doesn't need a VT switch to restore the mode on > resume */ > + info->skip_vt_switch = true; > + > drm_fb_helper_fill_fix(info, fb->pitches[0], fb->depth); > drm_fb_helper_fill_var(info, &ifbdev->helper, sizes->fb_width, > sizes->fb_height); > > -- > 1.7.9.5 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx >
On Tue, Mar 26, 2013 at 09:25:45AM -0700, Jesse Barnes wrote: > With the other bits in place, we can do this safely. > > v2: disable backlight on suspend to prevent premature enablement on resume > v3: disable CRTCs on suspend to allow RTD3 (Kristen) > > Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org> Something seems to be race with this, occasionally when resuming my vt is on the X session (at least nothing happens when I try to switch to it), the cursor is enabled, but I see the kernel console window. Doing a vt switch to a non-X console and back to X fixes things. I haven't looked exactly where we could race ... -Daniel > --- > drivers/gpu/drm/i915/i915_drv.c | 14 +++++++++++--- > drivers/gpu/drm/i915/intel_fb.c | 3 +++ > 2 files changed, 14 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c > index 6c4b13c..bf57e1c 100644 > --- a/drivers/gpu/drm/i915/i915_drv.c > +++ b/drivers/gpu/drm/i915/i915_drv.c > @@ -458,6 +458,7 @@ bool i915_semaphore_is_enabled(struct drm_device *dev) > static int i915_drm_freeze(struct drm_device *dev) > { > struct drm_i915_private *dev_priv = dev->dev_private; > + struct drm_crtc *crtc; > > /* ignore lid events during suspend */ > mutex_lock(&dev_priv->modeset_restore_lock); > @@ -481,10 +482,14 @@ static int i915_drm_freeze(struct drm_device *dev) > > cancel_delayed_work_sync(&dev_priv->rps.delayed_resume_work); > > - intel_modeset_disable(dev); > - > drm_irq_uninstall(dev); > dev_priv->enable_hotplug_processing = false; > + /* > + * Disable CRTCs directly since we want to preserve sw state > + * for _thaw. > + */ > + list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) > + dev_priv->display.crtc_disable(crtc); > } > > i915_save_state(dev); > @@ -562,7 +567,10 @@ static int __i915_drm_thaw(struct drm_device *dev) > drm_irq_install(dev); > > intel_modeset_init_hw(dev); > - intel_modeset_setup_hw_state(dev, false); > + > + drm_modeset_lock_all(dev); > + intel_modeset_setup_hw_state(dev, true); > + drm_modeset_unlock_all(dev); > > /* > * ... but also need to make sure that hotplug processing > diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c > index f203418..8d81c929 100644 > --- a/drivers/gpu/drm/i915/intel_fb.c > +++ b/drivers/gpu/drm/i915/intel_fb.c > @@ -150,6 +150,9 @@ static int intelfb_create(struct drm_fb_helper *helper, > } > info->screen_size = size; > > + /* This driver doesn't need a VT switch to restore the mode on resume */ > + info->skip_vt_switch = true; > + > drm_fb_helper_fill_fix(info, fb->pitches[0], fb->depth); > drm_fb_helper_fill_var(info, &ifbdev->helper, sizes->fb_width, sizes->fb_height); > > -- > 1.7.9.5 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
On Wed, Apr 03, 2013 at 11:15:40AM +0200, Daniel Vetter wrote: > On Tue, Mar 26, 2013 at 09:25:45AM -0700, Jesse Barnes wrote: > > With the other bits in place, we can do this safely. > > > > v2: disable backlight on suspend to prevent premature enablement on resume > > v3: disable CRTCs on suspend to allow RTD3 (Kristen) > > > > Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org> > > Something seems to be race with this, occasionally when resuming my vt is > on the X session (at least nothing happens when I try to switch to it), > the cursor is enabled, but I see the kernel console window. > > Doing a vt switch to a non-X console and back to X fixes things. I haven't > looked exactly where we could race ... This might be a DRM_MASTER race, if X fails to gain DRM_MASTER its takeover is postponed indefinitely. Any clues in Xorg.0.log? -Chris
On Wed, 3 Apr 2013 11:54:23 +0100 Chris Wilson <chris@chris-wilson.co.uk> wrote: > On Wed, Apr 03, 2013 at 11:15:40AM +0200, Daniel Vetter wrote: > > On Tue, Mar 26, 2013 at 09:25:45AM -0700, Jesse Barnes wrote: > > > With the other bits in place, we can do this safely. > > > > > > v2: disable backlight on suspend to prevent premature enablement on resume > > > v3: disable CRTCs on suspend to allow RTD3 (Kristen) > > > > > > Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org> > > > > Something seems to be race with this, occasionally when resuming my vt is > > on the X session (at least nothing happens when I try to switch to it), > > the cursor is enabled, but I see the kernel console window. > > > > Doing a vt switch to a non-X console and back to X fixes things. I haven't > > looked exactly where we could race ... > > This might be a DRM_MASTER race, if X fails to gain DRM_MASTER its > takeover is postponed indefinitely. Any clues in Xorg.0.log? Yeah, David said he saw this even w/o the VT switch patches. I've seen this bug too, maybe the lack of a VT switch makes the race a little more likely?
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 6c4b13c..bf57e1c 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -458,6 +458,7 @@ bool i915_semaphore_is_enabled(struct drm_device *dev) static int i915_drm_freeze(struct drm_device *dev) { struct drm_i915_private *dev_priv = dev->dev_private; + struct drm_crtc *crtc; /* ignore lid events during suspend */ mutex_lock(&dev_priv->modeset_restore_lock); @@ -481,10 +482,14 @@ static int i915_drm_freeze(struct drm_device *dev) cancel_delayed_work_sync(&dev_priv->rps.delayed_resume_work); - intel_modeset_disable(dev); - drm_irq_uninstall(dev); dev_priv->enable_hotplug_processing = false; + /* + * Disable CRTCs directly since we want to preserve sw state + * for _thaw. + */ + list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) + dev_priv->display.crtc_disable(crtc); } i915_save_state(dev); @@ -562,7 +567,10 @@ static int __i915_drm_thaw(struct drm_device *dev) drm_irq_install(dev); intel_modeset_init_hw(dev); - intel_modeset_setup_hw_state(dev, false); + + drm_modeset_lock_all(dev); + intel_modeset_setup_hw_state(dev, true); + drm_modeset_unlock_all(dev); /* * ... but also need to make sure that hotplug processing diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c index f203418..8d81c929 100644 --- a/drivers/gpu/drm/i915/intel_fb.c +++ b/drivers/gpu/drm/i915/intel_fb.c @@ -150,6 +150,9 @@ static int intelfb_create(struct drm_fb_helper *helper, } info->screen_size = size; + /* This driver doesn't need a VT switch to restore the mode on resume */ + info->skip_vt_switch = true; + drm_fb_helper_fill_fix(info, fb->pitches[0], fb->depth); drm_fb_helper_fill_var(info, &ifbdev->helper, sizes->fb_width, sizes->fb_height);
With the other bits in place, we can do this safely. v2: disable backlight on suspend to prevent premature enablement on resume v3: disable CRTCs on suspend to allow RTD3 (Kristen) Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org> --- drivers/gpu/drm/i915/i915_drv.c | 14 +++++++++++--- drivers/gpu/drm/i915/intel_fb.c | 3 +++ 2 files changed, 14 insertions(+), 3 deletions(-)