From patchwork Thu Feb 28 21:09:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10833737 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 E04731575 for ; Thu, 28 Feb 2019 21:10:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D139C2F585 for ; Thu, 28 Feb 2019 21:10:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C58CA2F59F; Thu, 28 Feb 2019 21:10:38 +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 5E7942F585 for ; Thu, 28 Feb 2019 21:10:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6E1F76E23E; Thu, 28 Feb 2019 21:10:37 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) by gabe.freedesktop.org (Postfix) with ESMTPS id EACB46E23E for ; Thu, 28 Feb 2019 21:10:35 +0000 (UTC) Received: by mail-qk1-x743.google.com with SMTP id r21so12975575qkl.11 for ; Thu, 28 Feb 2019 13:10:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JQ/TXV2v32lkS1JUy8HLCvx9guBcKjqvu5GBGLQlB88=; b=HaE9WQnfDtYGehA+lcCluVrYQJTguzZttwaMxZjkSqz2fgtrzIzpzxisiXWTSs1L9m o+T2iyGkzEtWl5AkuszuRSp5D+z0hGtpluEOZDKEJvqxP0R0KFzXajdXWKJOiZAwbNc0 5Zk6tOFyU6i+Tos5r+1pmxDkNYiIyp1EiNR6ftpDdx5r8Jdzb/jMf2bX060WcLUjqif/ xJLhGJs1P1gV/xIZ+6vjeTu7JX0jd4HSzTxN2OzO5No24tUxMwpAwf7TRrRiZz5v2HsS HsRDFLeo1YGTf1oXPHR4M+4MzcRGUclK5AOT6U1sfeGnI+lqFda8Au5FEKev3VlnO2d/ FgQQ== X-Gm-Message-State: APjAAAWkYGepOoW3llX/PmWux2NoE8SxMr+Zjknjghkmo3vckjfD0VF7 TRYqoX0c6827SvUOK9ocwpF06QwNHJk= X-Google-Smtp-Source: APXvYqyogcIE47CQJRd4MrOhycuRiy2MSbd6+SRlDgg6Rv+6AwXocaX7RInEb+is3xCA8xWM0MvFLg== X-Received: by 2002:a05:620a:1244:: with SMTP id a4mr1210782qkl.201.1551388235045; Thu, 28 Feb 2019 13:10:35 -0800 (PST) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:89c6:2139:5435:371d]) by smtp.gmail.com with ESMTPSA id 70sm23271846qkb.39.2019.02.28.13.10.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Feb 2019 13:10:34 -0800 (PST) From: Sean Paul To: dri-devel@lists.freedesktop.org Subject: [PATCH 4/5] drm/rockchip: Don't fully disable vop on PSR Date: Thu, 28 Feb 2019 16:09:33 -0500 Message-Id: <20190228210939.83386-5-sean@poorly.run> X-Mailer: git-send-email 2.21.0.rc2.261.ga7da99ff1b-goog In-Reply-To: <20190228210939.83386-1-sean@poorly.run> References: <20190228210939.83386-1-sean@poorly.run> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JQ/TXV2v32lkS1JUy8HLCvx9guBcKjqvu5GBGLQlB88=; b=FoihQCcX1Zww03UnZ9oZKjkbYfqgkT+cmZ8UnNssD2xF8vPKMvQSHtrZdpVUbryxwW WRJa9lZzJUOGmNtq1kokCk5k8edLjoxO1azhdwwFpsmb9+kmzDL+pZMHtFqyfIGJHpA6 a/3P8fqf+3Mn3ufX1P25L+QeefOTmHhdXKVCNulOd1jKArfXpwqKLpQz8UNUbKs1C4LZ 0wX+icMtea0A6cQZ07UJu8TzMwASLZi3d4k8337xcOZ0F09jUnWa4q7st8wfUsj7/7eW 8ZdyT/S0rmfzGlQmfwmJkDu0J//76aZ2saWoYF2kX93b7AQcNpVdTi6ipwFZLdxFtQb6 KDug== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Zain Wang , David Airlie , Tomasz Figa , Sean Paul , "Kristian H . Kristensen" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul Instead of fully disabling and re-enabling the vop on PSR transitions, only disable the active windows. This will speed up PSR exits substantially and is still a power-savings win. This patch integrates portions of Zain's patch from here: https://patchwork.kernel.org/patch/9615063/ Cc: Zain Wang Cc: Tomasz Figa Cc: Kristian H. Kristensen Signed-off-by: Sean Paul --- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 38 +++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index 66c99d57e62a..025cfb55ffe2 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -131,6 +131,7 @@ struct vop { bool is_enabled; struct completion dsp_hold_completion; + unsigned int win_enabled; /* protected by dev->event_lock */ struct drm_pending_vblank_event *event; @@ -591,6 +592,7 @@ static int vop_enable(struct drm_crtc *crtc, struct drm_crtc_state *old_state) const struct vop_win_data *win = vop_win->data; VOP_WIN_SET(vop, win, enable, 0); + vop->win_enabled &= ~BIT(i); } } spin_unlock(&vop->reg_lock); @@ -621,6 +623,25 @@ static int vop_enable(struct drm_crtc *crtc, struct drm_crtc_state *old_state) return ret; } +static void rockchip_drm_set_win_enabled(struct drm_crtc *crtc, bool enabled) +{ + struct vop *vop = to_vop(crtc); + int i; + + spin_lock(&vop->reg_lock); + + for (i = 0; i < vop->data->win_size; i++) { + struct vop_win *vop_win = &vop->win[i]; + const struct vop_win_data *win = vop_win->data; + + VOP_WIN_SET(vop, win, enable, + enabled && (vop->win_enabled & BIT(i))); + } + vop_cfg_done(vop); + + spin_unlock(&vop->reg_lock); +} + static void vop_crtc_atomic_disable(struct drm_crtc *crtc, struct drm_crtc_state *old_state) { @@ -628,9 +649,15 @@ static void vop_crtc_atomic_disable(struct drm_crtc *crtc, WARN_ON(vop->event); + if (crtc->state->psr_transition) + rockchip_drm_set_win_enabled(crtc, false); + mutex_lock(&vop->vop_lock); drm_crtc_vblank_off(crtc); + if (crtc->state->psr_transition) + goto out; + /* * Vop standby will take effect at end of current frame, * if dsp hold valid irq happen, it means standby complete. @@ -661,6 +688,8 @@ static void vop_crtc_atomic_disable(struct drm_crtc *crtc, clk_disable(vop->dclk); vop_core_clks_disable(vop); pm_runtime_put(vop->dev); + +out: mutex_unlock(&vop->vop_lock); if (crtc->state->event && !crtc->state->active) { @@ -741,6 +770,7 @@ static void vop_plane_atomic_disable(struct drm_plane *plane, spin_lock(&vop->reg_lock); VOP_WIN_SET(vop, win, enable, 0); + vop->win_enabled &= ~BIT(VOP_WIN_TO_INDEX(vop_win)); spin_unlock(&vop->reg_lock); } @@ -879,6 +909,7 @@ static void vop_plane_atomic_update(struct drm_plane *plane, } VOP_WIN_SET(vop, win, enable, 1); + vop->win_enabled |= BIT(win_index); spin_unlock(&vop->reg_lock); } @@ -1034,6 +1065,12 @@ static void vop_crtc_atomic_enable(struct drm_crtc *crtc, uint32_t pin_pol, val; int ret; + if (old_state->psr_transition) { + drm_crtc_vblank_on(crtc); + rockchip_drm_set_win_enabled(crtc, true); + return; + } + mutex_lock(&vop->vop_lock); WARN_ON(vop->event); @@ -1627,6 +1664,7 @@ static int vop_initial(struct vop *vop) VOP_WIN_SET(vop, win, channel, (channel + 1) << 4 | channel); VOP_WIN_SET(vop, win, enable, 0); VOP_WIN_SET(vop, win, gate, 1); + vop->win_enabled &= ~BIT(i); } vop_cfg_done(vop);