From patchwork Fri Aug 10 07:11:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 10562301 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 328C714C0 for ; Fri, 10 Aug 2018 07:13:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E4A0286EB for ; Fri, 10 Aug 2018 07:13:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 12D1F2B76E; Fri, 10 Aug 2018 07:13:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B9CA0286EB for ; Fri, 10 Aug 2018 07:13:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3792B6E8AB; Fri, 10 Aug 2018 07:13:44 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fireflyinternet.com (mail.fireflyinternet.com [109.228.58.192]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4066C6E8A1 for ; Fri, 10 Aug 2018 07:13:36 +0000 (UTC) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from haswell.alporthouse.com (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP id 12770311-1500050 for multiple; Fri, 10 Aug 2018 08:11:47 +0100 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Fri, 10 Aug 2018 08:11:38 +0100 Message-Id: <20180810071138.30138-8-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180810071138.30138-1-chris@chris-wilson.co.uk> References: <20180810071138.30138-1-chris@chris-wilson.co.uk> Subject: [Intel-gfx] [RFC 8/8] drm/i915: Track crtc wakerefs during modesetting X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 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-Virus-Scanned: ClamAV using ClamSMTP Modesetting is one of the more complex interactions with power wells as it acquires multiple wells to do its business. Fortunately, we do not have to track every one individually as they are all called from the same location and thus will have matching wakerefs (being a hash of its stacktrace). Signed-off-by: Chris Wilson --- drivers/gpu/drm/i915/intel_display.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 6606e57f9265..9efbb930da9c 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -5953,7 +5953,8 @@ static u64 get_crtc_power_domains(struct drm_crtc *crtc, static u64 modeset_get_crtc_power_domains(struct drm_crtc *crtc, - struct intel_crtc_state *crtc_state) + struct intel_crtc_state *crtc_state, + intel_wakeref_t *wakeref) { struct drm_i915_private *dev_priv = to_i915(crtc->dev); struct intel_crtc *intel_crtc = to_intel_crtc(crtc); @@ -5967,18 +5968,18 @@ modeset_get_crtc_power_domains(struct drm_crtc *crtc, domains = new_domains & ~old_domains; for_each_power_domain(domain, domains) - intel_display_power_get(dev_priv, domain); + *wakeref = intel_display_power_get(dev_priv, domain); return old_domains & ~new_domains; } static void modeset_put_power_domains(struct drm_i915_private *dev_priv, - u64 domains) + u64 domains, intel_wakeref_t wakeref) { enum intel_display_power_domain domain; for_each_power_domain(domain, domains) - intel_display_power_put_unchecked(dev_priv, domain); + intel_display_power_put(dev_priv, domain, wakeref); } static void valleyview_crtc_enable(struct intel_crtc_state *pipe_config, @@ -12598,6 +12599,7 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state) struct intel_crtc_state *intel_cstate; u64 put_domains[I915_MAX_PIPES] = {}; intel_wakeref_t wakeref = 0; + intel_wakeref_t crtc_wakeref = 0; int i; intel_atomic_commit_fence_wait(intel_state); @@ -12615,7 +12617,8 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state) put_domains[to_intel_crtc(crtc)->pipe] = modeset_get_crtc_power_domains(crtc, - to_intel_crtc_state(new_crtc_state)); + to_intel_crtc_state(new_crtc_state), + &crtc_wakeref); } if (!needs_modeset(new_crtc_state)) @@ -12725,7 +12728,9 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state) intel_post_plane_update(to_intel_crtc_state(old_crtc_state)); if (put_domains[i]) - modeset_put_power_domains(dev_priv, put_domains[i]); + modeset_put_power_domains(dev_priv, + put_domains[i], + crtc_wakeref); intel_modeset_verify_crtc(crtc, state, old_crtc_state, new_crtc_state); } @@ -15920,11 +15925,16 @@ intel_modeset_setup_hw_state(struct drm_device *dev, } for_each_intel_crtc(dev, crtc) { + intel_wakeref_t wakeref; u64 put_domains; - put_domains = modeset_get_crtc_power_domains(&crtc->base, crtc->config); + put_domains = modeset_get_crtc_power_domains(&crtc->base, + crtc->config, + &wakeref); if (WARN_ON(put_domains)) - modeset_put_power_domains(dev_priv, put_domains); + modeset_put_power_domains(dev_priv, + put_domains, + wakeref); } intel_display_set_init_power(dev_priv, false);