From patchwork Fri May 23 14:51:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Zanoni X-Patchwork-Id: 4233221 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C1C279F1CD for ; Fri, 23 May 2014 14:51:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DF586201E7 for ; Fri, 23 May 2014 14:51:49 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 05C00203A9 for ; Fri, 23 May 2014 14:51:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9573D6EE23; Fri, 23 May 2014 07:51:47 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-yk0-f176.google.com (mail-yk0-f176.google.com [209.85.160.176]) by gabe.freedesktop.org (Postfix) with ESMTP id 157516EE2A for ; Fri, 23 May 2014 07:51:46 -0700 (PDT) Received: by mail-yk0-f176.google.com with SMTP id q9so4070051ykb.35 for ; Fri, 23 May 2014 07:51:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FO2d+mE/oXN+W/kp6Gbxcks0RU4YCWeLkbGFzaE05p8=; b=BaiRT1yIJXP7RKIaG9TRWchhR/xYBcskVD0GIagj/HIteQAUMSy4dyJFMRyrrEfNzF wPXa0Mw1cq3HeOm1Ye6Cb7tHG7823jZFMl0rkumDm94VJ178KNi6NV9NuS2M4EzfBQbw hLkt8d6P7Eq7HkOB4JML7mskExm0epkNK0WCeXU+0ap2Eu2Ctzsh//qVaUc2F5+8QdgI Z27gbR+wRkK61ktDoP3MyqCI8Asub5oPcOSbDp5sWGirh6skyy19AP1jFlb1iVK99wcg Ek1qcvtr93uuoyeeRThYxyRUthj8KOaKxYEI/PbSSiLdqBWSrhP6Na0sO7uKFF6XtlOu xgzA== X-Received: by 10.236.35.198 with SMTP id u46mr7840962yha.54.1400856705575; Fri, 23 May 2014 07:51:45 -0700 (PDT) Received: from localhost.localdomain (189.114.236.160.dynamic.adsl.gvt.net.br. [189.114.236.160]) by mx.google.com with ESMTPSA id y3sm4713090yhd.28.2014.05.23.07.51.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 May 2014 07:51:45 -0700 (PDT) From: Paulo Zanoni To: intel-gfx@lists.freedesktop.org Date: Fri, 23 May 2014 11:51:25 -0300 Message-Id: <1400856685-3158-3-git-send-email-przanoni@gmail.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1400856685-3158-1-git-send-email-przanoni@gmail.com> References: <1400856685-3158-1-git-send-email-przanoni@gmail.com> Cc: Daniel Vetter , Paulo Zanoni Subject: [Intel-gfx] [PATCH 2/2] drm/i915: runtime PM support for DPMS X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 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.7 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, 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: Daniel Vetter Keeping track of the power domains is a bit messy since crtc->active is currently updated by the platform hooks, but we need to be aware of which state transition exactly is going on. Maybe we simply need to shovel all the power domain handling down into platform code to simplify this. But doing that requires some more auditing since currently the ->mode_set callbacks still read some random registers (to e.g. figure out the reference clocks). Also note that intel_crtc_update_dpms is always call first/last even for encoders which have their own dpms functions. Hence we really only need to update this place here. Being a quick "does it blow up?" run not really tested yet. v2, made by Paulo: - IVB and older are not ready yet for this. Signed-off-by: Daniel Vetter Signed-off-by: Paulo Zanoni --- drivers/gpu/drm/i915/intel_display.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 1ea4fbe..79b4f5f 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -4845,16 +4845,43 @@ void intel_crtc_update_dpms(struct drm_crtc *crtc) { struct drm_device *dev = crtc->dev; struct drm_i915_private *dev_priv = dev->dev_private; + struct intel_crtc *intel_crtc = to_intel_crtc(crtc); struct intel_encoder *intel_encoder; + enum intel_display_power_domain domain; + unsigned long domains; bool enable = false; for_each_encoder_on_crtc(dev, crtc, intel_encoder) enable |= intel_encoder->connectors_active; - if (enable) - dev_priv->display.crtc_enable(crtc); - else - dev_priv->display.crtc_disable(crtc); + if (enable) { + if (!intel_crtc->active) { + + /* IVB and older still don't support RPM on DPMS. */ + if (IS_HASWELL(dev) || INTEL_INFO(dev)->gen >= 8) { + domains = get_crtc_power_domains(crtc); + for_each_power_domain(domain, domains) + intel_display_power_get(dev_priv, + domain); + intel_crtc->enabled_power_domains = domains; + } + + dev_priv->display.crtc_enable(crtc); + } + } else { + if (intel_crtc->active) { + dev_priv->display.crtc_disable(crtc); + + /* IVB and older still don't support RPM on DPMS. */ + if (IS_HASWELL(dev) || INTEL_INFO(dev)->gen >= 8) { + domains = intel_crtc->enabled_power_domains; + for_each_power_domain(domain, domains) + intel_display_power_put(dev_priv, + domain); + intel_crtc->enabled_power_domains = 0; + } + } + } intel_crtc_update_sarea(crtc, enable); }