aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>2016-11-16 07:32:42 -0500
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>2016-11-17 08:56:46 -0500
commit6315b5d33a8ff6e0bf3d083524ffaa4e33d5981b (patch)
tree5e5fd63b763fdcf5e17c0302e4177fa2ee661a8b /drivers
parent175fded17c4c291edc72b5f41b47d23de799329d (diff)
drm/i915: dev_priv cleanup in intel_display.c
v2: Rebase. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/i915/i915_drv.c2
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h3
-rw-r--r--drivers/gpu/drm/i915/intel_display.c167
3 files changed, 75 insertions, 97 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index ce34e7ab44ab..445fec9c2841 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -495,7 +495,7 @@ static unsigned int i915_vga_set_decode(void *cookie, bool state)
495{ 495{
496 struct drm_device *dev = cookie; 496 struct drm_device *dev = cookie;
497 497
498 intel_modeset_vga_set_state(dev, state); 498 intel_modeset_vga_set_state(to_i915(dev), state);
499 if (state) 499 if (state)
500 return VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM | 500 return VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM |
501 VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM; 501 VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM;
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 69e3658f00e2..70a736a02e26 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -3481,7 +3481,8 @@ extern void intel_modeset_gem_init(struct drm_device *dev);
3481extern void intel_modeset_cleanup(struct drm_device *dev); 3481extern void intel_modeset_cleanup(struct drm_device *dev);
3482extern int intel_connector_register(struct drm_connector *); 3482extern int intel_connector_register(struct drm_connector *);
3483extern void intel_connector_unregister(struct drm_connector *); 3483extern void intel_connector_unregister(struct drm_connector *);
3484extern int intel_modeset_vga_set_state(struct drm_device *dev, bool state); 3484extern int intel_modeset_vga_set_state(struct drm_i915_private *dev_priv,
3485 bool state);
3485extern void intel_display_resume(struct drm_device *dev); 3486extern void intel_display_resume(struct drm_device *dev);
3486extern void i915_redisable_vga(struct drm_i915_private *dev_priv); 3487extern void i915_redisable_vga(struct drm_i915_private *dev_priv);
3487extern void i915_redisable_vga_power_on(struct drm_i915_private *dev_priv); 3488extern void i915_redisable_vga_power_on(struct drm_i915_private *dev_priv);
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index da1e29ec9eb6..e4f1985a5592 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -1035,9 +1035,8 @@ enum transcoder intel_pipe_to_cpu_transcoder(struct drm_i915_private *dev_priv,
1035 return crtc->config->cpu_transcoder; 1035 return crtc->config->cpu_transcoder;
1036} 1036}
1037 1037
1038static bool pipe_dsl_stopped(struct drm_device *dev, enum pipe pipe) 1038static bool pipe_dsl_stopped(struct drm_i915_private *dev_priv, enum pipe pipe)
1039{ 1039{
1040 struct drm_i915_private *dev_priv = to_i915(dev);
1041 i915_reg_t reg = PIPEDSL(pipe); 1040 i915_reg_t reg = PIPEDSL(pipe);
1042 u32 line1, line2; 1041 u32 line1, line2;
1043 u32 line_mask; 1042 u32 line_mask;
@@ -1072,12 +1071,11 @@ static bool pipe_dsl_stopped(struct drm_device *dev, enum pipe pipe)
1072 */ 1071 */
1073static void intel_wait_for_pipe_off(struct intel_crtc *crtc) 1072static void intel_wait_for_pipe_off(struct intel_crtc *crtc)
1074{ 1073{
1075 struct drm_device *dev = crtc->base.dev; 1074 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
1076 struct drm_i915_private *dev_priv = to_i915(dev);
1077 enum transcoder cpu_transcoder = crtc->config->cpu_transcoder; 1075 enum transcoder cpu_transcoder = crtc->config->cpu_transcoder;
1078 enum pipe pipe = crtc->pipe; 1076 enum pipe pipe = crtc->pipe;
1079 1077
1080 if (INTEL_INFO(dev)->gen >= 4) { 1078 if (INTEL_GEN(dev_priv) >= 4) {
1081 i915_reg_t reg = PIPECONF(cpu_transcoder); 1079 i915_reg_t reg = PIPECONF(cpu_transcoder);
1082 1080
1083 /* Wait for the Pipe State to go off */ 1081 /* Wait for the Pipe State to go off */
@@ -1087,7 +1085,7 @@ static void intel_wait_for_pipe_off(struct intel_crtc *crtc)
1087 WARN(1, "pipe_off wait timed out\n"); 1085 WARN(1, "pipe_off wait timed out\n");
1088 } else { 1086 } else {
1089 /* Wait for the display line to settle */ 1087 /* Wait for the display line to settle */
1090 if (wait_for(pipe_dsl_stopped(dev, pipe), 100)) 1088 if (wait_for(pipe_dsl_stopped(dev_priv, pipe), 100))
1091 WARN(1, "pipe_off wait timed out\n"); 1089 WARN(1, "pipe_off wait timed out\n");
1092 } 1090 }
1093} 1091}
@@ -1293,11 +1291,10 @@ static void assert_plane(struct drm_i915_private *dev_priv,
1293static void assert_planes_disabled(struct drm_i915_private *dev_priv, 1291static void assert_planes_disabled(struct drm_i915_private *dev_priv,
1294 enum pipe pipe) 1292 enum pipe pipe)
1295{ 1293{
1296 struct drm_device *dev = &dev_priv->drm;
1297 int i; 1294 int i;
1298 1295
1299 /* Primary planes are fixed to pipes on gen4+ */ 1296 /* Primary planes are fixed to pipes on gen4+ */
1300 if (INTEL_INFO(dev)->gen >= 4) { 1297 if (INTEL_GEN(dev_priv) >= 4) {
1301 u32 val = I915_READ(DSPCNTR(pipe)); 1298 u32 val = I915_READ(DSPCNTR(pipe));
1302 I915_STATE_WARN(val & DISPLAY_PLANE_ENABLE, 1299 I915_STATE_WARN(val & DISPLAY_PLANE_ENABLE,
1303 "plane %c assertion failure, should be disabled but not\n", 1300 "plane %c assertion failure, should be disabled but not\n",
@@ -1319,10 +1316,9 @@ static void assert_planes_disabled(struct drm_i915_private *dev_priv,
1319static void assert_sprites_disabled(struct drm_i915_private *dev_priv, 1316static void assert_sprites_disabled(struct drm_i915_private *dev_priv,
1320 enum pipe pipe) 1317 enum pipe pipe)
1321{ 1318{
1322 struct drm_device *dev = &dev_priv->drm;
1323 int sprite; 1319 int sprite;
1324 1320
1325 if (INTEL_INFO(dev)->gen >= 9) { 1321 if (INTEL_GEN(dev_priv) >= 9) {
1326 for_each_sprite(dev_priv, pipe, sprite) { 1322 for_each_sprite(dev_priv, pipe, sprite) {
1327 u32 val = I915_READ(PLANE_CTL(pipe, sprite)); 1323 u32 val = I915_READ(PLANE_CTL(pipe, sprite));
1328 I915_STATE_WARN(val & PLANE_CTL_ENABLE, 1324 I915_STATE_WARN(val & PLANE_CTL_ENABLE,
@@ -1336,12 +1332,12 @@ static void assert_sprites_disabled(struct drm_i915_private *dev_priv,
1336 "sprite %c assertion failure, should be off on pipe %c but is still active\n", 1332 "sprite %c assertion failure, should be off on pipe %c but is still active\n",
1337 sprite_name(pipe, sprite), pipe_name(pipe)); 1333 sprite_name(pipe, sprite), pipe_name(pipe));
1338 } 1334 }
1339 } else if (INTEL_INFO(dev)->gen >= 7) { 1335 } else if (INTEL_GEN(dev_priv) >= 7) {
1340 u32 val = I915_READ(SPRCTL(pipe)); 1336 u32 val = I915_READ(SPRCTL(pipe));
1341 I915_STATE_WARN(val & SPRITE_ENABLE, 1337 I915_STATE_WARN(val & SPRITE_ENABLE,
1342 "sprite %c assertion failure, should be off on pipe %c but is still active\n", 1338 "sprite %c assertion failure, should be off on pipe %c but is still active\n",
1343 plane_name(pipe), pipe_name(pipe)); 1339 plane_name(pipe), pipe_name(pipe));
1344 } else if (INTEL_INFO(dev)->gen >= 5) { 1340 } else if (INTEL_GEN(dev_priv) >= 5) {
1345 u32 val = I915_READ(DVSCNTR(pipe)); 1341 u32 val = I915_READ(DVSCNTR(pipe));
1346 I915_STATE_WARN(val & DVS_ENABLE, 1342 I915_STATE_WARN(val & DVS_ENABLE,
1347 "sprite %c assertion failure, should be off on pipe %c but is still active\n", 1343 "sprite %c assertion failure, should be off on pipe %c but is still active\n",
@@ -1595,12 +1591,12 @@ static void chv_enable_pll(struct intel_crtc *crtc,
1595 } 1591 }
1596} 1592}
1597 1593
1598static int intel_num_dvo_pipes(struct drm_device *dev) 1594static int intel_num_dvo_pipes(struct drm_i915_private *dev_priv)
1599{ 1595{
1600 struct intel_crtc *crtc; 1596 struct intel_crtc *crtc;
1601 int count = 0; 1597 int count = 0;
1602 1598
1603 for_each_intel_crtc(dev, crtc) { 1599 for_each_intel_crtc(&dev_priv->drm, crtc) {
1604 count += crtc->base.state->active && 1600 count += crtc->base.state->active &&
1605 intel_crtc_has_type(crtc->config, INTEL_OUTPUT_DVO); 1601 intel_crtc_has_type(crtc->config, INTEL_OUTPUT_DVO);
1606 } 1602 }
@@ -1610,8 +1606,7 @@ static int intel_num_dvo_pipes(struct drm_device *dev)
1610 1606
1611static void i9xx_enable_pll(struct intel_crtc *crtc) 1607static void i9xx_enable_pll(struct intel_crtc *crtc)
1612{ 1608{
1613 struct drm_device *dev = crtc->base.dev; 1609 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
1614 struct drm_i915_private *dev_priv = to_i915(dev);
1615 i915_reg_t reg = DPLL(crtc->pipe); 1610 i915_reg_t reg = DPLL(crtc->pipe);
1616 u32 dpll = crtc->config->dpll_hw_state.dpll; 1611 u32 dpll = crtc->config->dpll_hw_state.dpll;
1617 1612
@@ -1622,7 +1617,7 @@ static void i9xx_enable_pll(struct intel_crtc *crtc)
1622 assert_panel_unlocked(dev_priv, crtc->pipe); 1617 assert_panel_unlocked(dev_priv, crtc->pipe);
1623 1618
1624 /* Enable DVO 2x clock on both PLLs if necessary */ 1619 /* Enable DVO 2x clock on both PLLs if necessary */
1625 if (IS_I830(dev_priv) && intel_num_dvo_pipes(dev) > 0) { 1620 if (IS_I830(dev_priv) && intel_num_dvo_pipes(dev_priv) > 0) {
1626 /* 1621 /*
1627 * It appears to be important that we don't enable this 1622 * It appears to be important that we don't enable this
1628 * for the current pipe before otherwise configuring the 1623 * for the current pipe before otherwise configuring the
@@ -1647,7 +1642,7 @@ static void i9xx_enable_pll(struct intel_crtc *crtc)
1647 POSTING_READ(reg); 1642 POSTING_READ(reg);
1648 udelay(150); 1643 udelay(150);
1649 1644
1650 if (INTEL_INFO(dev)->gen >= 4) { 1645 if (INTEL_GEN(dev_priv) >= 4) {
1651 I915_WRITE(DPLL_MD(crtc->pipe), 1646 I915_WRITE(DPLL_MD(crtc->pipe),
1652 crtc->config->dpll_hw_state.dpll_md); 1647 crtc->config->dpll_hw_state.dpll_md);
1653 } else { 1648 } else {
@@ -1682,14 +1677,13 @@ static void i9xx_enable_pll(struct intel_crtc *crtc)
1682 */ 1677 */
1683static void i9xx_disable_pll(struct intel_crtc *crtc) 1678static void i9xx_disable_pll(struct intel_crtc *crtc)
1684{ 1679{
1685 struct drm_device *dev = crtc->base.dev; 1680 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
1686 struct drm_i915_private *dev_priv = to_i915(dev);
1687 enum pipe pipe = crtc->pipe; 1681 enum pipe pipe = crtc->pipe;
1688 1682
1689 /* Disable DVO 2x clock on both PLLs if necessary */ 1683 /* Disable DVO 2x clock on both PLLs if necessary */
1690 if (IS_I830(dev_priv) && 1684 if (IS_I830(dev_priv) &&
1691 intel_crtc_has_type(crtc->config, INTEL_OUTPUT_DVO) && 1685 intel_crtc_has_type(crtc->config, INTEL_OUTPUT_DVO) &&
1692 !intel_num_dvo_pipes(dev)) { 1686 !intel_num_dvo_pipes(dev_priv)) {
1693 I915_WRITE(DPLL(PIPE_B), 1687 I915_WRITE(DPLL(PIPE_B),
1694 I915_READ(DPLL(PIPE_B)) & ~DPLL_DVO_2X_MODE); 1688 I915_READ(DPLL(PIPE_B)) & ~DPLL_DVO_2X_MODE);
1695 I915_WRITE(DPLL(PIPE_A), 1689 I915_WRITE(DPLL(PIPE_A),
@@ -3004,8 +2998,7 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,
3004 const struct intel_crtc_state *crtc_state, 2998 const struct intel_crtc_state *crtc_state,
3005 const struct intel_plane_state *plane_state) 2999 const struct intel_plane_state *plane_state)
3006{ 3000{
3007 struct drm_device *dev = primary->dev; 3001 struct drm_i915_private *dev_priv = to_i915(primary->dev);
3008 struct drm_i915_private *dev_priv = to_i915(dev);
3009 struct intel_crtc *intel_crtc = to_intel_crtc(crtc_state->base.crtc); 3002 struct intel_crtc *intel_crtc = to_intel_crtc(crtc_state->base.crtc);
3010 struct drm_framebuffer *fb = plane_state->base.fb; 3003 struct drm_framebuffer *fb = plane_state->base.fb;
3011 int plane = intel_crtc->plane; 3004 int plane = intel_crtc->plane;
@@ -3020,7 +3013,7 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,
3020 3013
3021 dspcntr |= DISPLAY_PLANE_ENABLE; 3014 dspcntr |= DISPLAY_PLANE_ENABLE;
3022 3015
3023 if (INTEL_INFO(dev)->gen < 4) { 3016 if (INTEL_GEN(dev_priv) < 4) {
3024 if (intel_crtc->pipe == PIPE_B) 3017 if (intel_crtc->pipe == PIPE_B)
3025 dspcntr |= DISPPLANE_SEL_PIPE_B; 3018 dspcntr |= DISPPLANE_SEL_PIPE_B;
3026 3019
@@ -3080,7 +3073,7 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,
3080 3073
3081 intel_add_fb_offsets(&x, &y, plane_state, 0); 3074 intel_add_fb_offsets(&x, &y, plane_state, 0);
3082 3075
3083 if (INTEL_INFO(dev)->gen >= 4) 3076 if (INTEL_GEN(dev_priv) >= 4)
3084 intel_crtc->dspaddr_offset = 3077 intel_crtc->dspaddr_offset =
3085 intel_compute_tile_offset(&x, &y, plane_state, 0); 3078 intel_compute_tile_offset(&x, &y, plane_state, 0);
3086 3079
@@ -3093,7 +3086,7 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,
3093 3086
3094 linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0); 3087 linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0);
3095 3088
3096 if (INTEL_INFO(dev)->gen < 4) 3089 if (INTEL_GEN(dev_priv) < 4)
3097 intel_crtc->dspaddr_offset = linear_offset; 3090 intel_crtc->dspaddr_offset = linear_offset;
3098 3091
3099 intel_crtc->adjusted_x = x; 3092 intel_crtc->adjusted_x = x;
@@ -3102,7 +3095,7 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,
3102 I915_WRITE(reg, dspcntr); 3095 I915_WRITE(reg, dspcntr);
3103 3096
3104 I915_WRITE(DSPSTRIDE(plane), fb->pitches[0]); 3097 I915_WRITE(DSPSTRIDE(plane), fb->pitches[0]);
3105 if (INTEL_INFO(dev)->gen >= 4) { 3098 if (INTEL_GEN(dev_priv) >= 4) {
3106 I915_WRITE(DSPSURF(plane), 3099 I915_WRITE(DSPSURF(plane),
3107 intel_fb_gtt_offset(fb, rotation) + 3100 intel_fb_gtt_offset(fb, rotation) +
3108 intel_crtc->dspaddr_offset); 3101 intel_crtc->dspaddr_offset);
@@ -3680,8 +3673,7 @@ static bool intel_crtc_has_pending_flip(struct drm_crtc *crtc)
3680static void intel_update_pipe_config(struct intel_crtc *crtc, 3673static void intel_update_pipe_config(struct intel_crtc *crtc,
3681 struct intel_crtc_state *old_crtc_state) 3674 struct intel_crtc_state *old_crtc_state)
3682{ 3675{
3683 struct drm_device *dev = crtc->base.dev; 3676 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
3684 struct drm_i915_private *dev_priv = to_i915(dev);
3685 struct intel_crtc_state *pipe_config = 3677 struct intel_crtc_state *pipe_config =
3686 to_intel_crtc_state(crtc->base.state); 3678 to_intel_crtc_state(crtc->base.state);
3687 3679
@@ -3706,7 +3698,7 @@ static void intel_update_pipe_config(struct intel_crtc *crtc,
3706 (pipe_config->pipe_src_h - 1)); 3698 (pipe_config->pipe_src_h - 1));
3707 3699
3708 /* on skylake this is done by detaching scalers */ 3700 /* on skylake this is done by detaching scalers */
3709 if (INTEL_INFO(dev)->gen >= 9) { 3701 if (INTEL_GEN(dev_priv) >= 9) {
3710 skl_detach_scalers(crtc); 3702 skl_detach_scalers(crtc);
3711 3703
3712 if (pipe_config->pch_pfit.enabled) 3704 if (pipe_config->pch_pfit.enabled)
@@ -5406,8 +5398,7 @@ static void haswell_crtc_enable(struct intel_crtc_state *pipe_config,
5406 struct drm_atomic_state *old_state) 5398 struct drm_atomic_state *old_state)
5407{ 5399{
5408 struct drm_crtc *crtc = pipe_config->base.crtc; 5400 struct drm_crtc *crtc = pipe_config->base.crtc;
5409 struct drm_device *dev = crtc->dev; 5401 struct drm_i915_private *dev_priv = to_i915(crtc->dev);
5410 struct drm_i915_private *dev_priv = to_i915(dev);
5411 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 5402 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
5412 int pipe = intel_crtc->pipe, hsw_workaround_pipe; 5403 int pipe = intel_crtc->pipe, hsw_workaround_pipe;
5413 enum transcoder cpu_transcoder = intel_crtc->config->cpu_transcoder; 5404 enum transcoder cpu_transcoder = intel_crtc->config->cpu_transcoder;
@@ -5467,7 +5458,7 @@ static void haswell_crtc_enable(struct intel_crtc_state *pipe_config,
5467 if (!transcoder_is_dsi(cpu_transcoder)) 5458 if (!transcoder_is_dsi(cpu_transcoder))
5468 intel_ddi_enable_pipe_clock(intel_crtc); 5459 intel_ddi_enable_pipe_clock(intel_crtc);
5469 5460
5470 if (INTEL_INFO(dev)->gen >= 9) 5461 if (INTEL_GEN(dev_priv) >= 9)
5471 skylake_pfit_enable(intel_crtc); 5462 skylake_pfit_enable(intel_crtc);
5472 else 5463 else
5473 ironlake_pfit_enable(intel_crtc); 5464 ironlake_pfit_enable(intel_crtc);
@@ -5600,8 +5591,7 @@ static void haswell_crtc_disable(struct intel_crtc_state *old_crtc_state,
5600 struct drm_atomic_state *old_state) 5591 struct drm_atomic_state *old_state)
5601{ 5592{
5602 struct drm_crtc *crtc = old_crtc_state->base.crtc; 5593 struct drm_crtc *crtc = old_crtc_state->base.crtc;
5603 struct drm_device *dev = crtc->dev; 5594 struct drm_i915_private *dev_priv = to_i915(crtc->dev);
5604 struct drm_i915_private *dev_priv = to_i915(dev);
5605 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 5595 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
5606 enum transcoder cpu_transcoder = intel_crtc->config->cpu_transcoder; 5596 enum transcoder cpu_transcoder = intel_crtc->config->cpu_transcoder;
5607 5597
@@ -5624,7 +5614,7 @@ static void haswell_crtc_disable(struct intel_crtc_state *old_crtc_state,
5624 if (!transcoder_is_dsi(cpu_transcoder)) 5614 if (!transcoder_is_dsi(cpu_transcoder))
5625 intel_ddi_disable_transcoder_func(dev_priv, cpu_transcoder); 5615 intel_ddi_disable_transcoder_func(dev_priv, cpu_transcoder);
5626 5616
5627 if (INTEL_INFO(dev)->gen >= 9) 5617 if (INTEL_GEN(dev_priv) >= 9)
5628 skylake_scaler_disable(intel_crtc); 5618 skylake_scaler_disable(intel_crtc);
5629 else 5619 else
5630 ironlake_pfit_disable(intel_crtc, false); 5620 ironlake_pfit_disable(intel_crtc, false);
@@ -7193,7 +7183,7 @@ static int intel_crtc_compute_config(struct intel_crtc *crtc,
7193 const struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode; 7183 const struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
7194 int clock_limit = dev_priv->max_dotclk_freq; 7184 int clock_limit = dev_priv->max_dotclk_freq;
7195 7185
7196 if (INTEL_INFO(dev)->gen < 4) { 7186 if (INTEL_GEN(dev_priv) < 4) {
7197 clock_limit = dev_priv->max_cdclk_freq * 9 / 10; 7187 clock_limit = dev_priv->max_cdclk_freq * 9 / 10;
7198 7188
7199 /* 7189 /*
@@ -7787,12 +7777,11 @@ static void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc,
7787 struct intel_link_m_n *m_n, 7777 struct intel_link_m_n *m_n,
7788 struct intel_link_m_n *m2_n2) 7778 struct intel_link_m_n *m2_n2)
7789{ 7779{
7790 struct drm_device *dev = crtc->base.dev; 7780 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
7791 struct drm_i915_private *dev_priv = to_i915(dev);
7792 int pipe = crtc->pipe; 7781 int pipe = crtc->pipe;
7793 enum transcoder transcoder = crtc->config->cpu_transcoder; 7782 enum transcoder transcoder = crtc->config->cpu_transcoder;
7794 7783
7795 if (INTEL_INFO(dev)->gen >= 5) { 7784 if (INTEL_GEN(dev_priv) >= 5) {
7796 I915_WRITE(PIPE_DATA_M1(transcoder), TU_SIZE(m_n->tu) | m_n->gmch_m); 7785 I915_WRITE(PIPE_DATA_M1(transcoder), TU_SIZE(m_n->tu) | m_n->gmch_m);
7797 I915_WRITE(PIPE_DATA_N1(transcoder), m_n->gmch_n); 7786 I915_WRITE(PIPE_DATA_N1(transcoder), m_n->gmch_n);
7798 I915_WRITE(PIPE_LINK_M1(transcoder), m_n->link_m); 7787 I915_WRITE(PIPE_LINK_M1(transcoder), m_n->link_m);
@@ -8246,8 +8235,7 @@ static void i8xx_compute_dpll(struct intel_crtc *crtc,
8246 8235
8247static void intel_set_pipe_timings(struct intel_crtc *intel_crtc) 8236static void intel_set_pipe_timings(struct intel_crtc *intel_crtc)
8248{ 8237{
8249 struct drm_device *dev = intel_crtc->base.dev; 8238 struct drm_i915_private *dev_priv = to_i915(intel_crtc->base.dev);
8250 struct drm_i915_private *dev_priv = to_i915(dev);
8251 enum pipe pipe = intel_crtc->pipe; 8239 enum pipe pipe = intel_crtc->pipe;
8252 enum transcoder cpu_transcoder = intel_crtc->config->cpu_transcoder; 8240 enum transcoder cpu_transcoder = intel_crtc->config->cpu_transcoder;
8253 const struct drm_display_mode *adjusted_mode = &intel_crtc->config->base.adjusted_mode; 8241 const struct drm_display_mode *adjusted_mode = &intel_crtc->config->base.adjusted_mode;
@@ -8273,7 +8261,7 @@ static void intel_set_pipe_timings(struct intel_crtc *intel_crtc)
8273 vsyncshift += adjusted_mode->crtc_htotal; 8261 vsyncshift += adjusted_mode->crtc_htotal;
8274 } 8262 }
8275 8263
8276 if (INTEL_INFO(dev)->gen > 3) 8264 if (INTEL_GEN(dev_priv) > 3)
8277 I915_WRITE(VSYNCSHIFT(cpu_transcoder), vsyncshift); 8265 I915_WRITE(VSYNCSHIFT(cpu_transcoder), vsyncshift);
8278 8266
8279 I915_WRITE(HTOTAL(cpu_transcoder), 8267 I915_WRITE(HTOTAL(cpu_transcoder),
@@ -8396,8 +8384,7 @@ void intel_mode_from_pipe_config(struct drm_display_mode *mode,
8396 8384
8397static void i9xx_set_pipeconf(struct intel_crtc *intel_crtc) 8385static void i9xx_set_pipeconf(struct intel_crtc *intel_crtc)
8398{ 8386{
8399 struct drm_device *dev = intel_crtc->base.dev; 8387 struct drm_i915_private *dev_priv = to_i915(intel_crtc->base.dev);
8400 struct drm_i915_private *dev_priv = to_i915(dev);
8401 uint32_t pipeconf; 8388 uint32_t pipeconf;
8402 8389
8403 pipeconf = 0; 8390 pipeconf = 0;
@@ -8443,7 +8430,7 @@ static void i9xx_set_pipeconf(struct intel_crtc *intel_crtc)
8443 } 8430 }
8444 8431
8445 if (intel_crtc->config->base.adjusted_mode.flags & DRM_MODE_FLAG_INTERLACE) { 8432 if (intel_crtc->config->base.adjusted_mode.flags & DRM_MODE_FLAG_INTERLACE) {
8446 if (INTEL_INFO(dev)->gen < 4 || 8433 if (INTEL_GEN(dev_priv) < 4 ||
8447 intel_crtc_has_type(intel_crtc->config, INTEL_OUTPUT_SDVO)) 8434 intel_crtc_has_type(intel_crtc->config, INTEL_OUTPUT_SDVO))
8448 pipeconf |= PIPECONF_INTERLACE_W_FIELD_INDICATION; 8435 pipeconf |= PIPECONF_INTERLACE_W_FIELD_INDICATION;
8449 else 8436 else
@@ -8651,8 +8638,7 @@ static int vlv_crtc_compute_clock(struct intel_crtc *crtc,
8651static void i9xx_get_pfit_config(struct intel_crtc *crtc, 8638static void i9xx_get_pfit_config(struct intel_crtc *crtc,
8652 struct intel_crtc_state *pipe_config) 8639 struct intel_crtc_state *pipe_config)
8653{ 8640{
8654 struct drm_device *dev = crtc->base.dev; 8641 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
8655 struct drm_i915_private *dev_priv = to_i915(dev);
8656 uint32_t tmp; 8642 uint32_t tmp;
8657 8643
8658 if (INTEL_GEN(dev_priv) <= 3 && 8644 if (INTEL_GEN(dev_priv) <= 3 &&
@@ -8664,7 +8650,7 @@ static void i9xx_get_pfit_config(struct intel_crtc *crtc,
8664 return; 8650 return;
8665 8651
8666 /* Check whether the pfit is attached to our pipe. */ 8652 /* Check whether the pfit is attached to our pipe. */
8667 if (INTEL_INFO(dev)->gen < 4) { 8653 if (INTEL_GEN(dev_priv) < 4) {
8668 if (crtc->pipe != PIPE_B) 8654 if (crtc->pipe != PIPE_B)
8669 return; 8655 return;
8670 } else { 8656 } else {
@@ -8728,7 +8714,7 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc,
8728 8714
8729 fb = &intel_fb->base; 8715 fb = &intel_fb->base;
8730 8716
8731 if (INTEL_INFO(dev)->gen >= 4) { 8717 if (INTEL_GEN(dev_priv) >= 4) {
8732 if (val & DISPPLANE_TILED) { 8718 if (val & DISPPLANE_TILED) {
8733 plane_config->tiling = I915_TILING_X; 8719 plane_config->tiling = I915_TILING_X;
8734 fb->modifier[0] = I915_FORMAT_MOD_X_TILED; 8720 fb->modifier[0] = I915_FORMAT_MOD_X_TILED;
@@ -8740,7 +8726,7 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc,
8740 fb->pixel_format = fourcc; 8726 fb->pixel_format = fourcc;
8741 fb->bits_per_pixel = drm_format_plane_cpp(fourcc, 0) * 8; 8727 fb->bits_per_pixel = drm_format_plane_cpp(fourcc, 0) * 8;
8742 8728
8743 if (INTEL_INFO(dev)->gen >= 4) { 8729 if (INTEL_GEN(dev_priv) >= 4) {
8744 if (plane_config->tiling) 8730 if (plane_config->tiling)
8745 offset = I915_READ(DSPTILEOFF(plane)); 8731 offset = I915_READ(DSPTILEOFF(plane));
8746 else 8732 else
@@ -8809,8 +8795,7 @@ static void chv_crtc_clock_get(struct intel_crtc *crtc,
8809static bool i9xx_get_pipe_config(struct intel_crtc *crtc, 8795static bool i9xx_get_pipe_config(struct intel_crtc *crtc,
8810 struct intel_crtc_state *pipe_config) 8796 struct intel_crtc_state *pipe_config)
8811{ 8797{
8812 struct drm_device *dev = crtc->base.dev; 8798 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
8813 struct drm_i915_private *dev_priv = to_i915(dev);
8814 enum intel_display_power_domain power_domain; 8799 enum intel_display_power_domain power_domain;
8815 uint32_t tmp; 8800 uint32_t tmp;
8816 bool ret; 8801 bool ret;
@@ -8849,7 +8834,7 @@ static bool i9xx_get_pipe_config(struct intel_crtc *crtc,
8849 (tmp & PIPECONF_COLOR_RANGE_SELECT)) 8834 (tmp & PIPECONF_COLOR_RANGE_SELECT))
8850 pipe_config->limited_color_range = true; 8835 pipe_config->limited_color_range = true;
8851 8836
8852 if (INTEL_INFO(dev)->gen < 4) 8837 if (INTEL_GEN(dev_priv) < 4)
8853 pipe_config->double_wide = tmp & PIPECONF_DOUBLE_WIDE; 8838 pipe_config->double_wide = tmp & PIPECONF_DOUBLE_WIDE;
8854 8839
8855 intel_get_pipe_timings(crtc, pipe_config); 8840 intel_get_pipe_timings(crtc, pipe_config);
@@ -8857,7 +8842,7 @@ static bool i9xx_get_pipe_config(struct intel_crtc *crtc,
8857 8842
8858 i9xx_get_pfit_config(crtc, pipe_config); 8843 i9xx_get_pfit_config(crtc, pipe_config);
8859 8844
8860 if (INTEL_INFO(dev)->gen >= 4) { 8845 if (INTEL_GEN(dev_priv) >= 4) {
8861 /* No way to read it out on pipes B and C */ 8846 /* No way to read it out on pipes B and C */
8862 if (IS_CHERRYVIEW(dev_priv) && crtc->pipe != PIPE_A) 8847 if (IS_CHERRYVIEW(dev_priv) && crtc->pipe != PIPE_A)
8863 tmp = dev_priv->chv_dpll_md[crtc->pipe]; 8848 tmp = dev_priv->chv_dpll_md[crtc->pipe];
@@ -9654,11 +9639,10 @@ static void intel_cpu_transcoder_get_m_n(struct intel_crtc *crtc,
9654 struct intel_link_m_n *m_n, 9639 struct intel_link_m_n *m_n,
9655 struct intel_link_m_n *m2_n2) 9640 struct intel_link_m_n *m2_n2)
9656{ 9641{
9657 struct drm_device *dev = crtc->base.dev; 9642 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
9658 struct drm_i915_private *dev_priv = to_i915(dev);
9659 enum pipe pipe = crtc->pipe; 9643 enum pipe pipe = crtc->pipe;
9660 9644
9661 if (INTEL_INFO(dev)->gen >= 5) { 9645 if (INTEL_GEN(dev_priv) >= 5) {
9662 m_n->link_m = I915_READ(PIPE_LINK_M1(transcoder)); 9646 m_n->link_m = I915_READ(PIPE_LINK_M1(transcoder));
9663 m_n->link_n = I915_READ(PIPE_LINK_N1(transcoder)); 9647 m_n->link_n = I915_READ(PIPE_LINK_N1(transcoder));
9664 m_n->gmch_m = I915_READ(PIPE_DATA_M1(transcoder)) 9648 m_n->gmch_m = I915_READ(PIPE_DATA_M1(transcoder))
@@ -9670,7 +9654,7 @@ static void intel_cpu_transcoder_get_m_n(struct intel_crtc *crtc,
9670 * gen < 8) and if DRRS is supported (to make sure the 9654 * gen < 8) and if DRRS is supported (to make sure the
9671 * registers are not unnecessarily read). 9655 * registers are not unnecessarily read).
9672 */ 9656 */
9673 if (m2_n2 && INTEL_INFO(dev)->gen < 8 && 9657 if (m2_n2 && INTEL_GEN(dev_priv) < 8 &&
9674 crtc->config->has_drrs) { 9658 crtc->config->has_drrs) {
9675 m2_n2->link_m = I915_READ(PIPE_LINK_M2(transcoder)); 9659 m2_n2->link_m = I915_READ(PIPE_LINK_M2(transcoder));
9676 m2_n2->link_n = I915_READ(PIPE_LINK_N2(transcoder)); 9660 m2_n2->link_n = I915_READ(PIPE_LINK_N2(transcoder));
@@ -9872,7 +9856,7 @@ ironlake_get_initial_plane_config(struct intel_crtc *crtc,
9872 9856
9873 fb = &intel_fb->base; 9857 fb = &intel_fb->base;
9874 9858
9875 if (INTEL_INFO(dev)->gen >= 4) { 9859 if (INTEL_GEN(dev_priv) >= 4) {
9876 if (val & DISPPLANE_TILED) { 9860 if (val & DISPPLANE_TILED) {
9877 plane_config->tiling = I915_TILING_X; 9861 plane_config->tiling = I915_TILING_X;
9878 fb->modifier[0] = I915_FORMAT_MOD_X_TILED; 9862 fb->modifier[0] = I915_FORMAT_MOD_X_TILED;
@@ -10662,8 +10646,7 @@ static bool bxt_get_dsi_transcoder_state(struct intel_crtc *crtc,
10662static void haswell_get_ddi_port_state(struct intel_crtc *crtc, 10646static void haswell_get_ddi_port_state(struct intel_crtc *crtc,
10663 struct intel_crtc_state *pipe_config) 10647 struct intel_crtc_state *pipe_config)
10664{ 10648{
10665 struct drm_device *dev = crtc->base.dev; 10649 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
10666 struct drm_i915_private *dev_priv = to_i915(dev);
10667 struct intel_shared_dpll *pll; 10650 struct intel_shared_dpll *pll;
10668 enum port port; 10651 enum port port;
10669 uint32_t tmp; 10652 uint32_t tmp;
@@ -10690,7 +10673,7 @@ static void haswell_get_ddi_port_state(struct intel_crtc *crtc,
10690 * DDI E. So just check whether this pipe is wired to DDI E and whether 10673 * DDI E. So just check whether this pipe is wired to DDI E and whether
10691 * the PCH transcoder is on. 10674 * the PCH transcoder is on.
10692 */ 10675 */
10693 if (INTEL_INFO(dev)->gen < 9 && 10676 if (INTEL_GEN(dev_priv) < 9 &&
10694 (port == PORT_E) && I915_READ(LPT_TRANSCONF) & TRANS_ENABLE) { 10677 (port == PORT_E) && I915_READ(LPT_TRANSCONF) & TRANS_ENABLE) {
10695 pipe_config->has_pch_encoder = true; 10678 pipe_config->has_pch_encoder = true;
10696 10679
@@ -10705,8 +10688,7 @@ static void haswell_get_ddi_port_state(struct intel_crtc *crtc,
10705static bool haswell_get_pipe_config(struct intel_crtc *crtc, 10688static bool haswell_get_pipe_config(struct intel_crtc *crtc,
10706 struct intel_crtc_state *pipe_config) 10689 struct intel_crtc_state *pipe_config)
10707{ 10690{
10708 struct drm_device *dev = crtc->base.dev; 10691 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
10709 struct drm_i915_private *dev_priv = to_i915(dev);
10710 enum intel_display_power_domain power_domain; 10692 enum intel_display_power_domain power_domain;
10711 unsigned long power_domain_mask; 10693 unsigned long power_domain_mask;
10712 bool active; 10694 bool active;
@@ -10739,7 +10721,7 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc,
10739 pipe_config->gamma_mode = 10721 pipe_config->gamma_mode =
10740 I915_READ(GAMMA_MODE(crtc->pipe)) & GAMMA_MODE_MODE_MASK; 10722 I915_READ(GAMMA_MODE(crtc->pipe)) & GAMMA_MODE_MODE_MASK;
10741 10723
10742 if (INTEL_INFO(dev)->gen >= 9) { 10724 if (INTEL_GEN(dev_priv) >= 9) {
10743 skl_init_scalers(dev_priv, crtc, pipe_config); 10725 skl_init_scalers(dev_priv, crtc, pipe_config);
10744 10726
10745 pipe_config->scaler_state.scaler_id = -1; 10727 pipe_config->scaler_state.scaler_id = -1;
@@ -10749,7 +10731,7 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc,
10749 power_domain = POWER_DOMAIN_PIPE_PANEL_FITTER(crtc->pipe); 10731 power_domain = POWER_DOMAIN_PIPE_PANEL_FITTER(crtc->pipe);
10750 if (intel_display_power_get_if_enabled(dev_priv, power_domain)) { 10732 if (intel_display_power_get_if_enabled(dev_priv, power_domain)) {
10751 power_domain_mask |= BIT(power_domain); 10733 power_domain_mask |= BIT(power_domain);
10752 if (INTEL_INFO(dev)->gen >= 9) 10734 if (INTEL_GEN(dev_priv) >= 9)
10753 skylake_get_pfit_config(crtc, pipe_config); 10735 skylake_get_pfit_config(crtc, pipe_config);
10754 else 10736 else
10755 ironlake_get_pfit_config(crtc, pipe_config); 10737 ironlake_get_pfit_config(crtc, pipe_config);
@@ -12181,7 +12163,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
12181 * TILEOFF/LINOFF registers can't be changed via MI display flips. 12163 * TILEOFF/LINOFF registers can't be changed via MI display flips.
12182 * Note that pitch changes could also affect these register. 12164 * Note that pitch changes could also affect these register.
12183 */ 12165 */
12184 if (INTEL_INFO(dev)->gen > 3 && 12166 if (INTEL_GEN(dev_priv) > 3 &&
12185 (fb->offsets[0] != crtc->primary->fb->offsets[0] || 12167 (fb->offsets[0] != crtc->primary->fb->offsets[0] ||
12186 fb->pitches[0] != crtc->primary->fb->pitches[0])) 12168 fb->pitches[0] != crtc->primary->fb->pitches[0]))
12187 return -EINVAL; 12169 return -EINVAL;
@@ -12256,7 +12238,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
12256 engine = NULL; 12238 engine = NULL;
12257 } else if (IS_IVYBRIDGE(dev_priv) || IS_HASWELL(dev_priv)) { 12239 } else if (IS_IVYBRIDGE(dev_priv) || IS_HASWELL(dev_priv)) {
12258 engine = dev_priv->engine[BCS]; 12240 engine = dev_priv->engine[BCS];
12259 } else if (INTEL_INFO(dev)->gen >= 7) { 12241 } else if (INTEL_GEN(dev_priv) >= 7) {
12260 engine = i915_gem_object_last_write_engine(obj); 12242 engine = i915_gem_object_last_write_engine(obj);
12261 if (engine == NULL || engine->id != RCS) 12243 if (engine == NULL || engine->id != RCS)
12262 engine = dev_priv->engine[BCS]; 12244 engine = dev_priv->engine[BCS];
@@ -12513,7 +12495,7 @@ int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state,
12513 12495
12514 /* Pre-gen9 platforms need two-step watermark updates */ 12496 /* Pre-gen9 platforms need two-step watermark updates */
12515 if ((pipe_config->update_wm_pre || pipe_config->update_wm_post) && 12497 if ((pipe_config->update_wm_pre || pipe_config->update_wm_post) &&
12516 INTEL_INFO(dev)->gen < 9 && dev_priv->display.optimize_watermarks) 12498 INTEL_GEN(dev_priv) < 9 && dev_priv->display.optimize_watermarks)
12517 to_intel_crtc_state(crtc_state)->wm.need_postvbl_update = true; 12499 to_intel_crtc_state(crtc_state)->wm.need_postvbl_update = true;
12518 12500
12519 if (visible || was_visible) 12501 if (visible || was_visible)
@@ -12618,7 +12600,7 @@ static int intel_crtc_atomic_check(struct drm_crtc *crtc,
12618 * old state and the new state. We can program these 12600 * old state and the new state. We can program these
12619 * immediately. 12601 * immediately.
12620 */ 12602 */
12621 ret = dev_priv->display.compute_intermediate_wm(crtc->dev, 12603 ret = dev_priv->display.compute_intermediate_wm(dev,
12622 intel_crtc, 12604 intel_crtc,
12623 pipe_config); 12605 pipe_config);
12624 if (ret) { 12606 if (ret) {
@@ -12630,7 +12612,7 @@ static int intel_crtc_atomic_check(struct drm_crtc *crtc,
12630 pipe_config->wm.ilk.intermediate = pipe_config->wm.ilk.optimal; 12612 pipe_config->wm.ilk.intermediate = pipe_config->wm.ilk.optimal;
12631 } 12613 }
12632 12614
12633 if (INTEL_INFO(dev)->gen >= 9) { 12615 if (INTEL_GEN(dev_priv) >= 9) {
12634 if (mode_changed) 12616 if (mode_changed)
12635 ret = skl_update_scaler_crtc(pipe_config); 12617 ret = skl_update_scaler_crtc(pipe_config);
12636 12618
@@ -13187,12 +13169,11 @@ intel_compare_link_m_n(const struct intel_link_m_n *m_n,
13187} 13169}
13188 13170
13189static bool 13171static bool
13190intel_pipe_config_compare(struct drm_device *dev, 13172intel_pipe_config_compare(struct drm_i915_private *dev_priv,
13191 struct intel_crtc_state *current_config, 13173 struct intel_crtc_state *current_config,
13192 struct intel_crtc_state *pipe_config, 13174 struct intel_crtc_state *pipe_config,
13193 bool adjust) 13175 bool adjust)
13194{ 13176{
13195 struct drm_i915_private *dev_priv = to_i915(dev);
13196 bool ret = true; 13177 bool ret = true;
13197 13178
13198#define INTEL_ERR_OR_DBG_KMS(fmt, ...) \ 13179#define INTEL_ERR_OR_DBG_KMS(fmt, ...) \
@@ -13312,7 +13293,7 @@ intel_pipe_config_compare(struct drm_device *dev,
13312 PIPE_CONF_CHECK_I(lane_count); 13293 PIPE_CONF_CHECK_I(lane_count);
13313 PIPE_CONF_CHECK_X(lane_lat_optim_mask); 13294 PIPE_CONF_CHECK_X(lane_lat_optim_mask);
13314 13295
13315 if (INTEL_INFO(dev)->gen < 8) { 13296 if (INTEL_GEN(dev_priv) < 8) {
13316 PIPE_CONF_CHECK_M_N(dp_m_n); 13297 PIPE_CONF_CHECK_M_N(dp_m_n);
13317 13298
13318 if (current_config->has_drrs) 13299 if (current_config->has_drrs)
@@ -13361,7 +13342,7 @@ intel_pipe_config_compare(struct drm_device *dev,
13361 13342
13362 PIPE_CONF_CHECK_X(gmch_pfit.control); 13343 PIPE_CONF_CHECK_X(gmch_pfit.control);
13363 /* pfit ratios are autocomputed by the hw on gen4+ */ 13344 /* pfit ratios are autocomputed by the hw on gen4+ */
13364 if (INTEL_INFO(dev)->gen < 4) 13345 if (INTEL_GEN(dev_priv) < 4)
13365 PIPE_CONF_CHECK_X(gmch_pfit.pgm_ratios); 13346 PIPE_CONF_CHECK_X(gmch_pfit.pgm_ratios);
13366 PIPE_CONF_CHECK_X(gmch_pfit.lvds_border_bits); 13347 PIPE_CONF_CHECK_X(gmch_pfit.lvds_border_bits);
13367 13348
@@ -13436,8 +13417,7 @@ static void intel_pipe_config_sanity_check(struct drm_i915_private *dev_priv,
13436static void verify_wm_state(struct drm_crtc *crtc, 13417static void verify_wm_state(struct drm_crtc *crtc,
13437 struct drm_crtc_state *new_state) 13418 struct drm_crtc_state *new_state)
13438{ 13419{
13439 struct drm_device *dev = crtc->dev; 13420 struct drm_i915_private *dev_priv = to_i915(crtc->dev);
13440 struct drm_i915_private *dev_priv = to_i915(dev);
13441 struct skl_ddb_allocation hw_ddb, *sw_ddb; 13421 struct skl_ddb_allocation hw_ddb, *sw_ddb;
13442 struct skl_pipe_wm hw_wm, *sw_wm; 13422 struct skl_pipe_wm hw_wm, *sw_wm;
13443 struct skl_plane_wm *hw_plane_wm, *sw_plane_wm; 13423 struct skl_plane_wm *hw_plane_wm, *sw_plane_wm;
@@ -13446,7 +13426,7 @@ static void verify_wm_state(struct drm_crtc *crtc,
13446 const enum pipe pipe = intel_crtc->pipe; 13426 const enum pipe pipe = intel_crtc->pipe;
13447 int plane, level, max_level = ilk_wm_max_level(dev_priv); 13427 int plane, level, max_level = ilk_wm_max_level(dev_priv);
13448 13428
13449 if (INTEL_INFO(dev)->gen < 9 || !new_state->active) 13429 if (INTEL_GEN(dev_priv) < 9 || !new_state->active)
13450 return; 13430 return;
13451 13431
13452 skl_pipe_wm_get_hw_state(crtc, &hw_wm); 13432 skl_pipe_wm_get_hw_state(crtc, &hw_wm);
@@ -13675,7 +13655,7 @@ verify_crtc_state(struct drm_crtc *crtc,
13675 intel_pipe_config_sanity_check(dev_priv, pipe_config); 13655 intel_pipe_config_sanity_check(dev_priv, pipe_config);
13676 13656
13677 sw_config = to_intel_crtc_state(crtc->state); 13657 sw_config = to_intel_crtc_state(crtc->state);
13678 if (!intel_pipe_config_compare(dev, sw_config, 13658 if (!intel_pipe_config_compare(dev_priv, sw_config,
13679 pipe_config, false)) { 13659 pipe_config, false)) {
13680 I915_STATE_WARN(1, "pipe state doesn't match!\n"); 13660 I915_STATE_WARN(1, "pipe state doesn't match!\n");
13681 intel_dump_pipe_config(intel_crtc, pipe_config, 13661 intel_dump_pipe_config(intel_crtc, pipe_config,
@@ -14095,7 +14075,7 @@ static int intel_atomic_check(struct drm_device *dev,
14095 } 14075 }
14096 14076
14097 if (i915.fastboot && 14077 if (i915.fastboot &&
14098 intel_pipe_config_compare(dev, 14078 intel_pipe_config_compare(dev_priv,
14099 to_intel_crtc_state(crtc->state), 14079 to_intel_crtc_state(crtc->state),
14100 pipe_config, true)) { 14080 pipe_config, true)) {
14101 crtc_state->mode_changed = false; 14081 crtc_state->mode_changed = false;
@@ -15425,11 +15405,9 @@ static bool has_edp_a(struct drm_i915_private *dev_priv)
15425 return true; 15405 return true;
15426} 15406}
15427 15407
15428static bool intel_crt_present(struct drm_device *dev) 15408static bool intel_crt_present(struct drm_i915_private *dev_priv)
15429{ 15409{
15430 struct drm_i915_private *dev_priv = to_i915(dev); 15410 if (INTEL_GEN(dev_priv) >= 9)
15431
15432 if (INTEL_INFO(dev)->gen >= 9)
15433 return false; 15411 return false;
15434 15412
15435 if (IS_HSW_ULT(dev_priv) || IS_BDW_ULT(dev_priv)) 15413 if (IS_HSW_ULT(dev_priv) || IS_BDW_ULT(dev_priv))
@@ -15503,7 +15481,7 @@ static void intel_setup_outputs(struct drm_device *dev)
15503 */ 15481 */
15504 intel_lvds_init(dev); 15482 intel_lvds_init(dev);
15505 15483
15506 if (intel_crt_present(dev)) 15484 if (intel_crt_present(dev_priv))
15507 intel_crt_init(dev); 15485 intel_crt_init(dev);
15508 15486
15509 if (IS_BROXTON(dev_priv)) { 15487 if (IS_BROXTON(dev_priv)) {
@@ -15793,7 +15771,7 @@ static int intel_framebuffer_init(struct drm_device *dev,
15793 switch (mode_cmd->modifier[0]) { 15771 switch (mode_cmd->modifier[0]) {
15794 case I915_FORMAT_MOD_Y_TILED: 15772 case I915_FORMAT_MOD_Y_TILED:
15795 case I915_FORMAT_MOD_Yf_TILED: 15773 case I915_FORMAT_MOD_Yf_TILED:
15796 if (INTEL_INFO(dev)->gen < 9) { 15774 if (INTEL_GEN(dev_priv) < 9) {
15797 DRM_DEBUG("Unsupported tiling 0x%llx!\n", 15775 DRM_DEBUG("Unsupported tiling 0x%llx!\n",
15798 mode_cmd->modifier[0]); 15776 mode_cmd->modifier[0]);
15799 return -EINVAL; 15777 return -EINVAL;
@@ -15856,7 +15834,7 @@ static int intel_framebuffer_init(struct drm_device *dev,
15856 case DRM_FORMAT_ARGB8888: 15834 case DRM_FORMAT_ARGB8888:
15857 break; 15835 break;
15858 case DRM_FORMAT_XRGB1555: 15836 case DRM_FORMAT_XRGB1555:
15859 if (INTEL_INFO(dev)->gen > 3) { 15837 if (INTEL_GEN(dev_priv) > 3) {
15860 DRM_DEBUG("unsupported pixel format: %s\n", 15838 DRM_DEBUG("unsupported pixel format: %s\n",
15861 drm_get_format_name(mode_cmd->pixel_format, &format_name)); 15839 drm_get_format_name(mode_cmd->pixel_format, &format_name));
15862 return -EINVAL; 15840 return -EINVAL;
@@ -15864,7 +15842,7 @@ static int intel_framebuffer_init(struct drm_device *dev,
15864 break; 15842 break;
15865 case DRM_FORMAT_ABGR8888: 15843 case DRM_FORMAT_ABGR8888:
15866 if (!IS_VALLEYVIEW(dev_priv) && !IS_CHERRYVIEW(dev_priv) && 15844 if (!IS_VALLEYVIEW(dev_priv) && !IS_CHERRYVIEW(dev_priv) &&
15867 INTEL_INFO(dev)->gen < 9) { 15845 INTEL_GEN(dev_priv) < 9) {
15868 DRM_DEBUG("unsupported pixel format: %s\n", 15846 DRM_DEBUG("unsupported pixel format: %s\n",
15869 drm_get_format_name(mode_cmd->pixel_format, &format_name)); 15847 drm_get_format_name(mode_cmd->pixel_format, &format_name));
15870 return -EINVAL; 15848 return -EINVAL;
@@ -15873,7 +15851,7 @@ static int intel_framebuffer_init(struct drm_device *dev,
15873 case DRM_FORMAT_XBGR8888: 15851 case DRM_FORMAT_XBGR8888:
15874 case DRM_FORMAT_XRGB2101010: 15852 case DRM_FORMAT_XRGB2101010:
15875 case DRM_FORMAT_XBGR2101010: 15853 case DRM_FORMAT_XBGR2101010:
15876 if (INTEL_INFO(dev)->gen < 4) { 15854 if (INTEL_GEN(dev_priv) < 4) {
15877 DRM_DEBUG("unsupported pixel format: %s\n", 15855 DRM_DEBUG("unsupported pixel format: %s\n",
15878 drm_get_format_name(mode_cmd->pixel_format, &format_name)); 15856 drm_get_format_name(mode_cmd->pixel_format, &format_name));
15879 return -EINVAL; 15857 return -EINVAL;
@@ -15890,7 +15868,7 @@ static int intel_framebuffer_init(struct drm_device *dev,
15890 case DRM_FORMAT_UYVY: 15868 case DRM_FORMAT_UYVY:
15891 case DRM_FORMAT_YVYU: 15869 case DRM_FORMAT_YVYU:
15892 case DRM_FORMAT_VYUY: 15870 case DRM_FORMAT_VYUY:
15893 if (INTEL_INFO(dev)->gen < 5) { 15871 if (INTEL_GEN(dev_priv) < 5) {
15894 DRM_DEBUG("unsupported pixel format: %s\n", 15872 DRM_DEBUG("unsupported pixel format: %s\n",
15895 drm_get_format_name(mode_cmd->pixel_format, &format_name)); 15873 drm_get_format_name(mode_cmd->pixel_format, &format_name));
15896 return -EINVAL; 15874 return -EINVAL;
@@ -16667,7 +16645,7 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)
16667 /* We need to sanitize the plane -> pipe mapping first because this will 16645 /* We need to sanitize the plane -> pipe mapping first because this will
16668 * disable the crtc (and hence change the state) if it is wrong. Note 16646 * disable the crtc (and hence change the state) if it is wrong. Note
16669 * that gen4+ has a fixed plane -> pipe mapping. */ 16647 * that gen4+ has a fixed plane -> pipe mapping. */
16670 if (INTEL_INFO(dev)->gen < 4 && !intel_check_plane_mapping(crtc)) { 16648 if (INTEL_GEN(dev_priv) < 4 && !intel_check_plane_mapping(crtc)) {
16671 bool plane; 16649 bool plane;
16672 16650
16673 DRM_DEBUG_KMS("[CRTC:%d:%s] wrong plane connection detected!\n", 16651 DRM_DEBUG_KMS("[CRTC:%d:%s] wrong plane connection detected!\n",
@@ -17177,10 +17155,9 @@ void intel_connector_attach_encoder(struct intel_connector *connector,
17177/* 17155/*
17178 * set vga decode state - true == enable VGA decode 17156 * set vga decode state - true == enable VGA decode
17179 */ 17157 */
17180int intel_modeset_vga_set_state(struct drm_device *dev, bool state) 17158int intel_modeset_vga_set_state(struct drm_i915_private *dev_priv, bool state)
17181{ 17159{
17182 struct drm_i915_private *dev_priv = to_i915(dev); 17160 unsigned reg = INTEL_GEN(dev_priv) >= 6 ? SNB_GMCH_CTRL : INTEL_GMCH_CTRL;
17183 unsigned reg = INTEL_INFO(dev)->gen >= 6 ? SNB_GMCH_CTRL : INTEL_GMCH_CTRL;
17184 u16 gmch_ctrl; 17161 u16 gmch_ctrl;
17185 17162
17186 if (pci_read_config_word(dev_priv->bridge_dev, reg, &gmch_ctrl)) { 17163 if (pci_read_config_word(dev_priv->bridge_dev, reg, &gmch_ctrl)) {