[Intel-gfx] [PATCH 56/81] drm/i915: Fix sprite_scaling_enabled for multiple sprites

ville.syrjala at linux.intel.com ville.syrjala at linux.intel.com
Wed Dec 12 17:16:23 CET 2012


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

We have more than one sprite, so a boolean simply won't cut it.
Turn sprite_scaling_enabled into a bitmask and track the state
of sprite scaler for each sprite independently.

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h     |    2 +-
 drivers/gpu/drm/i915/intel_sprite.c |   11 ++++++-----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 0bafe7f..6f865bf 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -729,7 +729,7 @@ typedef struct drm_i915_private {
 
 	/* overlay */
 	struct intel_overlay *overlay;
-	bool sprite_scaling_enabled;
+	unsigned int sprite_scaling_enabled;
 
 	/* LVDS info */
 	int backlight_level;  /* restore backlight to this value */
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 693b265..ce3b950 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -345,15 +345,16 @@ ivb_prepare_plane(struct drm_plane *plane)
 	 */
 	if (regs->scale & SPRITE_SCALE_ENABLE) {
 		if (!dev_priv->sprite_scaling_enabled) {
-			dev_priv->sprite_scaling_enabled = true;
+			dev_priv->sprite_scaling_enabled |= 1 << pipe;
 			intel_update_watermarks(dev);
 			intel_wait_for_vblank(dev, pipe);
 		}
 	} else {
-		if (dev_priv->sprite_scaling_enabled) {
-			dev_priv->sprite_scaling_enabled = false;
+		if (dev_priv->sprite_scaling_enabled & (1 << pipe)) {
+			dev_priv->sprite_scaling_enabled &= ~(1 << pipe);
 			/* potentially re-enable LP watermarks */
-			intel_update_watermarks(dev);
+			if (!dev_priv->sprite_scaling_enabled)
+				intel_update_watermarks(dev);
 		}
 	}
 }
@@ -389,7 +390,7 @@ ivb_disable_plane(struct drm_plane *plane)
 	ivb_commit_plane(plane);
 	POSTING_READ(SPRSURF(pipe));
 
-	dev_priv->sprite_scaling_enabled = false;
+	dev_priv->sprite_scaling_enabled &= ~(1 << pipe);
 	intel_update_watermarks(dev);
 }
 
-- 
1.7.8.6




More information about the Intel-gfx mailing list