[Intel-gfx] [PATCH 10/10] drm/i915: Only force a modeset on a lid event if fbcon is active

Chris Wilson chris at chris-wilson.co.uk
Fri Apr 22 11:19:18 CEST 2011


... otherwise just left userspace handle the notification and change
modes as it desires.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_panel.c |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index b49aad7..e930397 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -138,6 +138,24 @@ static const struct dmi_system_id intel_no_modeset_on_lid[] = {
 	{ }	/* terminating entry */
 };
 
+/* See if any output is currently scanning from the fbcon */
+static bool fbdev_is_active(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_framebuffer *fb;
+	struct drm_crtc *crtc;
+
+	if (!dev_priv->fbdev)
+		return false;
+
+	fb = &dev_priv->fbdev->ifb.base;
+	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)
+		if (crtc->fb == fb)
+			return true;
+
+	return false;
+}
+
 /*
  * Lid events. Note the use of 'modeset_on_lid':
  *  - we set it on lid close, and reset it on open
@@ -177,7 +195,8 @@ static int intel_panel_lid_notify(struct notifier_block *nb, unsigned long val,
 	dev_priv->modeset_on_lid = 0;
 
 	mutex_lock(&dev->mode_config.mutex);
-	drm_helper_resume_force_mode(dev);
+	if (fbdev_is_active(dev))
+		drm_helper_resume_force_mode(dev);
 	mutex_unlock(&dev->mode_config.mutex);
 
 	return NOTIFY_OK;
-- 
1.7.4.1




More information about the Intel-gfx mailing list