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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Jesse Barnes <jbarnes@xxxxxxxxxxxxxxxx>
---
 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

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux