From patchwork Fri May 18 08:25:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Enric Balletbo i Serra X-Patchwork-Id: 10408719 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 27563601F9 for ; Fri, 18 May 2018 08:38:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 14581237A5 for ; Fri, 18 May 2018 08:38:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 08D4223B24; Fri, 18 May 2018 08:38:07 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6BC55237A5 for ; Fri, 18 May 2018 08:38:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=TUWHgHPXYgxp40p801Xobzp+VAJA3dS6wQ/ka5wUvSk=; b=WQbWGwvPuddbi/ sTMziR9lDncEeKcg5aHjJDtNfdZjW9zDsAya4c2uiFqHOsbYKB37NsDsacLUISfiS8nCIMgKwjP2i IJjexQWC99FqCct/oVwPKpmy/n/ERaM+ew7sHpQSMxeKLnE14Y0c4zP2Ymga+5w0TmBOu6MSnP05j uhkhkHuOCZ2PTM35sC7TR/G91f0FTcGJZuQn3z09qGG/C3L3XLAVvCjxXW3GOxFCbD6AAuhxW4vx0 v8MbFs1q26u+ErRIwA8NfnPAQz+qiavJJiI+Xsmn7ElOGR6YxtTXReMGh9UFWGCMrqJ+fHDWM8lD8 3GJcoHnp/Fc9+l5Sv7Iw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fJati-0001nY-W2; Fri, 18 May 2018 08:37:59 +0000 Received: from casper.infradead.org ([85.118.1.10]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fJasj-0001Am-T5; Fri, 18 May 2018 08:36:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=SQtp26P7fZiwYr2VUBiOCNMi0+WMmZ2U2K85RvdYnFE=; b=aWf8eHPtpWhvAplU9GUSRe0XYV SEqmgIjfMQdbYtl2nQky1NT3kQs7ciIIYT4RaiFhjKMRp3UMuUzeGyHn5iPXGBtc3FJRr1kSMFTHz 1aBVk2/4y0zQKSv+606D6+L9PYfrOBuW3NU3ehLSruZ5D0diUl/6k3WEZvHUbQf0aGINf2wZIioPf ZRGFOF0ukDh+e22HUK1/iUfbxIZ7d+3bqPrUHrFPr7yjiJXydQyjL5GKLbN3z+vfQnAX/xvyw+rfw TLSh28Kw3SfDfJw1EvXrmeqOnr/9ri+DP7+lxRThyfh0zz3ZFnMYGvjVB7KqATfB1Pffm6905jhzN /tzLYYLA==; Received: from bhuna.collabora.co.uk ([46.235.227.227]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fJaiL-0005hB-KD; Fri, 18 May 2018 08:26:15 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id 165F9279FED From: Enric Balletbo i Serra To: Sandy Huang , =?UTF-8?q?Heiko=20St=C3=BCbner?= , David Airlie Subject: [RFC PATCH] drm/rockchip: update cursors asynchronously through atomic. Date: Fri, 18 May 2018 10:25:48 +0200 Message-Id: <20180518082548.13450-1-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.17.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180518_092613_665768_879B3BEF X-CRM114-Status: GOOD ( 16.21 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?St=C3=A9phane=20Marchesin?= , Sean Paul , Gustavo Padovan , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, tomasz Figa , linux-rockchip@lists.infradead.org, kernel@collabora.com, linux-arm-kernel@lists.infradead.org, mark.yao@rock-chips.com Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add support to async updates of cursors by using the new atomic interface for that. Signed-off-by: Enric Balletbo i Serra --- I am sending this as RFC because I still don't have a deep knowledge of the hw and I am not sure if the vop_plane_update function can be reused in both cases, atomic_updates and atomic_async_updates. I think that someone with more knowledge should take a look. The patch was tested on a Samsung Chromebook Plus in two ways. 1. Running all igt kms_cursor_legacy and kms_atomic@plane_cursor_legacy tests and see that there is no regression after the patch. 2. Running weston using the atomic API. Best regards, Enric drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 79 ++++++++++++++++----- 1 file changed, 63 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index 53d4afe15278..a89214541439 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -688,8 +688,7 @@ static void vop_plane_atomic_disable(struct drm_plane *plane, spin_unlock(&vop->reg_lock); } -static void vop_plane_atomic_update(struct drm_plane *plane, - struct drm_plane_state *old_state) +static void vop_plane_update(struct drm_plane *plane) { struct drm_plane_state *state = plane->state; struct drm_crtc *crtc = state->crtc; @@ -710,20 +709,6 @@ static void vop_plane_atomic_update(struct drm_plane *plane, bool rb_swap; int format; - /* - * can't update plane when vop is disabled. - */ - if (WARN_ON(!crtc)) - return; - - if (WARN_ON(!vop->is_enabled)) - return; - - if (!state->visible) { - vop_plane_atomic_disable(plane, old_state); - return; - } - obj = rockchip_fb_get_gem_obj(fb, 0); rk_obj = to_rockchip_obj(obj); @@ -794,10 +779,72 @@ static void vop_plane_atomic_update(struct drm_plane *plane, spin_unlock(&vop->reg_lock); } +static void vop_plane_atomic_update(struct drm_plane *plane, + struct drm_plane_state *old_state) +{ + struct drm_plane_state *state = plane->state; + struct vop *vop = to_vop(state->crtc); + + /* + * can't update plane when vop is disabled. + */ + if (WARN_ON(!state->crtc)) + return; + + if (WARN_ON(!vop->is_enabled)) + return; + + if (!state->visible) { + vop_plane_atomic_disable(plane, old_state); + return; + } + + vop_plane_update(plane); +} + +static int vop_plane_atomic_async_check(struct drm_plane *plane, + struct drm_plane_state *state) +{ + struct drm_crtc_state *crtc_state; + + crtc_state = drm_atomic_get_existing_crtc_state(state->state, + state->crtc); + if (WARN_ON(!crtc_state)) + return -EINVAL; + + if (!crtc_state->active) + return -EINVAL; + + if (plane->state->crtc != state->crtc || + plane->state->src_w != state->src_w || + plane->state->src_h != state->src_h || + plane->state->crtc_w != state->crtc_w || + plane->state->crtc_h != state->crtc_h || + !plane->state->fb || + plane->state->fb != state->fb) + return -EINVAL; + + return 0; +} + +static void vop_plane_atomic_async_update(struct drm_plane *plane, + struct drm_plane_state *new_state) +{ + plane->state->src_x = new_state->src_x; + plane->state->src_y = new_state->src_y; + plane->state->crtc_x = new_state->crtc_x; + plane->state->crtc_y = new_state->crtc_y; + plane->state->fb = new_state->fb; + + vop_plane_update(plane); +} + static const struct drm_plane_helper_funcs plane_helper_funcs = { .atomic_check = vop_plane_atomic_check, .atomic_update = vop_plane_atomic_update, .atomic_disable = vop_plane_atomic_disable, + .atomic_async_check = vop_plane_atomic_async_check, + .atomic_async_update = vop_plane_atomic_async_update, }; static const struct drm_plane_funcs vop_plane_funcs = {