diff mbox

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

Message ID 1303463958-17128-11-git-send-email-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson April 22, 2011, 9:19 a.m. UTC
... otherwise just left userspace handle the notification and change
modes as it desires.

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

Comments

Jesse Barnes April 22, 2011, 4:27 p.m. UTC | #1
On Fri, 22 Apr 2011 10:19:18 +0100
Chris Wilson <chris@chris-wilson.co.uk> wrote:

> ... otherwise just left userspace handle the notification and change
> modes as it desires.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---

Problem is that old userspace didn't do anything.  The change is a nice
one though; maybe a setparam is needed to flag the new behavior?
diff mbox

Patch

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;