[Intel-gfx] [PATCH 08/14] drm/i915: Use dev_priv instead of dev in irq setup functions

Paulo Zanoni przanoni at gmail.com
Thu Oct 2 22:46:47 CEST 2014


2014-09-30 5:56 GMT-03:00 Daniel Vetter <daniel.vetter at ffwll.ch>:
> It's the new world order!
>
> Not going full monty on these here and rolling this out throughout the
> subsequent call chains since this is just for the kerneldoc. Later on
> we can go more crazy, especially once we've embedded drm_device
> correctly.
>
> v2: Also frob the runtime_pm functions ...

Needs rebase. If you plan to do it correctly:
Reviewed-by: Paulo Zanoni <paulo.r.zanoni at intel.com>

If your rebase contains a bug: Nacked-by: Paulo Zanoni
<paulo.r.zanoni at intel.com>

>
> Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
> ---
>  drivers/gpu/drm/i915/i915_dma.c         |  4 ++--
>  drivers/gpu/drm/i915/i915_drv.c         | 12 +++++-----
>  drivers/gpu/drm/i915/i915_drv.h         |  4 ++--
>  drivers/gpu/drm/i915/i915_irq.c         | 40 +++++++++++++++------------------
>  drivers/gpu/drm/i915/intel_drv.h        |  4 ++--
>  drivers/gpu/drm/i915/intel_runtime_pm.c |  2 +-
>  6 files changed, 31 insertions(+), 35 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
> index 969f0cff9fef..f50ecb18525f 100644
> --- a/drivers/gpu/drm/i915/i915_dma.c
> +++ b/drivers/gpu/drm/i915/i915_dma.c
> @@ -1363,7 +1363,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
>                 goto cleanup_gem;
>
>         /* Only enable hotplug handling once the fbdev is fully set up. */
> -       intel_hpd_init(dev);
> +       intel_hpd_init(dev_priv);
>
>         /*
>          * Some ports require correctly set-up hpd registers for detection to
> @@ -1733,7 +1733,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
>                 goto out_freewq;
>         }
>
> -       intel_irq_init(dev);
> +       intel_irq_init(dev_priv);
>         intel_uncore_sanitize(dev);
>
>         /* Try to make sure MCHBAR is enabled before poking at it */
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index f07b8518cd39..605a4c4580d5 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -575,7 +575,7 @@ static int i915_drm_freeze(struct drm_device *dev)
>
>                 flush_delayed_work(&dev_priv->rps.delayed_resume_work);
>
> -               intel_runtime_pm_disable_interrupts(dev);
> +               intel_runtime_pm_disable_interrupts(dev_priv);
>                 intel_hpd_cancel_work(dev_priv);
>
>                 intel_suspend_encoders(dev_priv);
> @@ -681,7 +681,7 @@ static int __i915_drm_thaw(struct drm_device *dev, bool restore_gtt_mappings)
>                 mutex_unlock(&dev->struct_mutex);
>
>                 /* We need working interrupts for modeset enabling ... */
> -               intel_runtime_pm_restore_interrupts(dev);
> +               intel_runtime_pm_enable_interrupts(dev_priv);
>
>                 intel_modeset_init_hw(dev);
>
> @@ -703,7 +703,7 @@ static int __i915_drm_thaw(struct drm_device *dev, bool restore_gtt_mappings)
>                  * bother with the tiny race here where we might loose hotplug
>                  * notifications.
>                  * */
> -               intel_hpd_init(dev);
> +               intel_hpd_init(dev_priv);
>                 /* Config may have changed between suspend and resume */
>                 drm_helper_hpd_irq_event(dev);
>         }
> @@ -1446,12 +1446,12 @@ static int intel_runtime_suspend(struct device *device)
>          * intel_mark_idle().
>          */
>         cancel_work_sync(&dev_priv->rps.work);
> -       intel_runtime_pm_disable_interrupts(dev);
> +       intel_runtime_pm_disable_interrupts(dev_priv);
>
>         ret = intel_suspend_complete(dev_priv);
>         if (ret) {
>                 DRM_ERROR("Runtime suspend failed, disabling it (%d)\n", ret);
> -               intel_runtime_pm_restore_interrupts(dev);
> +               intel_runtime_pm_enable_interrupts(dev_priv);
>
>                 return ret;
>         }
> @@ -1511,7 +1511,7 @@ static int intel_runtime_resume(struct device *device)
>         i915_gem_init_swizzling(dev);
>         gen6_update_ring_freq(dev);
>
> -       intel_runtime_pm_restore_interrupts(dev);
> +       intel_runtime_pm_enable_interrupts(dev_priv);
>         intel_reset_gt_powersave(dev);
>
>         if (ret)
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 1eec0e81a5ca..854f1b92d3df 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -2283,8 +2283,8 @@ void i915_handle_error(struct drm_device *dev, bool wedged,
>
>  void gen6_set_pm_mask(struct drm_i915_private *dev_priv, u32 pm_iir,
>                                                         int new_delay);
> -extern void intel_irq_init(struct drm_device *dev);
> -extern void intel_hpd_init(struct drm_device *dev);
> +extern void intel_irq_init(struct drm_i915_private *dev_priv);
> +extern void intel_hpd_init(struct drm_i915_private *dev_priv);
>  int intel_irq_init_hw(struct drm_i915_private *dev_priv);
>  void intel_irq_fini(struct drm_i915_private *dev_priv);
>
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index d9d09a9b4fc7..2c436e6c55b0 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -4631,9 +4631,9 @@ static void intel_hpd_irq_reenable_work(struct work_struct *work)
>         intel_runtime_pm_put(dev_priv);
>  }
>
> -void intel_irq_init(struct drm_device *dev)
> +void intel_irq_init(struct drm_i915_private *dev_priv)
>  {
> -       struct drm_i915_private *dev_priv = dev->dev_private;
> +       struct drm_device *dev = dev_priv->dev;
>
>         INIT_WORK(&dev_priv->hotplug_work, i915_hotplug_work_func);
>         INIT_WORK(&dev_priv->dig_port_work, i915_digport_work_func);
> @@ -4642,7 +4642,7 @@ void intel_irq_init(struct drm_device *dev)
>         INIT_WORK(&dev_priv->l3_parity.error_work, ivybridge_parity_work);
>
>         /* Let's track the enabled rps events */
> -       if (IS_VALLEYVIEW(dev) && !IS_CHERRYVIEW(dev))
> +       if (IS_VALLEYVIEW(dev_priv) && !IS_CHERRYVIEW(dev_priv))
>                 /* WaGsvRC0ResidencyMethod:vlv */
>                 dev_priv->pm_rps_events = GEN6_PM_RP_UP_EI_EXPIRED;
>         else
> @@ -4656,10 +4656,10 @@ void intel_irq_init(struct drm_device *dev)
>
>         pm_qos_add_request(&dev_priv->pm_qos, PM_QOS_CPU_DMA_LATENCY, PM_QOS_DEFAULT_VALUE);
>
> -       if (IS_GEN2(dev)) {
> +       if (IS_GEN2(dev_priv)) {
>                 dev->max_vblank_count = 0;
>                 dev->driver->get_vblank_counter = i8xx_get_vblank_counter;
> -       } else if (IS_G4X(dev) || INTEL_INFO(dev)->gen >= 5) {
> +       } else if (IS_G4X(dev_priv) || INTEL_INFO(dev_priv)->gen >= 5) {
>                 dev->max_vblank_count = 0xffffffff; /* full 32 bit counter */
>                 dev->driver->get_vblank_counter = gm45_get_vblank_counter;
>         } else {
> @@ -4672,7 +4672,7 @@ void intel_irq_init(struct drm_device *dev)
>          * Gen2 doesn't have a hardware frame counter and so depends on
>          * vblank interrupts to produce sane vblank seuquence numbers.
>          */
> -       if (!IS_GEN2(dev))
> +       if (!IS_GEN2(dev_priv))
>                 dev->vblank_disable_immediate = true;
>
>         if (drm_core_check_feature(dev, DRIVER_MODESET)) {
> @@ -4680,7 +4680,7 @@ void intel_irq_init(struct drm_device *dev)
>                 dev->driver->get_scanout_position = i915_get_crtc_scanoutpos;
>         }
>
> -       if (IS_CHERRYVIEW(dev)) {
> +       if (IS_CHERRYVIEW(dev_priv)) {
>                 dev->driver->irq_handler = cherryview_irq_handler;
>                 dev->driver->irq_preinstall = cherryview_irq_preinstall;
>                 dev->driver->irq_postinstall = cherryview_irq_postinstall;
> @@ -4688,7 +4688,7 @@ void intel_irq_init(struct drm_device *dev)
>                 dev->driver->enable_vblank = valleyview_enable_vblank;
>                 dev->driver->disable_vblank = valleyview_disable_vblank;
>                 dev_priv->display.hpd_irq_setup = i915_hpd_irq_setup;
> -       } else if (IS_VALLEYVIEW(dev)) {
> +       } else if (IS_VALLEYVIEW(dev_priv)) {
>                 dev->driver->irq_handler = valleyview_irq_handler;
>                 dev->driver->irq_preinstall = valleyview_irq_preinstall;
>                 dev->driver->irq_postinstall = valleyview_irq_postinstall;
> @@ -4696,7 +4696,7 @@ void intel_irq_init(struct drm_device *dev)
>                 dev->driver->enable_vblank = valleyview_enable_vblank;
>                 dev->driver->disable_vblank = valleyview_disable_vblank;
>                 dev_priv->display.hpd_irq_setup = i915_hpd_irq_setup;
> -       } else if (IS_GEN8(dev)) {
> +       } else if (IS_GEN8(dev_priv)) {
>                 dev->driver->irq_handler = gen8_irq_handler;
>                 dev->driver->irq_preinstall = gen8_irq_reset;
>                 dev->driver->irq_postinstall = gen8_irq_postinstall;
> @@ -4713,12 +4713,12 @@ void intel_irq_init(struct drm_device *dev)
>                 dev->driver->disable_vblank = ironlake_disable_vblank;
>                 dev_priv->display.hpd_irq_setup = ibx_hpd_irq_setup;
>         } else {
> -               if (INTEL_INFO(dev)->gen == 2) {
> +               if (INTEL_INFO(dev_priv)->gen == 2) {
>                         dev->driver->irq_preinstall = i8xx_irq_preinstall;
>                         dev->driver->irq_postinstall = i8xx_irq_postinstall;
>                         dev->driver->irq_handler = i8xx_irq_handler;
>                         dev->driver->irq_uninstall = i8xx_irq_uninstall;
> -               } else if (INTEL_INFO(dev)->gen == 3) {
> +               } else if (INTEL_INFO(dev_priv)->gen == 3) {
>                         dev->driver->irq_preinstall = i915_irq_preinstall;
>                         dev->driver->irq_postinstall = i915_irq_postinstall;
>                         dev->driver->irq_uninstall = i915_irq_uninstall;
> @@ -4736,9 +4736,9 @@ void intel_irq_init(struct drm_device *dev)
>         }
>  }
>
> -void intel_hpd_init(struct drm_device *dev)
> +void intel_hpd_init(struct drm_i915_private *dev_priv)
>  {
> -       struct drm_i915_private *dev_priv = dev->dev_private;
> +       struct drm_device *dev = dev_priv->dev;
>         struct drm_mode_config *mode_config = &dev->mode_config;
>         struct drm_connector *connector;
>         int i;
> @@ -4784,20 +4784,16 @@ void intel_irq_fini(struct drm_i915_private *dev_priv)
>  }
>
>  /* Disable interrupts so we can allow runtime PM. */
> -void intel_runtime_pm_disable_interrupts(struct drm_device *dev)
> +void intel_runtime_pm_disable_interrupts(struct drm_i915_private *dev_priv)
>  {
> -       struct drm_i915_private *dev_priv = dev->dev_private;
> -
> -       dev->driver->irq_uninstall(dev);
> +       dev_priv->dev->driver->irq_uninstall(dev_priv->dev);
>         dev_priv->pm.irqs_enabled = false;
>  }
>
>  /* Restore interrupts so we can recover from runtime PM. */
> -void intel_runtime_pm_restore_interrupts(struct drm_device *dev)
> +void intel_runtime_pm_enable_interrupts(struct drm_i915_private *dev_priv)
>  {
> -       struct drm_i915_private *dev_priv = dev->dev_private;
> -
>         dev_priv->pm.irqs_enabled = true;
> -       dev->driver->irq_preinstall(dev);
> -       dev->driver->irq_postinstall(dev);
> +       dev_priv->dev->driver->irq_preinstall(dev_priv->dev);
> +       dev_priv->dev->driver->irq_postinstall(dev_priv->dev);
>  }
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index cf07e2225911..aba3ea938427 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -756,8 +756,8 @@ void gen6_enable_pm_irq(struct drm_i915_private *dev_priv, uint32_t mask);
>  void gen6_disable_pm_irq(struct drm_i915_private *dev_priv, uint32_t mask);
>  void gen8_enable_pm_irq(struct drm_i915_private *dev_priv, uint32_t mask);
>  void gen8_disable_pm_irq(struct drm_i915_private *dev_priv, uint32_t mask);
> -void intel_runtime_pm_disable_interrupts(struct drm_device *dev);
> -void intel_runtime_pm_restore_interrupts(struct drm_device *dev);
> +void intel_runtime_pm_disable_interrupts(struct drm_i915_private *dev_priv);
> +void intel_runtime_pm_enable_interrupts(struct drm_i915_private *dev_priv);
>  static inline bool intel_irqs_enabled(struct drm_i915_private *dev_priv)
>  {
>         /*
> diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c b/drivers/gpu/drm/i915/intel_runtime_pm.c
> index 6fa781a5b15c..8e322513a44a 100644
> --- a/drivers/gpu/drm/i915/intel_runtime_pm.c
> +++ b/drivers/gpu/drm/i915/intel_runtime_pm.c
> @@ -377,7 +377,7 @@ static void vlv_display_power_well_enable(struct drm_i915_private *dev_priv,
>         if (dev_priv->power_domains.initializing)
>                 return;
>
> -       intel_hpd_init(dev_priv->dev);
> +       intel_hpd_init(dev_priv);
>
>         i915_redisable_vga_power_on(dev_priv->dev);
>  }
> --
> 2.1.1
>



-- 
Paulo Zanoni



More information about the Intel-gfx mailing list