[Intel-gfx] [PATCH 3/3] drm/i915: Make module param for MMIO flip selection as tristate

sourab.gupta at intel.com sourab.gupta at intel.com
Thu May 29 11:40:15 CEST 2014


From: Sourab Gupta <sourab.gupta at intel.com>

This patch enhances the module parameter, 'use_mmio_flip' which
enables MMIO flips, to make it tristate. The values being-
0: Force CS flip
1: Force MMIO flip (Gen5+)
>1: Driver discretion is applied while selecting CS vs MMIO flip.

For Valleyview, this driver selection happens based on the idleness
of Blitter and Video engines. The Blitter and Video engines are in
the same power well. So, if both are idle, we can use MMIO flips,
Otherwise, we can use the BCS flips.
This usecase can be modified and/or enhanced to cover more platforms.

Signed-off-by: Sourab Gupta <sourab.gupta at intel.com>
---
 drivers/gpu/drm/i915/i915_params.c   |  4 +++-
 drivers/gpu/drm/i915/intel_display.c | 42 ++++++++++++++++++++++++++++++------
 2 files changed, 38 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c
index e0d44df..9becd1e 100644
--- a/drivers/gpu/drm/i915/i915_params.c
+++ b/drivers/gpu/drm/i915/i915_params.c
@@ -159,4 +159,6 @@ MODULE_PARM_DESC(enable_cmd_parser,
 		 "Enable command parsing (1=enabled [default], 0=disabled)");
 
 module_param_named(use_mmio_flip, i915.use_mmio_flip, bool, 0600);
-MODULE_PARM_DESC(use_mmio_flip, "use MMIO flips (default: false)");
+MODULE_PARM_DESC(use_mmio_flip, "use MMIO page flips"
+	"(0 force CS, 1:force mmio, >1: driver selection)"
+	"(default: 0)");
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 9dda965..a3d38d2 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -9185,22 +9185,50 @@ static int intel_gen7_queue_flip(struct drm_device *dev,
 
 static bool intel_use_mmio_flip(struct drm_device *dev)
 {
-	/* If module parameter is disabled, use CS flips.
-	 * Otherwise, use MMIO flips starting from Gen5.
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	bool use_mmio_flip = false;
+
+	/* If module parameter is 0, force CS flip.
+	 * If module parameter is 1, force MMIO flip starting from Gen5.
 	 * This is not being used for older platforms, because
 	 * non-availability of flip done interrupt forces us to use
 	 * CS flips. Older platforms derive flip done using some clever
 	 * tricks involving the flip_pending status bits and vblank irqs.
 	 * So using MMIO flips there would disrupt this mechanism.
+	 * If module parameter is > 1, driver discretion is applied for
+	 * selection of CS vs MMIO flip.
 	 */
 
 	if (i915.use_mmio_flip == 0)
-		return false;
+		use_mmio_flip = false;
 
-	if (INTEL_INFO(dev)->gen >= 5)
-		return true;
-	else
-		return false;
+	if (i915.use_mmio_flip == 1) {
+		if (INTEL_INFO(dev)->gen >= 5)
+			use_mmio_flip = true;
+		else
+			use_mmio_flip = false;
+	}
+
+	if (i915.use_mmio_flip > 1) {
+		/* For Valleyview, Blitter and Video engines are in the same
+		 * power well. So, if both are idle, we can use MMIO flips,
+		 * Otherwise, we can use the BCS flips.
+		 * We use the parameter 'request_list' to determine the idleness
+		 * of the engine.
+		 */
+		if (IS_VALLEYVIEW(dev)) {
+			struct intel_engine_cs *bcs_ring = &dev_priv->ring[BCS];
+			struct intel_engine_cs *vcs_ring = &dev_priv->ring[VCS];
+
+			if (list_empty(&bcs_ring->request_list) &&
+					list_empty(&vcs_ring->request_list))
+				use_mmio_flip = true;
+			else
+				use_mmio_flip = false;
+		} else
+			use_mmio_flip = false;
+	}
+	return use_mmio_flip;
 }
 
 static void intel_do_mmio_flip(struct intel_crtc *intel_crtc)
-- 
1.8.5.1




More information about the Intel-gfx mailing list