From patchwork Tue Jun 20 06:47:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Karlman X-Patchwork-Id: 13285225 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C2FF8EB64DB for ; Tue, 20 Jun 2023 06:48:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=tTufv14k2F6epg8skEhyx/l411N8SDxRSM0qFCoCJ/g=; b=i2UdsiLYShaAwEQ5RPOtKBJMJl qT2HDFfERUQVD56wpRnOR1pm4KNA0XMEUdvNwzLr9J1WYJyEaEdZ4FCrOGH93yZ6gO+Ksf1sKnOPV tPqzolMlB5YjvrGbGUqRaiBkwmMd6DSGPTgHLqJg0eXIPzD4dnVQuSZg65aQPxXn+msAM5q9irPdA H2JFGeV3l+BY+xTMqnp2bbIADZka98VQF9jFr/rdiWx38VXEWtnw4GbsdMMu0ZZYNujM+0GdnWzqP UPRmYRKW+9wwaNR5NxymqXNO+IK4Y8nziaYtlkH6PUHEwDRi7JMbUJFBrTpGoGzdrNDH9IVjRdTLL nR0jALXw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qBV9b-00AIhN-2E; Tue, 20 Jun 2023 06:47:51 +0000 Received: from s.wrqvtzvf.outbound-mail.sendgrid.net ([149.72.126.143]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qBV9Q-00AIZn-2l for linux-arm-kernel@lists.infradead.org; Tue, 20 Jun 2023 06:47:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; h=from:subject:in-reply-to:references:mime-version:to:cc: content-transfer-encoding:content-type:cc:content-type:from:subject:to; s=s1; bh=DWKAFEQyu98IZ9ZgJni/kueEjxYsF0HocTjSZNu5dc0=; b=cMGNWwX+FeprtsjEHvLYOSUZ211lLDMzQXxmXdfQhxXIqJbaWseCwlohRjzI8kWuzPVL O2VB9JXBKQsD/DbNxiMXMzrmLn03KrwtiWKFhwPTDUONzAcndz3OJxTXiIAK43QzW2FAgE ZBRJwv8azP6NtTHPv24FUCskm796yXLRLWHErC/HoPfWA8IK21mKgKU19TUubA+a121BpS Ly4qAioPvfhZiYD2EEmJz8Hamf+flxBeMdXw28hgWOzvmHMFcZWbHUgXLCnEGc4DjPpMSt uZHz+RNGL0QnNHtiF32vqkQMt/KjyLSk43zlGMXPfeWilVw59ShCanwl9SXr73IA== Received: by filterdrecv-77869f68cc-wnrh7 with SMTP id filterdrecv-77869f68cc-wnrh7-1-64914B8B-15 2023-06-20 06:47:39.640836851 +0000 UTC m=+3481899.293266760 Received: from bionic.localdomain (unknown) by geopod-ismtpd-5 (SG) with ESMTP id HGVB4aOXSe-PK4Ce6TiCSw Tue, 20 Jun 2023 06:47:39.424 +0000 (UTC) From: Jonas Karlman Subject: [PATCH 4/4] drm/rockchip: vop2: Add missing call to crtc reset helper Date: Tue, 20 Jun 2023 06:47:39 +0000 (UTC) Message-ID: <20230620064732.1525594-5-jonas@kwiboo.se> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230620064732.1525594-1-jonas@kwiboo.se> References: <20230620064732.1525594-1-jonas@kwiboo.se> MIME-Version: 1.0 X-SG-EID: TdbjyGynYnRZWhH+7lKUQJL+ZxmxpowvO2O9SQF5CwCVrYgcwUXgU5DKUU3QxAfZekEeQsTe+RrMu3cja6a0h6Y7pOvDXJbRf1XNurdBi7Uj4gm/qSVvpHVBX1ECIzrzeDP264QZlPK8XVyx2htZ01V+Bv6v+2TFKR+yi8Clec0kLf31l1W+PQuCgBI2xqw6mAtamaTqUrLBdY8VlFeBl/JMY6FxGbz/agvZMub4kmISPW8okmWuEpABQ4q+sqY2Z+kxR1EmUfgvebbOZEMpoA== To: Sandy Huang , Heiko Stuebner , David Airlie , Daniel Vetter , Rob Herring , Andy Yan , Sascha Hauer Cc: Mark Yao , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Jonas Karlman X-Entity-ID: P7KYpSJvGCELWjBME/J5tg== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230619_234740_968686_DD321D49 X-CRM114-Status: GOOD ( 11.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add missing call to crtc reset helper to properly vblank reset. Also move vop2_crtc_reset and call vop2_crtc_destroy_state to simplify and remove duplicated code. Fixes: 604be85547ce ("drm/rockchip: Add VOP2 driver") Signed-off-by: Jonas Karlman --- drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 28 ++++++++------------ 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c index f725487d02ef..1be84fe0208f 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c @@ -2080,23 +2080,6 @@ static const struct drm_crtc_helper_funcs vop2_crtc_helper_funcs = { .atomic_disable = vop2_crtc_atomic_disable, }; -static void vop2_crtc_reset(struct drm_crtc *crtc) -{ - struct rockchip_crtc_state *vcstate = to_rockchip_crtc_state(crtc->state); - - if (crtc->state) { - __drm_atomic_helper_crtc_destroy_state(crtc->state); - kfree(vcstate); - } - - vcstate = kzalloc(sizeof(*vcstate), GFP_KERNEL); - if (!vcstate) - return; - - crtc->state = &vcstate->base; - crtc->state->crtc = crtc; -} - static struct drm_crtc_state *vop2_crtc_duplicate_state(struct drm_crtc *crtc) { struct rockchip_crtc_state *vcstate; @@ -2123,6 +2106,17 @@ static void vop2_crtc_destroy_state(struct drm_crtc *crtc, kfree(vcstate); } +static void vop2_crtc_reset(struct drm_crtc *crtc) +{ + struct rockchip_crtc_state *vcstate = + kzalloc(sizeof(*vcstate), GFP_KERNEL); + + if (crtc->state) + vop2_crtc_destroy_state(crtc, crtc->state); + + __drm_atomic_helper_crtc_reset(crtc, &vcstate->base); +} + static const struct drm_crtc_funcs vop2_crtc_funcs = { .set_config = drm_atomic_helper_set_config, .page_flip = drm_atomic_helper_page_flip,