[PATCH 24/24] drm/i915: Don't disable LP1+ watermarks for every frame when scaled

ville.syrjala
2014-03-07T16:34:17Z

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

If we mark the LP1+ watermarks as disabled every time sprite scaling
is enabled, we end doing pointless work applying watermarks even though
nothing has changed. This is an artifact of the way
dev_priv->wm.lp_disabled affects the operation of
ilk_setup_pending_watermarks(). If the current pipe is included in
dev_priv->wm.lp_disabled, ilk_setup_pending_watermarks() will not check
if the watermarks actually changed since it will assume it will need to
disable LP1+ watermarks anyway.

A quick fix is to just check if sprite scaling was enabled for the
previous plane update, and if so, we know that LP1+ watermarks must
already be disabled. It might be better in long run to attempt to
change the way the LP1+ disable tracking integrates with the rest of
the watermark update mechanism. But this seems like a simple enough
solution for now.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/i915/intel_pm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index c011da5..44546a5 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -3132,7 +3132,8 @@ static int ilk_update_sprite_wm(struct drm_plane *plane,
* primary only and sprite only configurations. Otherwise the screen
* flashes black. No underrun reported though.
*/
- if (IS_IVYBRIDGE(dev) && config->spr.scaled && ilk_disable_lp_wm(crtc))
+ if (IS_IVYBRIDGE(dev) && !params.spr.scaled &&
+ config->spr.scaled && ilk_disable_lp_wm(crtc))
intel_wait_for_vblank(dev, to_intel_plane(plane)->pipe);
else if (config->pri.enabled != config->spr.enabled &&
config->pri.enabled != params.pri.enabled &&
--
1.8.3.2