aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien Lespiau <damien.lespiau@intel.com>2014-02-07 14:12:47 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-02-12 12:52:50 -0500
commit3d13ef2e2d8bd88e92da6164a63dccc07e55fc9c (patch)
treede625e9ebc7d5b6f434c4ab0ce0ed1b48175dc8d
parente927ecde591702fb4b812e264a3a1bd5e85d84e9 (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>
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c5
-rw-r--r--drivers/gpu/drm/i915/i915_irq.c4
-rw-r--r--drivers/gpu/drm/i915/intel_display.c27
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c13
4 files changed, 29 insertions, 20 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index a8a069f97c56..9b77be074e26 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1014,7 +1014,8 @@ static int __wait_seqno(struct intel_ring_buffer *ring, u32 seqno,
1014 struct timespec *timeout, 1014 struct timespec *timeout,
1015 struct drm_i915_file_private *file_priv) 1015 struct drm_i915_file_private *file_priv)
1016{ 1016{
1017 drm_i915_private_t *dev_priv = ring->dev->dev_private; 1017 struct drm_device *dev = ring->dev;
1018 drm_i915_private_t *dev_priv = dev->dev_private;
1018 const bool irq_test_in_progress = 1019 const bool irq_test_in_progress =
1019 ACCESS_ONCE(dev_priv->gpu_error.test_irq_rings) & intel_ring_flag(ring); 1020 ACCESS_ONCE(dev_priv->gpu_error.test_irq_rings) & intel_ring_flag(ring);
1020 struct timespec before, now; 1021 struct timespec before, now;
@@ -1029,7 +1030,7 @@ static int __wait_seqno(struct intel_ring_buffer *ring, u32 seqno,
1029 1030
1030 timeout_expire = timeout ? jiffies + timespec_to_jiffies_timeout(timeout) : 0; 1031 timeout_expire = timeout ? jiffies + timespec_to_jiffies_timeout(timeout) : 0;
1031 1032
1032 if (dev_priv->info->gen >= 6 && can_wait_boost(file_priv)) { 1033 if (INTEL_INFO(dev)->gen >= 6 && can_wait_boost(file_priv)) {
1033 gen6_rps_boost(dev_priv); 1034 gen6_rps_boost(dev_priv);
1034 if (file_priv) 1035 if (file_priv)
1035 mod_delayed_work(dev_priv->wq, 1036 mod_delayed_work(dev_priv->wq,
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 8f579bc3b26d..d4defd86b27c 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -2276,7 +2276,7 @@ static int i915_enable_vblank(struct drm_device *dev, int pipe)
2276 PIPE_VBLANK_INTERRUPT_ENABLE); 2276 PIPE_VBLANK_INTERRUPT_ENABLE);
2277 2277
2278 /* maintain vblank delivery even in deep C-states */ 2278 /* maintain vblank delivery even in deep C-states */
2279 if (dev_priv->info->gen == 3) 2279 if (INTEL_INFO(dev)->gen == 3)
2280 I915_WRITE(INSTPM, _MASKED_BIT_DISABLE(INSTPM_AGPBUSY_DIS)); 2280 I915_WRITE(INSTPM, _MASKED_BIT_DISABLE(INSTPM_AGPBUSY_DIS));
2281 spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags); 2281 spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags);
2282 2282
@@ -2341,7 +2341,7 @@ static void i915_disable_vblank(struct drm_device *dev, int pipe)
2341 unsigned long irqflags; 2341 unsigned long irqflags;
2342 2342
2343 spin_lock_irqsave(&dev_priv->irq_lock, irqflags); 2343 spin_lock_irqsave(&dev_priv->irq_lock, irqflags);
2344 if (dev_priv->info->gen == 3) 2344 if (INTEL_INFO(dev)->gen == 3)
2345 I915_WRITE(INSTPM, _MASKED_BIT_ENABLE(INSTPM_AGPBUSY_DIS)); 2345 I915_WRITE(INSTPM, _MASKED_BIT_ENABLE(INSTPM_AGPBUSY_DIS));
2346 2346
2347 i915_disable_pipestat(dev_priv, pipe, 2347 i915_disable_pipestat(dev_priv, pipe,
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 */
1550static void ironlake_enable_shared_dpll(struct intel_crtc *crtc) 1550static 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
1579static void intel_disable_shared_dpll(struct intel_crtc *crtc) 1580static 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,
1851void intel_flush_primary_plane(struct drm_i915_private *dev_priv, 1853void 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
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 0ed4df2c5c95..af45c2768da3 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -3903,9 +3903,10 @@ static unsigned long __i915_chipset_val(struct drm_i915_private *dev_priv)
3903 3903
3904unsigned long i915_chipset_val(struct drm_i915_private *dev_priv) 3904unsigned long i915_chipset_val(struct drm_i915_private *dev_priv)
3905{ 3905{
3906 struct drm_device *dev = dev_priv->dev;
3906 unsigned long val; 3907 unsigned long val;
3907 3908
3908 if (dev_priv->info->gen != 5) 3909 if (INTEL_INFO(dev)->gen != 5)
3909 return 0; 3910 return 0;
3910 3911
3911 spin_lock_irq(&mchdev_lock); 3912 spin_lock_irq(&mchdev_lock);
@@ -3934,6 +3935,7 @@ unsigned long i915_mch_val(struct drm_i915_private *dev_priv)
3934 3935
3935static u16 pvid_to_extvid(struct drm_i915_private *dev_priv, u8 pxvid) 3936static u16 pvid_to_extvid(struct drm_i915_private *dev_priv, u8 pxvid)
3936{ 3937{
3938 struct drm_device *dev = dev_priv->dev;
3937 static const struct v_table { 3939 static const struct v_table {
3938 u16 vd; /* in .1 mil */ 3940 u16 vd; /* in .1 mil */
3939 u16 vm; /* in .1 mil */ 3941 u16 vm; /* in .1 mil */
@@ -4067,7 +4069,7 @@ static u16 pvid_to_extvid(struct drm_i915_private *dev_priv, u8 pxvid)
4067 { 16000, 14875, }, 4069 { 16000, 14875, },
4068 { 16125, 15000, }, 4070 { 16125, 15000, },
4069 }; 4071 };
4070 if (dev_priv->info->is_mobile) 4072 if (INTEL_INFO(dev)->is_mobile)
4071 return v_table[pxvid].vm; 4073 return v_table[pxvid].vm;
4072 else 4074 else
4073 return v_table[pxvid].vd; 4075 return v_table[pxvid].vd;
@@ -4110,7 +4112,9 @@ static void __i915_update_gfx_val(struct drm_i915_private *dev_priv)
4110 4112
4111void i915_update_gfx_val(struct drm_i915_private *dev_priv) 4113void i915_update_gfx_val(struct drm_i915_private *dev_priv)
4112{ 4114{
4113 if (dev_priv->info->gen != 5) 4115 struct drm_device *dev = dev_priv->dev;
4116
4117 if (INTEL_INFO(dev)->gen != 5)
4114 return; 4118 return;
4115 4119
4116 spin_lock_irq(&mchdev_lock); 4120 spin_lock_irq(&mchdev_lock);
@@ -4159,9 +4163,10 @@ static unsigned long __i915_gfx_val(struct drm_i915_private *dev_priv)
4159 4163
4160unsigned long i915_gfx_val(struct drm_i915_private *dev_priv) 4164unsigned long i915_gfx_val(struct drm_i915_private *dev_priv)
4161{ 4165{
4166 struct drm_device *dev = dev_priv->dev;
4162 unsigned long val; 4167 unsigned long val;
4163 4168
4164 if (dev_priv->info->gen != 5) 4169 if (INTEL_INFO(dev)->gen != 5)
4165 return 0; 4170 return 0;
4166 4171
4167 spin_lock_irq(&mchdev_lock); 4172 spin_lock_irq(&mchdev_lock);