aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2013-09-04 11:25:28 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2013-09-16 17:36:49 -0400
commit37327abdfbb4e2d7c9033f450de5e36e401d6efc (patch)
tree70ffd4c8b97b0c54a14036efb46fa8b8e3a55f5f /drivers
parenta74821454249d32ba5f63a7de22bd6187be1ebd8 (diff)
drm/i915: Add explicit pipe src size to pipe config
Rather that mess about with hdisplay/vdisplay from requested_mode, add explicit pipe src size information to pipe config. Now requested_mode is only really relevant for dvo/sdvo output timings. For everything else either adjusted_mode or pipe src size should be used. In many places where we end up using pipe source size, we should actually use the primary plane size, but we don't currently store that information explicitly. As long as we treat primaries as full screen only, we can get away with this. Eventually when we move primaries over to drm_plane, we need to fix it all up. v2: Add a comment to explain what pipe_src_{w,h} are Add a note about primary planes to commit message Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/i915/intel_display.c26
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h6
-rw-r--r--drivers/gpu/drm/i915/intel_panel.c56
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c33
-rw-r--r--drivers/gpu/drm/i915/intel_sprite.c4
5 files changed, 67 insertions, 58 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 234a77d0ee4e..b8d7ad6cab91 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -4696,7 +4696,6 @@ static void intel_set_pipe_timings(struct intel_crtc *intel_crtc)
4696 enum transcoder cpu_transcoder = intel_crtc->config.cpu_transcoder; 4696 enum transcoder cpu_transcoder = intel_crtc->config.cpu_transcoder;
4697 struct drm_display_mode *adjusted_mode = 4697 struct drm_display_mode *adjusted_mode =
4698 &intel_crtc->config.adjusted_mode; 4698 &intel_crtc->config.adjusted_mode;
4699 struct drm_display_mode *mode = &intel_crtc->config.requested_mode;
4700 uint32_t vsyncshift, crtc_vtotal, crtc_vblank_end; 4699 uint32_t vsyncshift, crtc_vtotal, crtc_vblank_end;
4701 4700
4702 /* We need to be careful not to changed the adjusted mode, for otherwise 4701 /* We need to be careful not to changed the adjusted mode, for otherwise
@@ -4749,7 +4748,8 @@ static void intel_set_pipe_timings(struct intel_crtc *intel_crtc)
4749 * always be the user's requested size. 4748 * always be the user's requested size.
4750 */ 4749 */
4751 I915_WRITE(PIPESRC(pipe), 4750 I915_WRITE(PIPESRC(pipe),
4752 ((mode->hdisplay - 1) << 16) | (mode->vdisplay - 1)); 4751 ((intel_crtc->config.pipe_src_w - 1) << 16) |
4752 (intel_crtc->config.pipe_src_h - 1));
4753} 4753}
4754 4754
4755static void intel_get_pipe_timings(struct intel_crtc *crtc, 4755static void intel_get_pipe_timings(struct intel_crtc *crtc,
@@ -4787,8 +4787,11 @@ static void intel_get_pipe_timings(struct intel_crtc *crtc,
4787 } 4787 }
4788 4788
4789 tmp = I915_READ(PIPESRC(crtc->pipe)); 4789 tmp = I915_READ(PIPESRC(crtc->pipe));
4790 pipe_config->requested_mode.vdisplay = (tmp & 0xffff) + 1; 4790 pipe_config->pipe_src_h = (tmp & 0xffff) + 1;
4791 pipe_config->requested_mode.hdisplay = ((tmp >> 16) & 0xffff) + 1; 4791 pipe_config->pipe_src_w = ((tmp >> 16) & 0xffff) + 1;
4792
4793 pipe_config->requested_mode.vdisplay = pipe_config->pipe_src_h;
4794 pipe_config->requested_mode.hdisplay = pipe_config->pipe_src_w;
4792} 4795}
4793 4796
4794static void intel_crtc_mode_from_pipe_config(struct intel_crtc *intel_crtc, 4797static void intel_crtc_mode_from_pipe_config(struct intel_crtc *intel_crtc,
@@ -4884,7 +4887,6 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc,
4884 struct drm_device *dev = crtc->dev; 4887 struct drm_device *dev = crtc->dev;
4885 struct drm_i915_private *dev_priv = dev->dev_private; 4888 struct drm_i915_private *dev_priv = dev->dev_private;
4886 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 4889 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
4887 struct drm_display_mode *mode = &intel_crtc->config.requested_mode;
4888 int pipe = intel_crtc->pipe; 4890 int pipe = intel_crtc->pipe;
4889 int plane = intel_crtc->plane; 4891 int plane = intel_crtc->plane;
4890 int refclk, num_connectors = 0; 4892 int refclk, num_connectors = 0;
@@ -4983,8 +4985,8 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc,
4983 * which should always be the user's requested size. 4985 * which should always be the user's requested size.
4984 */ 4986 */
4985 I915_WRITE(DSPSIZE(plane), 4987 I915_WRITE(DSPSIZE(plane),
4986 ((mode->vdisplay - 1) << 16) | 4988 ((intel_crtc->config.pipe_src_h - 1) << 16) |
4987 (mode->hdisplay - 1)); 4989 (intel_crtc->config.pipe_src_w - 1));
4988 I915_WRITE(DSPPOS(plane), 0); 4990 I915_WRITE(DSPPOS(plane), 0);
4989 4991
4990 i9xx_set_pipeconf(intel_crtc); 4992 i9xx_set_pipeconf(intel_crtc);
@@ -8349,6 +8351,8 @@ static void intel_dump_pipe_config(struct intel_crtc *crtc,
8349 DRM_DEBUG_KMS("adjusted mode:\n"); 8351 DRM_DEBUG_KMS("adjusted mode:\n");
8350 drm_mode_debug_printmodeline(&pipe_config->adjusted_mode); 8352 drm_mode_debug_printmodeline(&pipe_config->adjusted_mode);
8351 DRM_DEBUG_KMS("port clock: %d\n", pipe_config->port_clock); 8353 DRM_DEBUG_KMS("port clock: %d\n", pipe_config->port_clock);
8354 DRM_DEBUG_KMS("pipe src size: %dx%d\n",
8355 pipe_config->pipe_src_w, pipe_config->pipe_src_h);
8352 DRM_DEBUG_KMS("gmch pfit: control: 0x%08x, ratios: 0x%08x, lvds border: 0x%08x\n", 8356 DRM_DEBUG_KMS("gmch pfit: control: 0x%08x, ratios: 0x%08x, lvds border: 0x%08x\n",
8353 pipe_config->gmch_pfit.control, 8357 pipe_config->gmch_pfit.control,
8354 pipe_config->gmch_pfit.pgm_ratios, 8358 pipe_config->gmch_pfit.pgm_ratios,
@@ -8400,6 +8404,10 @@ intel_modeset_pipe_config(struct drm_crtc *crtc,
8400 8404
8401 drm_mode_copy(&pipe_config->adjusted_mode, mode); 8405 drm_mode_copy(&pipe_config->adjusted_mode, mode);
8402 drm_mode_copy(&pipe_config->requested_mode, mode); 8406 drm_mode_copy(&pipe_config->requested_mode, mode);
8407
8408 pipe_config->pipe_src_w = mode->hdisplay;
8409 pipe_config->pipe_src_h = mode->vdisplay;
8410
8403 pipe_config->cpu_transcoder = 8411 pipe_config->cpu_transcoder =
8404 (enum transcoder) to_intel_crtc(crtc)->pipe; 8412 (enum transcoder) to_intel_crtc(crtc)->pipe;
8405 pipe_config->shared_dpll = DPLL_ID_PRIVATE; 8413 pipe_config->shared_dpll = DPLL_ID_PRIVATE;
@@ -8756,8 +8764,8 @@ intel_pipe_config_compare(struct drm_device *dev,
8756 DRM_MODE_FLAG_NVSYNC); 8764 DRM_MODE_FLAG_NVSYNC);
8757 } 8765 }
8758 8766
8759 PIPE_CONF_CHECK_I(requested_mode.hdisplay); 8767 PIPE_CONF_CHECK_I(pipe_src_w);
8760 PIPE_CONF_CHECK_I(requested_mode.vdisplay); 8768 PIPE_CONF_CHECK_I(pipe_src_h);
8761 8769
8762 PIPE_CONF_CHECK_I(gmch_pfit.control); 8770 PIPE_CONF_CHECK_I(gmch_pfit.control);
8763 /* pfit ratios are autocomputed by the hw on gen4+ */ 8771 /* pfit ratios are autocomputed by the hw on gen4+ */
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 8306940f0ae7..3046e78f31eb 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -215,6 +215,12 @@ struct intel_crtc_config {
215 /* Actual pipe timings ie. what we program into the pipe timing 215 /* Actual pipe timings ie. what we program into the pipe timing
216 * registers. adjusted_mode.clock is the pipe pixel clock. */ 216 * registers. adjusted_mode.clock is the pipe pixel clock. */
217 struct drm_display_mode adjusted_mode; 217 struct drm_display_mode adjusted_mode;
218
219 /* Pipe source size (ie. panel fitter input size)
220 * All planes will be positioned inside this space,
221 * and get clipped at the edges. */
222 int pipe_src_w, pipe_src_h;
223
218 /* Whether to set up the PCH/FDI. Note that we never allow sharing 224 /* Whether to set up the PCH/FDI. Note that we never allow sharing
219 * between pch encoders and cpu encoders. */ 225 * between pch encoders and cpu encoders. */
220 bool has_pch_encoder; 226 bool has_pch_encoder;
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index 42114ecbae0e..c9dba46f52af 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -50,23 +50,22 @@ intel_pch_panel_fitting(struct intel_crtc *intel_crtc,
50 struct intel_crtc_config *pipe_config, 50 struct intel_crtc_config *pipe_config,
51 int fitting_mode) 51 int fitting_mode)
52{ 52{
53 struct drm_display_mode *mode, *adjusted_mode; 53 struct drm_display_mode *adjusted_mode;
54 int x, y, width, height; 54 int x, y, width, height;
55 55
56 mode = &pipe_config->requested_mode;
57 adjusted_mode = &pipe_config->adjusted_mode; 56 adjusted_mode = &pipe_config->adjusted_mode;
58 57
59 x = y = width = height = 0; 58 x = y = width = height = 0;
60 59
61 /* Native modes don't need fitting */ 60 /* Native modes don't need fitting */
62 if (adjusted_mode->hdisplay == mode->hdisplay && 61 if (adjusted_mode->hdisplay == pipe_config->pipe_src_w &&
63 adjusted_mode->vdisplay == mode->vdisplay) 62 adjusted_mode->vdisplay == pipe_config->pipe_src_h)
64 goto done; 63 goto done;
65 64
66 switch (fitting_mode) { 65 switch (fitting_mode) {
67 case DRM_MODE_SCALE_CENTER: 66 case DRM_MODE_SCALE_CENTER:
68 width = mode->hdisplay; 67 width = pipe_config->pipe_src_w;
69 height = mode->vdisplay; 68 height = pipe_config->pipe_src_h;
70 x = (adjusted_mode->hdisplay - width + 1)/2; 69 x = (adjusted_mode->hdisplay - width + 1)/2;
71 y = (adjusted_mode->vdisplay - height + 1)/2; 70 y = (adjusted_mode->vdisplay - height + 1)/2;
72 break; 71 break;
@@ -74,17 +73,17 @@ intel_pch_panel_fitting(struct intel_crtc *intel_crtc,
74 case DRM_MODE_SCALE_ASPECT: 73 case DRM_MODE_SCALE_ASPECT:
75 /* Scale but preserve the aspect ratio */ 74 /* Scale but preserve the aspect ratio */
76 { 75 {
77 u32 scaled_width = adjusted_mode->hdisplay * mode->vdisplay; 76 u32 scaled_width = adjusted_mode->hdisplay * pipe_config->pipe_src_h;
78 u32 scaled_height = mode->hdisplay * adjusted_mode->vdisplay; 77 u32 scaled_height = pipe_config->pipe_src_w * adjusted_mode->vdisplay;
79 if (scaled_width > scaled_height) { /* pillar */ 78 if (scaled_width > scaled_height) { /* pillar */
80 width = scaled_height / mode->vdisplay; 79 width = scaled_height / pipe_config->pipe_src_h;
81 if (width & 1) 80 if (width & 1)
82 width++; 81 width++;
83 x = (adjusted_mode->hdisplay - width + 1) / 2; 82 x = (adjusted_mode->hdisplay - width + 1) / 2;
84 y = 0; 83 y = 0;
85 height = adjusted_mode->vdisplay; 84 height = adjusted_mode->vdisplay;
86 } else if (scaled_width < scaled_height) { /* letter */ 85 } else if (scaled_width < scaled_height) { /* letter */
87 height = scaled_width / mode->hdisplay; 86 height = scaled_width / pipe_config->pipe_src_w;
88 if (height & 1) 87 if (height & 1)
89 height++; 88 height++;
90 y = (adjusted_mode->vdisplay - height + 1) / 2; 89 y = (adjusted_mode->vdisplay - height + 1) / 2;
@@ -176,14 +175,13 @@ void intel_gmch_panel_fitting(struct intel_crtc *intel_crtc,
176{ 175{
177 struct drm_device *dev = intel_crtc->base.dev; 176 struct drm_device *dev = intel_crtc->base.dev;
178 u32 pfit_control = 0, pfit_pgm_ratios = 0, border = 0; 177 u32 pfit_control = 0, pfit_pgm_ratios = 0, border = 0;
179 struct drm_display_mode *mode, *adjusted_mode; 178 struct drm_display_mode *adjusted_mode;
180 179
181 mode = &pipe_config->requested_mode;
182 adjusted_mode = &pipe_config->adjusted_mode; 180 adjusted_mode = &pipe_config->adjusted_mode;
183 181
184 /* Native modes don't need fitting */ 182 /* Native modes don't need fitting */
185 if (adjusted_mode->hdisplay == mode->hdisplay && 183 if (adjusted_mode->hdisplay == pipe_config->pipe_src_w &&
186 adjusted_mode->vdisplay == mode->vdisplay) 184 adjusted_mode->vdisplay == pipe_config->pipe_src_h)
187 goto out; 185 goto out;
188 186
189 switch (fitting_mode) { 187 switch (fitting_mode) {
@@ -192,16 +190,16 @@ void intel_gmch_panel_fitting(struct intel_crtc *intel_crtc,
192 * For centered modes, we have to calculate border widths & 190 * For centered modes, we have to calculate border widths &
193 * heights and modify the values programmed into the CRTC. 191 * heights and modify the values programmed into the CRTC.
194 */ 192 */
195 centre_horizontally(adjusted_mode, mode->hdisplay); 193 centre_horizontally(adjusted_mode, pipe_config->pipe_src_w);
196 centre_vertically(adjusted_mode, mode->vdisplay); 194 centre_vertically(adjusted_mode, pipe_config->pipe_src_h);
197 border = LVDS_BORDER_ENABLE; 195 border = LVDS_BORDER_ENABLE;
198 break; 196 break;
199 case DRM_MODE_SCALE_ASPECT: 197 case DRM_MODE_SCALE_ASPECT:
200 /* Scale but preserve the aspect ratio */ 198 /* Scale but preserve the aspect ratio */
201 if (INTEL_INFO(dev)->gen >= 4) { 199 if (INTEL_INFO(dev)->gen >= 4) {
202 u32 scaled_width = adjusted_mode->hdisplay * 200 u32 scaled_width = adjusted_mode->hdisplay *
203 mode->vdisplay; 201 pipe_config->pipe_src_h;
204 u32 scaled_height = mode->hdisplay * 202 u32 scaled_height = pipe_config->pipe_src_w *
205 adjusted_mode->vdisplay; 203 adjusted_mode->vdisplay;
206 204
207 /* 965+ is easy, it does everything in hw */ 205 /* 965+ is easy, it does everything in hw */
@@ -211,12 +209,12 @@ void intel_gmch_panel_fitting(struct intel_crtc *intel_crtc,
211 else if (scaled_width < scaled_height) 209 else if (scaled_width < scaled_height)
212 pfit_control |= PFIT_ENABLE | 210 pfit_control |= PFIT_ENABLE |
213 PFIT_SCALING_LETTER; 211 PFIT_SCALING_LETTER;
214 else if (adjusted_mode->hdisplay != mode->hdisplay) 212 else if (adjusted_mode->hdisplay != pipe_config->pipe_src_w)
215 pfit_control |= PFIT_ENABLE | PFIT_SCALING_AUTO; 213 pfit_control |= PFIT_ENABLE | PFIT_SCALING_AUTO;
216 } else { 214 } else {
217 u32 scaled_width = adjusted_mode->hdisplay * 215 u32 scaled_width = adjusted_mode->hdisplay *
218 mode->vdisplay; 216 pipe_config->pipe_src_h;
219 u32 scaled_height = mode->hdisplay * 217 u32 scaled_height = pipe_config->pipe_src_w *
220 adjusted_mode->vdisplay; 218 adjusted_mode->vdisplay;
221 /* 219 /*
222 * For earlier chips we have to calculate the scaling 220 * For earlier chips we have to calculate the scaling
@@ -226,11 +224,11 @@ void intel_gmch_panel_fitting(struct intel_crtc *intel_crtc,
226 if (scaled_width > scaled_height) { /* pillar */ 224 if (scaled_width > scaled_height) { /* pillar */
227 centre_horizontally(adjusted_mode, 225 centre_horizontally(adjusted_mode,
228 scaled_height / 226 scaled_height /
229 mode->vdisplay); 227 pipe_config->pipe_src_h);
230 228
231 border = LVDS_BORDER_ENABLE; 229 border = LVDS_BORDER_ENABLE;
232 if (mode->vdisplay != adjusted_mode->vdisplay) { 230 if (pipe_config->pipe_src_h != adjusted_mode->vdisplay) {
233 u32 bits = panel_fitter_scaling(mode->vdisplay, adjusted_mode->vdisplay); 231 u32 bits = panel_fitter_scaling(pipe_config->pipe_src_h, adjusted_mode->vdisplay);
234 pfit_pgm_ratios |= (bits << PFIT_HORIZ_SCALE_SHIFT | 232 pfit_pgm_ratios |= (bits << PFIT_HORIZ_SCALE_SHIFT |
235 bits << PFIT_VERT_SCALE_SHIFT); 233 bits << PFIT_VERT_SCALE_SHIFT);
236 pfit_control |= (PFIT_ENABLE | 234 pfit_control |= (PFIT_ENABLE |
@@ -240,11 +238,11 @@ void intel_gmch_panel_fitting(struct intel_crtc *intel_crtc,
240 } else if (scaled_width < scaled_height) { /* letter */ 238 } else if (scaled_width < scaled_height) { /* letter */
241 centre_vertically(adjusted_mode, 239 centre_vertically(adjusted_mode,
242 scaled_width / 240 scaled_width /
243 mode->hdisplay); 241 pipe_config->pipe_src_w);
244 242
245 border = LVDS_BORDER_ENABLE; 243 border = LVDS_BORDER_ENABLE;
246 if (mode->hdisplay != adjusted_mode->hdisplay) { 244 if (pipe_config->pipe_src_w != adjusted_mode->hdisplay) {
247 u32 bits = panel_fitter_scaling(mode->hdisplay, adjusted_mode->hdisplay); 245 u32 bits = panel_fitter_scaling(pipe_config->pipe_src_w, adjusted_mode->hdisplay);
248 pfit_pgm_ratios |= (bits << PFIT_HORIZ_SCALE_SHIFT | 246 pfit_pgm_ratios |= (bits << PFIT_HORIZ_SCALE_SHIFT |
249 bits << PFIT_VERT_SCALE_SHIFT); 247 bits << PFIT_VERT_SCALE_SHIFT);
250 pfit_control |= (PFIT_ENABLE | 248 pfit_control |= (PFIT_ENABLE |
@@ -265,8 +263,8 @@ void intel_gmch_panel_fitting(struct intel_crtc *intel_crtc,
265 * Full scaling, even if it changes the aspect ratio. 263 * Full scaling, even if it changes the aspect ratio.
266 * Fortunately this is all done for us in hw. 264 * Fortunately this is all done for us in hw.
267 */ 265 */
268 if (mode->vdisplay != adjusted_mode->vdisplay || 266 if (pipe_config->pipe_src_h != adjusted_mode->vdisplay ||
269 mode->hdisplay != adjusted_mode->hdisplay) { 267 pipe_config->pipe_src_w != adjusted_mode->hdisplay) {
270 pfit_control |= PFIT_ENABLE; 268 pfit_control |= PFIT_ENABLE;
271 if (INTEL_INFO(dev)->gen >= 4) 269 if (INTEL_INFO(dev)->gen >= 4)
272 pfit_control |= PFIT_SCALING_AUTO; 270 pfit_control |= PFIT_SCALING_AUTO;
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 9cf3aa525414..fe19ba3360a7 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -450,9 +450,8 @@ void intel_update_fbc(struct drm_device *dev)
450 struct drm_framebuffer *fb; 450 struct drm_framebuffer *fb;
451 struct intel_framebuffer *intel_fb; 451 struct intel_framebuffer *intel_fb;
452 struct drm_i915_gem_object *obj; 452 struct drm_i915_gem_object *obj;
453 const struct drm_display_mode *mode;
454 const struct drm_display_mode *adjusted_mode; 453 const struct drm_display_mode *adjusted_mode;
455 unsigned int max_hdisplay, max_vdisplay; 454 unsigned int max_width, max_height;
456 455
457 if (!I915_HAS_FBC(dev)) { 456 if (!I915_HAS_FBC(dev)) {
458 set_no_fbc_reason(dev_priv, FBC_UNSUPPORTED); 457 set_no_fbc_reason(dev_priv, FBC_UNSUPPORTED);
@@ -496,7 +495,6 @@ void intel_update_fbc(struct drm_device *dev)
496 fb = crtc->fb; 495 fb = crtc->fb;
497 intel_fb = to_intel_framebuffer(fb); 496 intel_fb = to_intel_framebuffer(fb);
498 obj = intel_fb->obj; 497 obj = intel_fb->obj;
499 mode = &intel_crtc->config.requested_mode;
500 adjusted_mode = &intel_crtc->config.adjusted_mode; 498 adjusted_mode = &intel_crtc->config.adjusted_mode;
501 499
502 if (i915_enable_fbc < 0 && 500 if (i915_enable_fbc < 0 &&
@@ -519,14 +517,14 @@ void intel_update_fbc(struct drm_device *dev)
519 } 517 }
520 518
521 if (IS_G4X(dev) || INTEL_INFO(dev)->gen >= 5) { 519 if (IS_G4X(dev) || INTEL_INFO(dev)->gen >= 5) {
522 max_hdisplay = 4096; 520 max_width = 4096;
523 max_vdisplay = 2048; 521 max_height = 2048;
524 } else { 522 } else {
525 max_hdisplay = 2048; 523 max_width = 2048;
526 max_vdisplay = 1536; 524 max_height = 1536;
527 } 525 }
528 if ((mode->hdisplay > max_hdisplay) || 526 if (intel_crtc->config.pipe_src_w > max_width ||
529 (mode->vdisplay > max_vdisplay)) { 527 intel_crtc->config.pipe_src_h > max_height) {
530 if (set_no_fbc_reason(dev_priv, FBC_MODE_TOO_LARGE)) 528 if (set_no_fbc_reason(dev_priv, FBC_MODE_TOO_LARGE))
531 DRM_DEBUG_KMS("mode too large for compression, disabling\n"); 529 DRM_DEBUG_KMS("mode too large for compression, disabling\n");
532 goto out_disable; 530 goto out_disable;
@@ -1178,7 +1176,7 @@ static bool g4x_compute_wm0(struct drm_device *dev,
1178 adjusted_mode = &to_intel_crtc(crtc)->config.adjusted_mode; 1176 adjusted_mode = &to_intel_crtc(crtc)->config.adjusted_mode;
1179 clock = adjusted_mode->clock; 1177 clock = adjusted_mode->clock;
1180 htotal = adjusted_mode->htotal; 1178 htotal = adjusted_mode->htotal;
1181 hdisplay = to_intel_crtc(crtc)->config.requested_mode.hdisplay; 1179 hdisplay = to_intel_crtc(crtc)->config.pipe_src_w;
1182 pixel_size = crtc->fb->bits_per_pixel / 8; 1180 pixel_size = crtc->fb->bits_per_pixel / 8;
1183 1181
1184 /* Use the small buffer method to calculate plane watermark */ 1182 /* Use the small buffer method to calculate plane watermark */
@@ -1265,7 +1263,7 @@ static bool g4x_compute_srwm(struct drm_device *dev,
1265 adjusted_mode = &to_intel_crtc(crtc)->config.adjusted_mode; 1263 adjusted_mode = &to_intel_crtc(crtc)->config.adjusted_mode;
1266 clock = adjusted_mode->clock; 1264 clock = adjusted_mode->clock;
1267 htotal = adjusted_mode->htotal; 1265 htotal = adjusted_mode->htotal;
1268 hdisplay = to_intel_crtc(crtc)->config.requested_mode.hdisplay; 1266 hdisplay = to_intel_crtc(crtc)->config.pipe_src_w;
1269 pixel_size = crtc->fb->bits_per_pixel / 8; 1267 pixel_size = crtc->fb->bits_per_pixel / 8;
1270 1268
1271 line_time_us = (htotal * 1000) / clock; 1269 line_time_us = (htotal * 1000) / clock;
@@ -1496,7 +1494,7 @@ static void i965_update_wm(struct drm_crtc *unused_crtc)
1496 &to_intel_crtc(crtc)->config.adjusted_mode; 1494 &to_intel_crtc(crtc)->config.adjusted_mode;
1497 int clock = adjusted_mode->clock; 1495 int clock = adjusted_mode->clock;
1498 int htotal = adjusted_mode->htotal; 1496 int htotal = adjusted_mode->htotal;
1499 int hdisplay = to_intel_crtc(crtc)->config.requested_mode.hdisplay; 1497 int hdisplay = to_intel_crtc(crtc)->config.pipe_src_w;
1500 int pixel_size = crtc->fb->bits_per_pixel / 8; 1498 int pixel_size = crtc->fb->bits_per_pixel / 8;
1501 unsigned long line_time_us; 1499 unsigned long line_time_us;
1502 int entries; 1500 int entries;
@@ -1618,7 +1616,7 @@ static void i9xx_update_wm(struct drm_crtc *unused_crtc)
1618 &to_intel_crtc(enabled)->config.adjusted_mode; 1616 &to_intel_crtc(enabled)->config.adjusted_mode;
1619 int clock = adjusted_mode->clock; 1617 int clock = adjusted_mode->clock;
1620 int htotal = adjusted_mode->htotal; 1618 int htotal = adjusted_mode->htotal;
1621 int hdisplay = to_intel_crtc(crtc)->config.requested_mode.hdisplay; 1619 int hdisplay = to_intel_crtc(crtc)->config.pipe_src_w;
1622 int pixel_size = enabled->fb->bits_per_pixel / 8; 1620 int pixel_size = enabled->fb->bits_per_pixel / 8;
1623 unsigned long line_time_us; 1621 unsigned long line_time_us;
1624 int entries; 1622 int entries;
@@ -1768,7 +1766,7 @@ static bool ironlake_compute_srwm(struct drm_device *dev, int level, int plane,
1768 adjusted_mode = &to_intel_crtc(crtc)->config.adjusted_mode; 1766 adjusted_mode = &to_intel_crtc(crtc)->config.adjusted_mode;
1769 clock = adjusted_mode->clock; 1767 clock = adjusted_mode->clock;
1770 htotal = adjusted_mode->htotal; 1768 htotal = adjusted_mode->htotal;
1771 hdisplay = to_intel_crtc(crtc)->config.requested_mode.hdisplay; 1769 hdisplay = to_intel_crtc(crtc)->config.pipe_src_w;
1772 pixel_size = crtc->fb->bits_per_pixel / 8; 1770 pixel_size = crtc->fb->bits_per_pixel / 8;
1773 1771
1774 line_time_us = (htotal * 1000) / clock; 1772 line_time_us = (htotal * 1000) / clock;
@@ -2123,8 +2121,8 @@ static uint32_t ilk_pipe_pixel_rate(struct drm_device *dev,
2123 if (pfit_size) { 2121 if (pfit_size) {
2124 uint64_t pipe_w, pipe_h, pfit_w, pfit_h; 2122 uint64_t pipe_w, pipe_h, pfit_w, pfit_h;
2125 2123
2126 pipe_w = intel_crtc->config.requested_mode.hdisplay; 2124 pipe_w = intel_crtc->config.pipe_src_w;
2127 pipe_h = intel_crtc->config.requested_mode.vdisplay; 2125 pipe_h = intel_crtc->config.pipe_src_h;
2128 pfit_w = (pfit_size >> 16) & 0xFFFF; 2126 pfit_w = (pfit_size >> 16) & 0xFFFF;
2129 pfit_h = pfit_size & 0xFFFF; 2127 pfit_h = pfit_size & 0xFFFF;
2130 if (pipe_w < pfit_w) 2128 if (pipe_w < pfit_w)
@@ -2650,8 +2648,7 @@ static void hsw_compute_wm_parameters(struct drm_device *dev,
2650 p->pixel_rate = ilk_pipe_pixel_rate(dev, crtc); 2648 p->pixel_rate = ilk_pipe_pixel_rate(dev, crtc);
2651 p->pri.bytes_per_pixel = crtc->fb->bits_per_pixel / 8; 2649 p->pri.bytes_per_pixel = crtc->fb->bits_per_pixel / 8;
2652 p->cur.bytes_per_pixel = 4; 2650 p->cur.bytes_per_pixel = 4;
2653 p->pri.horiz_pixels = 2651 p->pri.horiz_pixels = intel_crtc->config.pipe_src_w;
2654 intel_crtc->config.requested_mode.hdisplay;
2655 p->cur.horiz_pixels = 64; 2652 p->cur.horiz_pixels = 64;
2656 /* TODO: for now, assume primary and cursor planes are always enabled. */ 2653 /* TODO: for now, assume primary and cursor planes are always enabled. */
2657 p->pri.enabled = true; 2654 p->pri.enabled = true;
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index ae0e686e6e55..231b289e8e57 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -652,8 +652,8 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
652 .y2 = crtc_y + crtc_h, 652 .y2 = crtc_y + crtc_h,
653 }; 653 };
654 const struct drm_rect clip = { 654 const struct drm_rect clip = {
655 .x2 = intel_crtc->config.requested_mode.hdisplay, 655 .x2 = intel_crtc->config.pipe_src_w,
656 .y2 = intel_crtc->config.requested_mode.vdisplay, 656 .y2 = intel_crtc->config.pipe_src_h,
657 }; 657 };
658 658
659 intel_fb = to_intel_framebuffer(fb); 659 intel_fb = to_intel_framebuffer(fb);