diff options
author | Damien Lespiau <damien.lespiau@intel.com> | 2014-02-07 14:12:47 -0500 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-02-12 12:52:50 -0500 |
commit | 3d13ef2e2d8bd88e92da6164a63dccc07e55fc9c (patch) | |
tree | de625e9ebc7d5b6f434c4ab0ce0ed1b48175dc8d /drivers/gpu/drm/i915/intel_display.c | |
parent | e927ecde591702fb4b812e264a3a1bd5e85d84e9 (diff) |
drm/i915: Always use INTEL_INFO() to access the device_info structure
If we make sure that all the dev_priv->info usages are wrapped by
INTEL_INFO(), we can easily modify the ->info field to be structure and
not a pointer while keeping the const protection in the INTEL_INFO()
macro.
v2: Rebased onto latest drm-nightly
Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_display.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 4d4a0d912b8e..1ad59d73e7d6 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -1030,7 +1030,7 @@ static void assert_fdi_tx_pll_enabled(struct drm_i915_private *dev_priv, | |||
1030 | u32 val; | 1030 | u32 val; |
1031 | 1031 | ||
1032 | /* ILK FDI PLL is always enabled */ | 1032 | /* ILK FDI PLL is always enabled */ |
1033 | if (dev_priv->info->gen == 5) | 1033 | if (INTEL_INFO(dev_priv->dev)->gen == 5) |
1034 | return; | 1034 | return; |
1035 | 1035 | ||
1036 | /* On Haswell, DDI ports are responsible for the FDI PLL setup */ | 1036 | /* On Haswell, DDI ports are responsible for the FDI PLL setup */ |
@@ -1443,7 +1443,7 @@ static void i9xx_enable_pll(struct intel_crtc *crtc) | |||
1443 | assert_pipe_disabled(dev_priv, crtc->pipe); | 1443 | assert_pipe_disabled(dev_priv, crtc->pipe); |
1444 | 1444 | ||
1445 | /* No really, not for ILK+ */ | 1445 | /* No really, not for ILK+ */ |
1446 | BUG_ON(dev_priv->info->gen >= 5); | 1446 | BUG_ON(INTEL_INFO(dev)->gen >= 5); |
1447 | 1447 | ||
1448 | /* PLL is protected by panel, make sure we can write it */ | 1448 | /* PLL is protected by panel, make sure we can write it */ |
1449 | if (IS_MOBILE(dev) && !IS_I830(dev)) | 1449 | if (IS_MOBILE(dev) && !IS_I830(dev)) |
@@ -1549,11 +1549,12 @@ void vlv_wait_port_ready(struct drm_i915_private *dev_priv, | |||
1549 | */ | 1549 | */ |
1550 | static void ironlake_enable_shared_dpll(struct intel_crtc *crtc) | 1550 | static void ironlake_enable_shared_dpll(struct intel_crtc *crtc) |
1551 | { | 1551 | { |
1552 | struct drm_i915_private *dev_priv = crtc->base.dev->dev_private; | 1552 | struct drm_device *dev = crtc->base.dev; |
1553 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
1553 | struct intel_shared_dpll *pll = intel_crtc_to_shared_dpll(crtc); | 1554 | struct intel_shared_dpll *pll = intel_crtc_to_shared_dpll(crtc); |
1554 | 1555 | ||
1555 | /* PCH PLLs only available on ILK, SNB and IVB */ | 1556 | /* PCH PLLs only available on ILK, SNB and IVB */ |
1556 | BUG_ON(dev_priv->info->gen < 5); | 1557 | BUG_ON(INTEL_INFO(dev)->gen < 5); |
1557 | if (WARN_ON(pll == NULL)) | 1558 | if (WARN_ON(pll == NULL)) |
1558 | return; | 1559 | return; |
1559 | 1560 | ||
@@ -1578,11 +1579,12 @@ static void ironlake_enable_shared_dpll(struct intel_crtc *crtc) | |||
1578 | 1579 | ||
1579 | static void intel_disable_shared_dpll(struct intel_crtc *crtc) | 1580 | static void intel_disable_shared_dpll(struct intel_crtc *crtc) |
1580 | { | 1581 | { |
1581 | struct drm_i915_private *dev_priv = crtc->base.dev->dev_private; | 1582 | struct drm_device *dev = crtc->base.dev; |
1583 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
1582 | struct intel_shared_dpll *pll = intel_crtc_to_shared_dpll(crtc); | 1584 | struct intel_shared_dpll *pll = intel_crtc_to_shared_dpll(crtc); |
1583 | 1585 | ||
1584 | /* PCH only available on ILK+ */ | 1586 | /* PCH only available on ILK+ */ |
1585 | BUG_ON(dev_priv->info->gen < 5); | 1587 | BUG_ON(INTEL_INFO(dev)->gen < 5); |
1586 | if (WARN_ON(pll == NULL)) | 1588 | if (WARN_ON(pll == NULL)) |
1587 | return; | 1589 | return; |
1588 | 1590 | ||
@@ -1617,7 +1619,7 @@ static void ironlake_enable_pch_transcoder(struct drm_i915_private *dev_priv, | |||
1617 | uint32_t reg, val, pipeconf_val; | 1619 | uint32_t reg, val, pipeconf_val; |
1618 | 1620 | ||
1619 | /* PCH only available on ILK+ */ | 1621 | /* PCH only available on ILK+ */ |
1620 | BUG_ON(dev_priv->info->gen < 5); | 1622 | BUG_ON(INTEL_INFO(dev)->gen < 5); |
1621 | 1623 | ||
1622 | /* Make sure PCH DPLL is enabled */ | 1624 | /* Make sure PCH DPLL is enabled */ |
1623 | assert_shared_dpll_enabled(dev_priv, | 1625 | assert_shared_dpll_enabled(dev_priv, |
@@ -1670,7 +1672,7 @@ static void lpt_enable_pch_transcoder(struct drm_i915_private *dev_priv, | |||
1670 | u32 val, pipeconf_val; | 1672 | u32 val, pipeconf_val; |
1671 | 1673 | ||
1672 | /* PCH only available on ILK+ */ | 1674 | /* PCH only available on ILK+ */ |
1673 | BUG_ON(dev_priv->info->gen < 5); | 1675 | BUG_ON(INTEL_INFO(dev_priv->dev)->gen < 5); |
1674 | 1676 | ||
1675 | /* FDI must be feeding us bits for PCH ports */ | 1677 | /* FDI must be feeding us bits for PCH ports */ |
1676 | assert_fdi_tx_enabled(dev_priv, (enum pipe) cpu_transcoder); | 1678 | assert_fdi_tx_enabled(dev_priv, (enum pipe) cpu_transcoder); |
@@ -1851,7 +1853,8 @@ static void intel_disable_pipe(struct drm_i915_private *dev_priv, | |||
1851 | void intel_flush_primary_plane(struct drm_i915_private *dev_priv, | 1853 | void intel_flush_primary_plane(struct drm_i915_private *dev_priv, |
1852 | enum plane plane) | 1854 | enum plane plane) |
1853 | { | 1855 | { |
1854 | u32 reg = dev_priv->info->gen >= 4 ? DSPSURF(plane) : DSPADDR(plane); | 1856 | struct drm_device *dev = dev_priv->dev; |
1857 | u32 reg = INTEL_INFO(dev)->gen >= 4 ? DSPSURF(plane) : DSPADDR(plane); | ||
1855 | 1858 | ||
1856 | I915_WRITE(reg, I915_READ(reg)); | 1859 | I915_WRITE(reg, I915_READ(reg)); |
1857 | POSTING_READ(reg); | 1860 | POSTING_READ(reg); |
@@ -7577,7 +7580,7 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc, | |||
7577 | 7580 | ||
7578 | /* we only need to pin inside GTT if cursor is non-phy */ | 7581 | /* we only need to pin inside GTT if cursor is non-phy */ |
7579 | mutex_lock(&dev->struct_mutex); | 7582 | mutex_lock(&dev->struct_mutex); |
7580 | if (!dev_priv->info->cursor_needs_physical) { | 7583 | if (!INTEL_INFO(dev)->cursor_needs_physical) { |
7581 | unsigned alignment; | 7584 | unsigned alignment; |
7582 | 7585 | ||
7583 | if (obj->tiling_mode) { | 7586 | if (obj->tiling_mode) { |
@@ -7625,7 +7628,7 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc, | |||
7625 | 7628 | ||
7626 | finish: | 7629 | finish: |
7627 | if (intel_crtc->cursor_bo) { | 7630 | if (intel_crtc->cursor_bo) { |
7628 | if (dev_priv->info->cursor_needs_physical) { | 7631 | if (INTEL_INFO(dev)->cursor_needs_physical) { |
7629 | if (intel_crtc->cursor_bo != obj) | 7632 | if (intel_crtc->cursor_bo != obj) |
7630 | i915_gem_detach_phys_object(dev, intel_crtc->cursor_bo); | 7633 | i915_gem_detach_phys_object(dev, intel_crtc->cursor_bo); |
7631 | } else | 7634 | } else |
@@ -8220,7 +8223,7 @@ void intel_mark_idle(struct drm_device *dev) | |||
8220 | intel_decrease_pllclock(crtc); | 8223 | intel_decrease_pllclock(crtc); |
8221 | } | 8224 | } |
8222 | 8225 | ||
8223 | if (dev_priv->info->gen >= 6) | 8226 | if (INTEL_INFO(dev)->gen >= 6) |
8224 | gen6_rps_idle(dev->dev_private); | 8227 | gen6_rps_idle(dev->dev_private); |
8225 | } | 8228 | } |
8226 | 8229 | ||