aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h2
-rw-r--r--drivers/gpu/drm/i915/intel_ddi.c2
-rw-r--r--drivers/gpu/drm/i915/intel_display.c65
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c6
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h18
-rw-r--r--drivers/gpu/drm/i915/intel_lvds.c6
-rw-r--r--drivers/gpu/drm/i915/intel_panel.c25
7 files changed, 63 insertions, 61 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 8a257a9114c2..14156f2b8d76 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1021,8 +1021,6 @@ typedef struct drm_i915_private {
1021 struct sdvo_device_mapping sdvo_mappings[2]; 1021 struct sdvo_device_mapping sdvo_mappings[2];
1022 /* indicate whether the LVDS_BORDER should be enabled or not */ 1022 /* indicate whether the LVDS_BORDER should be enabled or not */
1023 unsigned int lvds_border_bits; 1023 unsigned int lvds_border_bits;
1024 /* Panel fitter placement and size for Ironlake+ */
1025 u32 pch_pf_pos, pch_pf_size;
1026 1024
1027 struct drm_crtc *plane_to_crtc_mapping[3]; 1025 struct drm_crtc *plane_to_crtc_mapping[3];
1028 struct drm_crtc *pipe_to_crtc_mapping[3]; 1026 struct drm_crtc *pipe_to_crtc_mapping[3];
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index eef450b1af44..0d7cf317b73f 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -995,7 +995,7 @@ void intel_ddi_enable_transcoder_func(struct drm_crtc *crtc)
995 /* Can only use the always-on power well for eDP when 995 /* Can only use the always-on power well for eDP when
996 * not using the panel fitter, and when not using motion 996 * not using the panel fitter, and when not using motion
997 * blur mitigation (which we don't support). */ 997 * blur mitigation (which we don't support). */
998 if (dev_priv->pch_pf_size) 998 if (intel_crtc->config.pch_pfit.size)
999 temp |= TRANS_DDI_EDP_INPUT_A_ONOFF; 999 temp |= TRANS_DDI_EDP_INPUT_A_ONOFF;
1000 else 1000 else
1001 temp |= TRANS_DDI_EDP_INPUT_A_ON; 1001 temp |= TRANS_DDI_EDP_INPUT_A_ON;
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index fc6f76837437..dacfc6c90550 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3225,6 +3225,28 @@ void intel_cpt_verify_modeset(struct drm_device *dev, int pipe)
3225 } 3225 }
3226} 3226}
3227 3227
3228static void ironlake_pfit_enable(struct intel_crtc *crtc)
3229{
3230 struct drm_device *dev = crtc->base.dev;
3231 struct drm_i915_private *dev_priv = dev->dev_private;
3232 int pipe = crtc->pipe;
3233
3234 if (crtc->config.pch_pfit.size &&
3235 intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_EDP)) {
3236 /* Force use of hard-coded filter coefficients
3237 * as some pre-programmed values are broken,
3238 * e.g. x201.
3239 */
3240 if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev))
3241 I915_WRITE(PF_CTL(pipe), PF_ENABLE | PF_FILTER_MED_3x3 |
3242 PF_PIPE_SEL_IVB(pipe));
3243 else
3244 I915_WRITE(PF_CTL(pipe), PF_ENABLE | PF_FILTER_MED_3x3);
3245 I915_WRITE(PF_WIN_POS(pipe), crtc->config.pch_pfit.pos);
3246 I915_WRITE(PF_WIN_SZ(pipe), crtc->config.pch_pfit.size);
3247 }
3248}
3249
3228static void ironlake_crtc_enable(struct drm_crtc *crtc) 3250static void ironlake_crtc_enable(struct drm_crtc *crtc)
3229{ 3251{
3230 struct drm_device *dev = crtc->dev; 3252 struct drm_device *dev = crtc->dev;
@@ -3269,21 +3291,7 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc)
3269 encoder->pre_enable(encoder); 3291 encoder->pre_enable(encoder);
3270 3292
3271 /* Enable panel fitting for LVDS */ 3293 /* Enable panel fitting for LVDS */
3272 if (dev_priv->pch_pf_size && 3294 ironlake_pfit_enable(intel_crtc);
3273 (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS) ||
3274 intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP))) {
3275 /* Force use of hard-coded filter coefficients
3276 * as some pre-programmed values are broken,
3277 * e.g. x201.
3278 */
3279 if (IS_IVYBRIDGE(dev))
3280 I915_WRITE(PF_CTL(pipe), PF_ENABLE | PF_FILTER_MED_3x3 |
3281 PF_PIPE_SEL_IVB(pipe));
3282 else
3283 I915_WRITE(PF_CTL(pipe), PF_ENABLE | PF_FILTER_MED_3x3);
3284 I915_WRITE(PF_WIN_POS(pipe), dev_priv->pch_pf_pos);
3285 I915_WRITE(PF_WIN_SZ(pipe), dev_priv->pch_pf_size);
3286 }
3287 3295
3288 /* 3296 /*
3289 * On ILK+ LUT must be loaded before the pipe is running but with 3297 * On ILK+ LUT must be loaded before the pipe is running but with
@@ -3353,17 +3361,7 @@ static void haswell_crtc_enable(struct drm_crtc *crtc)
3353 intel_ddi_enable_pipe_clock(intel_crtc); 3361 intel_ddi_enable_pipe_clock(intel_crtc);
3354 3362
3355 /* Enable panel fitting for eDP */ 3363 /* Enable panel fitting for eDP */
3356 if (dev_priv->pch_pf_size && 3364 ironlake_pfit_enable(intel_crtc);
3357 intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP)) {
3358 /* Force use of hard-coded filter coefficients
3359 * as some pre-programmed values are broken,
3360 * e.g. x201.
3361 */
3362 I915_WRITE(PF_CTL(pipe), PF_ENABLE | PF_FILTER_MED_3x3 |
3363 PF_PIPE_SEL_IVB(pipe));
3364 I915_WRITE(PF_WIN_POS(pipe), dev_priv->pch_pf_pos);
3365 I915_WRITE(PF_WIN_SZ(pipe), dev_priv->pch_pf_size);
3366 }
3367 3365
3368 /* 3366 /*
3369 * On ILK+ LUT must be loaded before the pipe is running but with 3367 * On ILK+ LUT must be loaded before the pipe is running but with
@@ -3621,11 +3619,11 @@ static void i9xx_pfit_enable(struct intel_crtc *crtc)
3621 * register description and PRM. 3619 * register description and PRM.
3622 */ 3620 */
3623 DRM_DEBUG_KMS("applying panel-fitter: %x, %x\n", 3621 DRM_DEBUG_KMS("applying panel-fitter: %x, %x\n",
3624 pipe_config->pfit_control, 3622 pipe_config->gmch_pfit.control,
3625 pipe_config->pfit_pgm_ratios); 3623 pipe_config->gmch_pfit.pgm_ratios);
3626 3624
3627 I915_WRITE(PFIT_PGM_RATIOS, pipe_config->pfit_pgm_ratios); 3625 I915_WRITE(PFIT_PGM_RATIOS, pipe_config->gmch_pfit.pgm_ratios);
3628 I915_WRITE(PFIT_CONTROL, pipe_config->pfit_control); 3626 I915_WRITE(PFIT_CONTROL, pipe_config->gmch_pfit.control);
3629} 3627}
3630 3628
3631static void valleyview_crtc_enable(struct drm_crtc *crtc) 3629static void valleyview_crtc_enable(struct drm_crtc *crtc)
@@ -5800,6 +5798,9 @@ static void haswell_modeset_global_resources(struct drm_device *dev)
5800 /* XXX: Should check for edp transcoder here, but thanks to init 5798 /* XXX: Should check for edp transcoder here, but thanks to init
5801 * sequence that's not yet available. Just in case desktop eDP 5799 * sequence that's not yet available. Just in case desktop eDP
5802 * on PORT D is possible on haswell, too. */ 5800 * on PORT D is possible on haswell, too. */
5801 /* Even the eDP panel fitter is outside the always-on well. */
5802 if (I915_READ(PF_WIN_SZ(crtc->pipe)))
5803 enable = true;
5803 } 5804 }
5804 5805
5805 list_for_each_entry(encoder, &dev->mode_config.encoder_list, 5806 list_for_each_entry(encoder, &dev->mode_config.encoder_list,
@@ -5809,10 +5810,6 @@ static void haswell_modeset_global_resources(struct drm_device *dev)
5809 enable = true; 5810 enable = true;
5810 } 5811 }
5811 5812
5812 /* Even the eDP panel fitter is outside the always-on well. */
5813 if (dev_priv->pch_pf_size)
5814 enable = true;
5815
5816 intel_set_power_well(dev, enable); 5813 intel_set_power_well(dev, enable);
5817} 5814}
5818 5815
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 9c834bc15ab7..9ac034ee0ddd 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -710,7 +710,6 @@ intel_dp_compute_config(struct intel_encoder *encoder,
710 struct drm_device *dev = encoder->base.dev; 710 struct drm_device *dev = encoder->base.dev;
711 struct drm_i915_private *dev_priv = dev->dev_private; 711 struct drm_i915_private *dev_priv = dev->dev_private;
712 struct drm_display_mode *adjusted_mode = &pipe_config->adjusted_mode; 712 struct drm_display_mode *adjusted_mode = &pipe_config->adjusted_mode;
713 struct drm_display_mode *mode = &pipe_config->requested_mode;
714 struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base); 713 struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
715 struct intel_crtc *intel_crtc = encoder->new_crtc; 714 struct intel_crtc *intel_crtc = encoder->new_crtc;
716 struct intel_connector *intel_connector = intel_dp->attached_connector; 715 struct intel_connector *intel_connector = intel_dp->attached_connector;
@@ -733,9 +732,8 @@ intel_dp_compute_config(struct intel_encoder *encoder,
733 intel_gmch_panel_fitting(intel_crtc, pipe_config, 732 intel_gmch_panel_fitting(intel_crtc, pipe_config,
734 intel_connector->panel.fitting_mode); 733 intel_connector->panel.fitting_mode);
735 else 734 else
736 intel_pch_panel_fitting(dev, 735 intel_pch_panel_fitting(intel_crtc, pipe_config,
737 intel_connector->panel.fitting_mode, 736 intel_connector->panel.fitting_mode);
738 mode, adjusted_mode);
739 } 737 }
740 /* We need to take the panel's fixed mode into account. */ 738 /* We need to take the panel's fixed mode into account. */
741 target_clock = adjusted_mode->clock; 739 target_clock = adjusted_mode->clock;
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 9f3f71bc2f22..a8c696014967 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -239,7 +239,16 @@ struct intel_crtc_config {
239 unsigned pixel_multiplier; 239 unsigned pixel_multiplier;
240 240
241 /* Panel fitter controls for gen2-gen4 + VLV */ 241 /* Panel fitter controls for gen2-gen4 + VLV */
242 u32 pfit_control, pfit_pgm_ratios; 242 struct {
243 u32 control;
244 u32 pgm_ratios;
245 } gmch_pfit;
246
247 /* Panel fitter placement and size for Ironlake+ */
248 struct {
249 u32 pos;
250 u32 size;
251 } pch_pfit;
243}; 252};
244 253
245struct intel_crtc { 254struct intel_crtc {
@@ -557,10 +566,9 @@ extern void intel_panel_fini(struct intel_panel *panel);
557 566
558extern void intel_fixed_panel_mode(struct drm_display_mode *fixed_mode, 567extern void intel_fixed_panel_mode(struct drm_display_mode *fixed_mode,
559 struct drm_display_mode *adjusted_mode); 568 struct drm_display_mode *adjusted_mode);
560extern void intel_pch_panel_fitting(struct drm_device *dev, 569extern void intel_pch_panel_fitting(struct intel_crtc *crtc,
561 int fitting_mode, 570 struct intel_crtc_config *pipe_config,
562 const struct drm_display_mode *mode, 571 int fitting_mode);
563 struct drm_display_mode *adjusted_mode);
564extern void intel_gmch_panel_fitting(struct intel_crtc *crtc, 572extern void intel_gmch_panel_fitting(struct intel_crtc *crtc,
565 struct intel_crtc_config *pipe_config, 573 struct intel_crtc_config *pipe_config,
566 int fitting_mode); 574 int fitting_mode);
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 7d418818c7a8..3e29499b2e9a 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -229,7 +229,6 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
229 struct intel_connector *intel_connector = 229 struct intel_connector *intel_connector =
230 &lvds_encoder->attached_connector->base; 230 &lvds_encoder->attached_connector->base;
231 struct drm_display_mode *adjusted_mode = &pipe_config->adjusted_mode; 231 struct drm_display_mode *adjusted_mode = &pipe_config->adjusted_mode;
232 struct drm_display_mode *mode = &pipe_config->requested_mode;
233 struct intel_crtc *intel_crtc = lvds_encoder->base.new_crtc; 232 struct intel_crtc *intel_crtc = lvds_encoder->base.new_crtc;
234 unsigned int lvds_bpp; 233 unsigned int lvds_bpp;
235 int pipe; 234 int pipe;
@@ -267,9 +266,8 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
267 if (HAS_PCH_SPLIT(dev)) { 266 if (HAS_PCH_SPLIT(dev)) {
268 pipe_config->has_pch_encoder = true; 267 pipe_config->has_pch_encoder = true;
269 268
270 intel_pch_panel_fitting(dev, 269 intel_pch_panel_fitting(intel_crtc, pipe_config,
271 intel_connector->panel.fitting_mode, 270 intel_connector->panel.fitting_mode);
272 mode, adjusted_mode);
273 return true; 271 return true;
274 } else { 272 } else {
275 intel_gmch_panel_fitting(intel_crtc, pipe_config, 273 intel_gmch_panel_fitting(intel_crtc, pipe_config,
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index 0f32f6498ad3..00f31f7336f2 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -54,14 +54,17 @@ intel_fixed_panel_mode(struct drm_display_mode *fixed_mode,
54 54
55/* adjusted_mode has been preset to be the panel's fixed mode */ 55/* adjusted_mode has been preset to be the panel's fixed mode */
56void 56void
57intel_pch_panel_fitting(struct drm_device *dev, 57intel_pch_panel_fitting(struct intel_crtc *intel_crtc,
58 int fitting_mode, 58 struct intel_crtc_config *pipe_config,
59 const struct drm_display_mode *mode, 59 int fitting_mode)
60 struct drm_display_mode *adjusted_mode)
61{ 60{
62 struct drm_i915_private *dev_priv = dev->dev_private; 61 struct drm_i915_private *dev_priv = intel_crtc->base.dev->dev_private;
62 struct drm_display_mode *mode, *adjusted_mode;
63 int x, y, width, height; 63 int x, y, width, height;
64 64
65 mode = &pipe_config->requested_mode;
66 adjusted_mode = &pipe_config->adjusted_mode;
67
65 x = y = width = height = 0; 68 x = y = width = height = 0;
66 69
67 /* Native modes don't need fitting */ 70 /* Native modes don't need fitting */
@@ -113,8 +116,8 @@ intel_pch_panel_fitting(struct drm_device *dev,
113 } 116 }
114 117
115done: 118done:
116 dev_priv->pch_pf_pos = (x << 16) | y; 119 pipe_config->pch_pfit.pos = (x << 16) | y;
117 dev_priv->pch_pf_size = (width << 16) | height; 120 pipe_config->pch_pfit.size = (width << 16) | height;
118} 121}
119 122
120static void 123static void
@@ -300,10 +303,10 @@ out:
300 if (INTEL_INFO(dev)->gen < 4 && pipe_config->pipe_bpp == 18) 303 if (INTEL_INFO(dev)->gen < 4 && pipe_config->pipe_bpp == 18)
301 pfit_control |= PANEL_8TO6_DITHER_ENABLE; 304 pfit_control |= PANEL_8TO6_DITHER_ENABLE;
302 305
303 if (pfit_control != pipe_config->pfit_control || 306 if (pfit_control != pipe_config->gmch_pfit.control ||
304 pfit_pgm_ratios != pipe_config->pfit_pgm_ratios) { 307 pfit_pgm_ratios != pipe_config->gmch_pfit.pgm_ratios) {
305 pipe_config->pfit_control = pfit_control; 308 pipe_config->gmch_pfit.control = pfit_control;
306 pipe_config->pfit_pgm_ratios = pfit_pgm_ratios; 309 pipe_config->gmch_pfit.pgm_ratios = pfit_pgm_ratios;
307 } 310 }
308 dev_priv->lvds_border_bits = border; 311 dev_priv->lvds_border_bits = border;
309} 312}