From patchwork Thu Mar 31 14:37:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12797184 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 0BA11C433F5 for ; Thu, 31 Mar 2022 14:37:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 55F6210EEE0; Thu, 31 Mar 2022 14:37:53 +0000 (UTC) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3BCDB10EEFE for ; Thu, 31 Mar 2022 14:37:51 +0000 (UTC) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id C14265C0210; Thu, 31 Mar 2022 10:37:50 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Thu, 31 Mar 2022 10:37:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; bh=jm5IKwIbXDkANdhso+frVJ+FbR6Nkn bfG4zVfDUE5dU=; b=ShsHnZQL/9gntbL3rXprcB+Ob/HLOvK9roFQZWdC5YCiRb zsvlITAmCuekRvYbjXjuNoMXIjBooy+GuerQPMK7MPJhNfD5gwylB5lX8gVPpCaH hs3/1Fnm5o7ga4JHfL8uXHdjh/R3+HXx4cT9mgA6vUp8OW9HZDCapNPiZF7tXosd IxxUHQ0D4D6kC/kbBnfb2fcUxSEmmzOOJ0ufni+oBv9HZp4JZLgZnP5480kviNIC x7dsXahrFJ/1F1br/hnbc/rEd0zg2FolDQNUmeSITwMDjKUl1aQY/+4/TW8LIYix HyJkruio22vDYCnpGNAhTyk1n71pGj0NXWSN3cZA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=jm5IKw IbXDkANdhso+frVJ+FbR6NknbfG4zVfDUE5dU=; b=WAnPKbYYBLetGKwqBT/VEn Fm9MdXf6aT6kPy7/upJsxJU7hcK3tLFu+diRE+Fl51rAHIckZfKOjNqPowtpIVb5 5QOGYa7sm/dnLXLgjM/rbu8FFvXA8JLgIMe4H83eFsulKydJiObDAchz0yZbmTIS VnhBluMNbo5bC2w3Gw6i+3GmK/erQsD/bCUDXvSe6nP7w7LIWcFjMmAAa9WeJF4Q GIBUnxxIOeOzXJj4bT+hvPEU6kP7919n28DP4HvuEVrluPLlI/BIkKl+rf6xQmer h1OWMlingCzTHplr/bitebCvMlhcNrlOmRM7iTZfYAtQwJTBZq4Q+Q7Mu4ko2BNw == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudeigedgjeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepvdekleevfeffkeejhfffueelteelfeduieefheduudfggffhhfffheevveeh hedvnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmh grgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 31 Mar 2022 10:37:50 -0400 (EDT) From: Maxime Ripard To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 1/7] drm/vc4: kms: Take old state core clock rate into account Date: Thu, 31 Mar 2022 16:37:38 +0200 Message-Id: <20220331143744.777652-2-maxime@cerno.tech> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220331143744.777652-1-maxime@cerno.tech> References: <20220331143744.777652-1-maxime@cerno.tech> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , Daniel Vetter , Maxime Ripard , Thomas Zimmermann Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" During a commit, the core clock, which feeds the HVS, needs to run at a minimum of 500MHz. While doing that commit, we can also change the mode to one that requires a higher core clock, so we take the core clock rate associated to that new state into account for that boost. However, the old state also needs to be taken into account if it requires a core clock higher that the new one and our 500MHz limit, since it's still live in hardware at the beginning of our commit. Fixes: 16e101051f32 ("drm/vc4: Increase the core clock based on HVS load") Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_kms.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c index 24de29bc1cda..992d6a240002 100644 --- a/drivers/gpu/drm/vc4/vc4_kms.c +++ b/drivers/gpu/drm/vc4/vc4_kms.c @@ -385,9 +385,10 @@ static void vc4_atomic_commit_tail(struct drm_atomic_state *state) } if (vc4->hvs->hvs5) { + unsigned long state_rate = max(old_hvs_state->core_clock_rate, + new_hvs_state->core_clock_rate); unsigned long core_rate = max_t(unsigned long, - 500000000, - new_hvs_state->core_clock_rate); + 500000000, state_rate); clk_set_min_rate(hvs->core_clk, core_rate); }