diff options
author | Matt Roper <matthew.d.roper@intel.com> | 2015-02-27 13:12:01 -0500 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2015-03-17 17:29:48 -0400 |
commit | 59bea8822f2d2e038a84750576a002049ad30ce1 (patch) | |
tree | 8bbbb6249722858ffee33633d072973ad7810e45 /drivers/gpu/drm/i915/intel_pm.c | |
parent | 3dd512fbda0d87d1c3fb44bf878b262baee98fb6 (diff) |
drm/i915: Use plane->state->fb in watermark code (v2)
plane->fb is a legacy pointer that not always be up-to-date (or updated
early enough). Make sure the watermark code uses plane->state->fb so
that we're always doing our calculations based on the correct
framebuffers.
This patch was generated by Coccinelle with the following semantic
patch:
@@
struct drm_plane *P;
@@
- P->fb
+ P->state->fb
v2: Rebase
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_pm.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_pm.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index ffe671f6193d..0bf67675840d 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c | |||
@@ -553,7 +553,7 @@ static void pineview_update_wm(struct drm_crtc *unused_crtc) | |||
553 | crtc = single_enabled_crtc(dev); | 553 | crtc = single_enabled_crtc(dev); |
554 | if (crtc) { | 554 | if (crtc) { |
555 | const struct drm_display_mode *adjusted_mode; | 555 | const struct drm_display_mode *adjusted_mode; |
556 | int pixel_size = crtc->primary->fb->bits_per_pixel / 8; | 556 | int pixel_size = crtc->primary->state->fb->bits_per_pixel / 8; |
557 | int clock; | 557 | int clock; |
558 | 558 | ||
559 | adjusted_mode = &to_intel_crtc(crtc)->config->base.adjusted_mode; | 559 | adjusted_mode = &to_intel_crtc(crtc)->config->base.adjusted_mode; |
@@ -629,7 +629,7 @@ static bool g4x_compute_wm0(struct drm_device *dev, | |||
629 | clock = adjusted_mode->crtc_clock; | 629 | clock = adjusted_mode->crtc_clock; |
630 | htotal = adjusted_mode->crtc_htotal; | 630 | htotal = adjusted_mode->crtc_htotal; |
631 | hdisplay = to_intel_crtc(crtc)->config->pipe_src_w; | 631 | hdisplay = to_intel_crtc(crtc)->config->pipe_src_w; |
632 | pixel_size = crtc->primary->fb->bits_per_pixel / 8; | 632 | pixel_size = crtc->primary->state->fb->bits_per_pixel / 8; |
633 | 633 | ||
634 | /* Use the small buffer method to calculate plane watermark */ | 634 | /* Use the small buffer method to calculate plane watermark */ |
635 | entries = ((clock * pixel_size / 1000) * display_latency_ns) / 1000; | 635 | entries = ((clock * pixel_size / 1000) * display_latency_ns) / 1000; |
@@ -716,7 +716,7 @@ static bool g4x_compute_srwm(struct drm_device *dev, | |||
716 | clock = adjusted_mode->crtc_clock; | 716 | clock = adjusted_mode->crtc_clock; |
717 | htotal = adjusted_mode->crtc_htotal; | 717 | htotal = adjusted_mode->crtc_htotal; |
718 | hdisplay = to_intel_crtc(crtc)->config->pipe_src_w; | 718 | hdisplay = to_intel_crtc(crtc)->config->pipe_src_w; |
719 | pixel_size = crtc->primary->fb->bits_per_pixel / 8; | 719 | pixel_size = crtc->primary->state->fb->bits_per_pixel / 8; |
720 | 720 | ||
721 | line_time_us = max(htotal * 1000 / clock, 1); | 721 | line_time_us = max(htotal * 1000 / clock, 1); |
722 | line_count = (latency_ns / line_time_us + 1000) / 1000; | 722 | line_count = (latency_ns / line_time_us + 1000) / 1000; |
@@ -799,7 +799,7 @@ static void vlv_update_drain_latency(struct drm_crtc *crtc) | |||
799 | } | 799 | } |
800 | 800 | ||
801 | /* Primary plane Drain Latency */ | 801 | /* Primary plane Drain Latency */ |
802 | pixel_size = crtc->primary->fb->bits_per_pixel / 8; /* BPP */ | 802 | pixel_size = crtc->primary->state->fb->bits_per_pixel / 8; /* BPP */ |
803 | if (vlv_compute_drain_latency(crtc, pixel_size, &prec_mult, &drain_latency)) { | 803 | if (vlv_compute_drain_latency(crtc, pixel_size, &prec_mult, &drain_latency)) { |
804 | plane_prec = (prec_mult == high_precision) ? | 804 | plane_prec = (prec_mult == high_precision) ? |
805 | DDL_PLANE_PRECISION_HIGH : | 805 | DDL_PLANE_PRECISION_HIGH : |
@@ -1080,7 +1080,7 @@ static void i965_update_wm(struct drm_crtc *unused_crtc) | |||
1080 | int clock = adjusted_mode->crtc_clock; | 1080 | int clock = adjusted_mode->crtc_clock; |
1081 | int htotal = adjusted_mode->crtc_htotal; | 1081 | int htotal = adjusted_mode->crtc_htotal; |
1082 | int hdisplay = to_intel_crtc(crtc)->config->pipe_src_w; | 1082 | int hdisplay = to_intel_crtc(crtc)->config->pipe_src_w; |
1083 | int pixel_size = crtc->primary->fb->bits_per_pixel / 8; | 1083 | int pixel_size = crtc->primary->state->fb->bits_per_pixel / 8; |
1084 | unsigned long line_time_us; | 1084 | unsigned long line_time_us; |
1085 | int entries; | 1085 | int entries; |
1086 | 1086 | ||
@@ -1157,7 +1157,7 @@ static void i9xx_update_wm(struct drm_crtc *unused_crtc) | |||
1157 | crtc = intel_get_crtc_for_plane(dev, 0); | 1157 | crtc = intel_get_crtc_for_plane(dev, 0); |
1158 | if (intel_crtc_active(crtc)) { | 1158 | if (intel_crtc_active(crtc)) { |
1159 | const struct drm_display_mode *adjusted_mode; | 1159 | const struct drm_display_mode *adjusted_mode; |
1160 | int cpp = crtc->primary->fb->bits_per_pixel / 8; | 1160 | int cpp = crtc->primary->state->fb->bits_per_pixel / 8; |
1161 | if (IS_GEN2(dev)) | 1161 | if (IS_GEN2(dev)) |
1162 | cpp = 4; | 1162 | cpp = 4; |
1163 | 1163 | ||
@@ -1179,7 +1179,7 @@ static void i9xx_update_wm(struct drm_crtc *unused_crtc) | |||
1179 | crtc = intel_get_crtc_for_plane(dev, 1); | 1179 | crtc = intel_get_crtc_for_plane(dev, 1); |
1180 | if (intel_crtc_active(crtc)) { | 1180 | if (intel_crtc_active(crtc)) { |
1181 | const struct drm_display_mode *adjusted_mode; | 1181 | const struct drm_display_mode *adjusted_mode; |
1182 | int cpp = crtc->primary->fb->bits_per_pixel / 8; | 1182 | int cpp = crtc->primary->state->fb->bits_per_pixel / 8; |
1183 | if (IS_GEN2(dev)) | 1183 | if (IS_GEN2(dev)) |
1184 | cpp = 4; | 1184 | cpp = 4; |
1185 | 1185 | ||
@@ -1202,7 +1202,7 @@ static void i9xx_update_wm(struct drm_crtc *unused_crtc) | |||
1202 | if (IS_I915GM(dev) && enabled) { | 1202 | if (IS_I915GM(dev) && enabled) { |
1203 | struct drm_i915_gem_object *obj; | 1203 | struct drm_i915_gem_object *obj; |
1204 | 1204 | ||
1205 | obj = intel_fb_obj(enabled->primary->fb); | 1205 | obj = intel_fb_obj(enabled->primary->state->fb); |
1206 | 1206 | ||
1207 | /* self-refresh seems busted with untiled */ | 1207 | /* self-refresh seems busted with untiled */ |
1208 | if (obj->tiling_mode == I915_TILING_NONE) | 1208 | if (obj->tiling_mode == I915_TILING_NONE) |
@@ -1226,7 +1226,7 @@ static void i9xx_update_wm(struct drm_crtc *unused_crtc) | |||
1226 | int clock = adjusted_mode->crtc_clock; | 1226 | int clock = adjusted_mode->crtc_clock; |
1227 | int htotal = adjusted_mode->crtc_htotal; | 1227 | int htotal = adjusted_mode->crtc_htotal; |
1228 | int hdisplay = to_intel_crtc(enabled)->config->pipe_src_w; | 1228 | int hdisplay = to_intel_crtc(enabled)->config->pipe_src_w; |
1229 | int pixel_size = enabled->primary->fb->bits_per_pixel / 8; | 1229 | int pixel_size = enabled->primary->state->fb->bits_per_pixel / 8; |
1230 | unsigned long line_time_us; | 1230 | unsigned long line_time_us; |
1231 | int entries; | 1231 | int entries; |
1232 | 1232 | ||
@@ -1924,7 +1924,7 @@ static void ilk_compute_wm_parameters(struct drm_crtc *crtc, | |||
1924 | p->active = true; | 1924 | p->active = true; |
1925 | p->pipe_htotal = intel_crtc->config->base.adjusted_mode.crtc_htotal; | 1925 | p->pipe_htotal = intel_crtc->config->base.adjusted_mode.crtc_htotal; |
1926 | p->pixel_rate = ilk_pipe_pixel_rate(dev, crtc); | 1926 | p->pixel_rate = ilk_pipe_pixel_rate(dev, crtc); |
1927 | p->pri.bytes_per_pixel = crtc->primary->fb->bits_per_pixel / 8; | 1927 | p->pri.bytes_per_pixel = crtc->primary->state->fb->bits_per_pixel / 8; |
1928 | p->cur.bytes_per_pixel = 4; | 1928 | p->cur.bytes_per_pixel = 4; |
1929 | p->pri.horiz_pixels = intel_crtc->config->pipe_src_w; | 1929 | p->pri.horiz_pixels = intel_crtc->config->pipe_src_w; |
1930 | p->cur.horiz_pixels = intel_crtc->base.cursor->state->crtc_w; | 1930 | p->cur.horiz_pixels = intel_crtc->base.cursor->state->crtc_w; |
@@ -2701,7 +2701,7 @@ static void skl_compute_wm_pipe_parameters(struct drm_crtc *crtc, | |||
2701 | */ | 2701 | */ |
2702 | p->plane[0].enabled = true; | 2702 | p->plane[0].enabled = true; |
2703 | p->plane[0].bytes_per_pixel = | 2703 | p->plane[0].bytes_per_pixel = |
2704 | crtc->primary->fb->bits_per_pixel / 8; | 2704 | crtc->primary->state->fb->bits_per_pixel / 8; |
2705 | p->plane[0].horiz_pixels = intel_crtc->config->pipe_src_w; | 2705 | p->plane[0].horiz_pixels = intel_crtc->config->pipe_src_w; |
2706 | p->plane[0].vert_pixels = intel_crtc->config->pipe_src_h; | 2706 | p->plane[0].vert_pixels = intel_crtc->config->pipe_src_h; |
2707 | p->plane[0].tiling = DRM_FORMAT_MOD_NONE; | 2707 | p->plane[0].tiling = DRM_FORMAT_MOD_NONE; |