[Intel-gfx] [PATCH 6/6] drm/i915: calculate pfit changes in set_config

Jesse Barnes jbarnes at virtuousgeek.org
Thu Oct 23 20:50:47 CEST 2014


This should allow us to avoid mode sets for some panel fitter config
changes.

Signed-off-by: Jesse Barnes <jbarnes at virtuousgeek.org>
---
 drivers/gpu/drm/i915/intel_display.c | 48 ++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 10468a7..84331a3 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -11420,6 +11420,50 @@ static void disable_crtc_nofb(struct intel_crtc *crtc)
 	crtc->new_config = NULL;
 }
 
+/* Do we need a mode set due to pfit changes? */
+static bool intel_pfit_changed(struct drm_device *dev,
+			       struct intel_crtc_config *new_config,
+			       struct intel_crtc_config *cur_config)
+{
+	bool ret = false;
+
+	if (HAS_DDI(dev) || HAS_PCH_SPLIT(dev)) {
+		/*
+		 * On PCH platforms we can disable pfit w/o a pipe shutdown,
+		 * otherwise we'll need a mode set.
+		 */
+		if (new_config->pch_pfit.enabled &&
+		    cur_config->pch_pfit.enabled)
+			ret = false;
+		else if (new_config->pch_pfit.enabled &&
+			 !cur_config->pch_pfit.enabled)
+			ret = true;
+		else if (!new_config->pch_pfit.enabled &&
+			 cur_config->pch_pfit.enabled)
+			ret = false;
+		else if (!new_config->pch_pfit.enabled &&
+			 !cur_config->pch_pfit.enabled)
+			ret = false;
+	} else {
+		bool new_enabled, old_enabled;
+
+		new_enabled = !!(new_config->gmch_pfit.control & PFIT_ENABLE);
+		old_enabled = !!(cur_config->gmch_pfit.control & PFIT_ENABLE);
+
+		/* 9xx only needs a shutdown to disable pfit */
+		if (new_enabled && old_enabled)
+			ret = false;
+		else if (new_enabled && !old_enabled)
+			ret = false;
+		else if (!new_enabled && old_enabled)
+			ret = true;
+		else if (!new_enabled && !old_enabled)
+			ret = false;
+	}
+
+	return ret;
+}
+
 static int intel_crtc_set_config(struct drm_mode_set *set)
 {
 	struct drm_device *dev;
@@ -11486,6 +11530,10 @@ static int intel_crtc_set_config(struct drm_mode_set *set)
 	    to_intel_crtc(set->crtc)->config.has_infoframe)
 		config->mode_changed = true;
 
+	if (intel_pfit_changed(dev, to_intel_crtc(set->crtc)->new_config,
+			       &to_intel_crtc(set->crtc)->config))
+		config->mode_changed = true;
+
 	intel_update_pipe_size(to_intel_crtc(set->crtc));
 
 	if (config->mode_changed) {
-- 
1.9.1




More information about the Intel-gfx mailing list