aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorMatt Roper <matthew.d.roper@intel.com>2015-03-09 13:19:24 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-03-17 17:30:11 -0400
commit3ef00284e6a48f7deb0784ccca0478ebb7d4bcfc (patch)
tree395d84f2e673d6e5fd87c7cd32ea3bc045dbbe32 /drivers/gpu/drm
parentc3d1f4360133ecab6aa5f2e782cf15f119e43dc9 (diff)
drm/i915: Use crtc->state->active in ilk/skl watermark calculations (v3)
Existing watermark code calls intel_crtc_active() to determine whether a CRTC is active for the purpose of watermark calculations (and bails out early if it determines the CRTC is not active). However intel_crtc_active() only returns true if crtc->primary->fb is non-NULL, which isn't appropriate in the modern age of universal planes and atomic modeset since userspace can now disable the primary plane, but leave the CRTC (and other planes) running. Note that commit commit 0fda65680e92545caea5be7805a7f0a617fb6c20 Author: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Date: Fri Feb 27 15:12:35 2015 +0000 drm/i915/skl: Update watermarks for Y tiling adds a test for primary plane enable/disable to trigger a watermark update (previously we ignored updates to primary planes, which wasn't really correct, but we got lucky since we always pretended the primary plane was on). Tvrtko's patch tries to update watermarks when we re-enable the primary plane, but that watermark computation gets aborted early because intel_crtc_active() returns false due to the disabled primary plane. Switch the ILK and SKL watermark code over to use crtc->state->active rather than calling intel_crtc_active() so that we'll properly compute watermarks when re-enabling the primary plane. Note that this commit doesn't touch callsites in the watermark code for older platforms since there were concerns that doing so would lead to other types of breakage. Also note that all of the watermark calculation at the moment takes place after new crtc/plane states are swapped into the DRM objects. This will change in the future, so we'll be working with in-flight state objects, but for the time being, crtc->state is what we want to operate on. v2: Don't drop primary->fb check from intel_crtc_active(), but rather replace ILK/SKL callsites with direct tests of crtc->state->active. There is concern that messing with intel_crtc_active() will lead to other breakage for old hardware platforms. (Ville) v3: Use intel_crtc->active for now rather than crtc->state->active since we don't have CRTC states properly hooked up and initialized yet. We'll defer the switch to crtc->state->active until the atomic CRTC state work is farther along. (Ville) Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Signed-off-by: Matt Roper <matthew.d.roper@intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 4f04fabed7bb..a06a2c73b514 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -1701,7 +1701,7 @@ hsw_compute_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc)
1701 struct drm_display_mode *mode = &intel_crtc->config->base.adjusted_mode; 1701 struct drm_display_mode *mode = &intel_crtc->config->base.adjusted_mode;
1702 u32 linetime, ips_linetime; 1702 u32 linetime, ips_linetime;
1703 1703
1704 if (!intel_crtc_active(crtc)) 1704 if (!intel_crtc->active)
1705 return 0; 1705 return 0;
1706 1706
1707 /* The WM are computed with base on how long it takes to fill a single 1707 /* The WM are computed with base on how long it takes to fill a single
@@ -1956,7 +1956,7 @@ static void ilk_compute_wm_parameters(struct drm_crtc *crtc,
1956 enum pipe pipe = intel_crtc->pipe; 1956 enum pipe pipe = intel_crtc->pipe;
1957 struct drm_plane *plane; 1957 struct drm_plane *plane;
1958 1958
1959 if (!intel_crtc_active(crtc)) 1959 if (!intel_crtc->active)
1960 return; 1960 return;
1961 1961
1962 p->active = true; 1962 p->active = true;
@@ -2468,7 +2468,7 @@ skl_ddb_get_pipe_allocation_limits(struct drm_device *dev,
2468 2468
2469 nth_active_pipe = 0; 2469 nth_active_pipe = 0;
2470 for_each_crtc(dev, crtc) { 2470 for_each_crtc(dev, crtc) {
2471 if (!intel_crtc_active(crtc)) 2471 if (!to_intel_crtc(crtc)->active)
2472 continue; 2472 continue;
2473 2473
2474 if (crtc == for_crtc) 2474 if (crtc == for_crtc)
@@ -2708,7 +2708,7 @@ static void skl_compute_wm_global_parameters(struct drm_device *dev,
2708 struct drm_plane *plane; 2708 struct drm_plane *plane;
2709 2709
2710 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) 2710 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)
2711 config->num_pipes_active += intel_crtc_active(crtc); 2711 config->num_pipes_active += to_intel_crtc(crtc)->active;
2712 2712
2713 /* FIXME: I don't think we need those two global parameters on SKL */ 2713 /* FIXME: I don't think we need those two global parameters on SKL */
2714 list_for_each_entry(plane, &dev->mode_config.plane_list, head) { 2714 list_for_each_entry(plane, &dev->mode_config.plane_list, head) {
@@ -2729,7 +2729,7 @@ static void skl_compute_wm_pipe_parameters(struct drm_crtc *crtc,
2729 struct drm_framebuffer *fb; 2729 struct drm_framebuffer *fb;
2730 int i = 1; /* Index for sprite planes start */ 2730 int i = 1; /* Index for sprite planes start */
2731 2731
2732 p->active = intel_crtc_active(crtc); 2732 p->active = intel_crtc->active;
2733 if (p->active) { 2733 if (p->active) {
2734 p->pipe_htotal = intel_crtc->config->base.adjusted_mode.crtc_htotal; 2734 p->pipe_htotal = intel_crtc->config->base.adjusted_mode.crtc_htotal;
2735 p->pixel_rate = skl_pipe_pixel_rate(intel_crtc->config); 2735 p->pixel_rate = skl_pipe_pixel_rate(intel_crtc->config);
@@ -2860,7 +2860,7 @@ static void skl_compute_wm_level(const struct drm_i915_private *dev_priv,
2860static uint32_t 2860static uint32_t
2861skl_compute_linetime_wm(struct drm_crtc *crtc, struct skl_pipe_wm_parameters *p) 2861skl_compute_linetime_wm(struct drm_crtc *crtc, struct skl_pipe_wm_parameters *p)
2862{ 2862{
2863 if (!intel_crtc_active(crtc)) 2863 if (!to_intel_crtc(crtc)->active)
2864 return 0; 2864 return 0;
2865 2865
2866 return DIV_ROUND_UP(8 * p->pipe_htotal * 1000, p->pixel_rate); 2866 return DIV_ROUND_UP(8 * p->pipe_htotal * 1000, p->pixel_rate);
@@ -3407,7 +3407,7 @@ static void skl_pipe_wm_get_hw_state(struct drm_crtc *crtc)
3407 hw->plane_trans[pipe][i] = I915_READ(PLANE_WM_TRANS(pipe, i)); 3407 hw->plane_trans[pipe][i] = I915_READ(PLANE_WM_TRANS(pipe, i));
3408 hw->cursor_trans[pipe] = I915_READ(CUR_WM_TRANS(pipe)); 3408 hw->cursor_trans[pipe] = I915_READ(CUR_WM_TRANS(pipe));
3409 3409
3410 if (!intel_crtc_active(crtc)) 3410 if (!intel_crtc->active)
3411 return; 3411 return;
3412 3412
3413 hw->dirty[pipe] = true; 3413 hw->dirty[pipe] = true;
@@ -3462,7 +3462,7 @@ static void ilk_pipe_wm_get_hw_state(struct drm_crtc *crtc)
3462 if (IS_HASWELL(dev) || IS_BROADWELL(dev)) 3462 if (IS_HASWELL(dev) || IS_BROADWELL(dev))
3463 hw->wm_linetime[pipe] = I915_READ(PIPE_WM_LINETIME(pipe)); 3463 hw->wm_linetime[pipe] = I915_READ(PIPE_WM_LINETIME(pipe));
3464 3464
3465 active->pipe_enabled = intel_crtc_active(crtc); 3465 active->pipe_enabled = intel_crtc->active;
3466 3466
3467 if (active->pipe_enabled) { 3467 if (active->pipe_enabled) {
3468 u32 tmp = hw->wm_pipe[pipe]; 3468 u32 tmp = hw->wm_pipe[pipe];