[Intel-gfx] [PATCH 11/16] drm/i915: Refactor get_other_active_crtc()

ville.syrjala at linux.intel.com ville.syrjala at linux.intel.com
Thu May 22 16:48:16 CEST 2014


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

Pull the code to locate the other active crtc out from
haswell_mode_set_planes_workaround() into a separate function.
This will have another use later.

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 33 +++++++++++++++++++++------------
 1 file changed, 21 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index ca362db..bccf414 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3965,6 +3965,26 @@ static void intel_crtc_disable_planes(struct drm_crtc *crtc)
 	drm_vblank_off(dev, pipe);
 }
 
+static struct intel_crtc *get_other_active_crtc(struct intel_crtc *crtc)
+{
+	struct drm_device *dev = crtc->base.dev;
+	struct intel_crtc *crtc_it, *other_active_crtc = NULL;
+
+	/* We want to get the other_active_crtc only if there's only 1 other
+	 * active crtc. */
+	for_each_intel_crtc(dev, crtc_it) {
+		if (!crtc_it->active || crtc_it == crtc)
+			continue;
+
+		if (other_active_crtc)
+			return NULL;
+
+		other_active_crtc = crtc_it;
+	}
+
+	return other_active_crtc;
+}
+
 static void ironlake_crtc_enable(struct drm_crtc *crtc)
 {
 	struct drm_device *dev = crtc->dev;
@@ -4057,19 +4077,8 @@ static bool hsw_crtc_supports_ips(struct intel_crtc *crtc)
 static void haswell_mode_set_planes_workaround(struct intel_crtc *crtc)
 {
 	struct drm_device *dev = crtc->base.dev;
-	struct intel_crtc *crtc_it, *other_active_crtc = NULL;
-
-	/* We want to get the other_active_crtc only if there's only 1 other
-	 * active crtc. */
-	for_each_intel_crtc(dev, crtc_it) {
-		if (!crtc_it->active || crtc_it == crtc)
-			continue;
+	struct intel_crtc *other_active_crtc = get_other_active_crtc(crtc);
 
-		if (other_active_crtc)
-			return;
-
-		other_active_crtc = crtc_it;
-	}
 	if (!other_active_crtc)
 		return;
 
-- 
1.8.5.5




More information about the Intel-gfx mailing list