From patchwork Mon Dec 1 06:59:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: sagar.a.kamble@intel.com X-Patchwork-Id: 5410221 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 350C6BEEA8 for ; Mon, 1 Dec 2014 06:58:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 706CE201C7 for ; Mon, 1 Dec 2014 06:58:50 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 842E12017A for ; Mon, 1 Dec 2014 06:58:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1515D6E119; Sun, 30 Nov 2014 22:58:49 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTP id A18826E119 for ; Sun, 30 Nov 2014 22:58:47 -0800 (PST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP; 30 Nov 2014 22:58:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="423425942" Received: from sagar-desktop.iind.intel.com ([10.223.82.56]) by FMSMGA003.fm.intel.com with ESMTP; 30 Nov 2014 22:48:38 -0800 From: sagar.a.kamble@intel.com To: intel-gfx@lists.freedesktop.org Date: Mon, 1 Dec 2014 12:29:34 +0530 Message-Id: <1417417174-32568-1-git-send-email-sagar.a.kamble@intel.com> X-Mailer: git-send-email 1.8.5 Cc: Akash Goel , Sagar Kamble Subject: [Intel-gfx] [PATCH v1 1/1] drm/i915: Perform modeset based on DPMS state during resume X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Akash Goel During resume, modeset was being performed independent of DPMS state which increased resume time as well as it kept display wells ON. With this change this modeset will be skipped. Signed-off-by: Akash Goel Signed-off-by: Sagar Kamble --- drivers/gpu/drm/i915/i915_drv.c | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 71be3c9..919e552 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -671,6 +671,31 @@ int i915_suspend_legacy(struct drm_device *dev, pm_message_t state) return i915_drm_suspend_late(dev); } +static bool display_is_on(struct drm_device *dev) +{ + struct drm_connector *connector; + bool display_is_on = false; + + drm_modeset_lock_all(dev); + list_for_each_entry(connector, &dev->mode_config.connector_list, head) { + if (!connector->encoder || !connector->encoder->crtc) + continue; + /* + * If Display wasn't turned off, before going to suspend then + * it should be re-enabled now, as we don't expect the DPMS ON + * call to come in that case + */ + if (connector->dpms != DRM_MODE_DPMS_OFF) { + DRM_DEBUG_KMS("Display was on before suspend\n"); + display_is_on = true; + break; + } + } + drm_modeset_unlock_all(dev); + + return display_is_on; +} + static int i915_drm_resume(struct drm_device *dev) { struct drm_i915_private *dev_priv = dev->dev_private; @@ -707,9 +732,11 @@ static int i915_drm_resume(struct drm_device *dev) spin_unlock_irq(&dev_priv->irq_lock); intel_dp_mst_resume(dev); - drm_modeset_lock_all(dev); - intel_modeset_setup_hw_state(dev, true); - drm_modeset_unlock_all(dev); + if (display_is_on(dev)) { + drm_modeset_lock_all(dev); + intel_modeset_setup_hw_state(dev, true); + drm_modeset_unlock_all(dev); + } /* * ... but also need to make sure that hotplug processing