Hi 2014/1/22 <naresh.kumar.kachhi@xxxxxxxxx>: > From: Naresh Kumar Kachhi <naresh.kumar.kachhi@xxxxxxxxx> > > Once the display is disabled, we need to call runtime_put to > make sure Runtime framework triggers runtime_suspend based on > idleness. Similarly when display gets enabled, runtime_get should > be called. We have similiar function for pc8 feature, but some > platform(BYT) might not have pc8 feature, so creating a generic > function for runtime_pm Does this patch series help you somehow? http://lists.freedesktop.org/archives/intel-gfx/2013-December/037721.html > > Signed-off-by: Naresh Kumar Kachhi <naresh.kumar.kachhi@xxxxxxxxx> > --- > drivers/gpu/drm/i915/i915_drv.h | 2 ++ > drivers/gpu/drm/i915/intel_drv.h | 1 + > drivers/gpu/drm/i915/intel_pm.c | 50 ++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 53 insertions(+) > > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h > index d1399f9..6a6f046 100644 > --- a/drivers/gpu/drm/i915/i915_drv.h > +++ b/drivers/gpu/drm/i915/i915_drv.h > @@ -1325,6 +1325,8 @@ struct i915_package_c8 { > struct i915_runtime_pm { > bool suspended; > bool gpu_idle; > + bool disp_idle; > + struct mutex lock; > }; > > enum intel_pipe_crc_source { > diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h > index 9061aa7..94a6127 100644 > --- a/drivers/gpu/drm/i915/intel_drv.h > +++ b/drivers/gpu/drm/i915/intel_drv.h > @@ -887,6 +887,7 @@ void intel_init_runtime_pm(struct drm_i915_private *dev_priv); > void intel_fini_runtime_pm(struct drm_i915_private *dev_priv); > void intel_runtime_pm_gpu_busy(struct drm_i915_private *dev_priv); > void intel_runtime_pm_gpu_idle(struct drm_i915_private *dev_priv); > +void intel_runtime_update_disp_state(struct drm_i915_private *dev_priv); > void ilk_wm_get_hw_state(struct drm_device *dev); > > > diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c > index 991ff62..9d6d0e1 100644 > --- a/drivers/gpu/drm/i915/intel_pm.c > +++ b/drivers/gpu/drm/i915/intel_pm.c > @@ -5501,6 +5501,54 @@ void intel_runtime_pm_gpu_busy(struct drm_i915_private *dev_priv) > } > } > > +static void intel_runtime_pm_disp_idle(struct drm_i915_private *dev_priv) > +{ > + if (!HAS_RUNTIME_PM(dev_priv->dev)) > + return; > + > + mutex_lock(&dev_priv->pm.lock); > + if (!dev_priv->pm.disp_idle) { > + dev_priv->pm.disp_idle = true; > + intel_runtime_pm_put(dev_priv); > + } > + mutex_unlock(&dev_priv->pm.lock); > +} > + > +static void intel_runtime_pm_disp_busy(struct drm_i915_private *dev_priv) > +{ > + if (!HAS_RUNTIME_PM(dev_priv->dev)) > + return; > + > + mutex_lock(&dev_priv->pm.lock); > + if (dev_priv->pm.disp_idle) { > + dev_priv->pm.disp_idle = false; > + /* This call is coming from an IOCTL so we have already done a > + * get_sync. get_noresume should suffice here > + */ > + intel_runtime_pm_get_noresume(dev_priv); > + } > + mutex_unlock(&dev_priv->pm.lock); > +} > + > +void intel_runtime_update_disp_state(struct drm_i915_private *dev_priv) > +{ > + struct drm_device *dev = dev_priv->dev; > + struct intel_crtc *crtc; > + bool enabled = false; > + > + if (!HAS_RUNTIME_PM(dev_priv->dev)) > + return; > + > + list_for_each_entry(crtc, &dev->mode_config.crtc_list, base.head) > + enabled |= crtc->base.enabled; > + > + if (enabled) > + intel_runtime_pm_disp_busy(dev_priv); > + else > + intel_runtime_pm_disp_idle(dev_priv); > + > +} > + > void intel_runtime_pm_get(struct drm_i915_private *dev_priv) > { > struct drm_device *dev = dev_priv->dev; > @@ -5547,6 +5595,8 @@ void intel_init_runtime_pm(struct drm_i915_private *dev_priv) > > dev_priv->pm.suspended = false; > dev_priv->pm.gpu_idle = true; > + dev_priv->pm.disp_idle = true; > + mutex_init(&dev_priv->pm.lock); > > if (!HAS_RUNTIME_PM(dev)) > return; > -- > 1.8.1.2 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@xxxxxxxxxxxxxxxxxxxxx > http://lists.freedesktop.org/mailman/listinfo/intel-gfx -- Paulo Zanoni _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx