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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2E52C61DA4 for ; Mon, 6 Mar 2023 10:49:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230031AbjCFKt6 (ORCPT ); Mon, 6 Mar 2023 05:49:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229486AbjCFKtq (ORCPT ); Mon, 6 Mar 2023 05:49:46 -0500 Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 227E8227BC for ; Mon, 6 Mar 2023 02:49:45 -0800 (PST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 8E3635C01A5; Mon, 6 Mar 2023 05:49:44 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Mon, 06 Mar 2023 05:49:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm2; t= 1678099784; x=1678186184; bh=5voqj1UTp1uxxITYu9fh9Ol0FbqK4YPPE+0 tPe4AYbI=; b=VNUmW2wV9jTVXVHAnDhDswnbqCEZ1v5c8MTh2HtMSq/qIomoB6O HsPsKlCMFo98vW3XcQ/TJLLWQ253Akp8cnkgoKRu7S7HuFTnVjXsByojjorebaUR 7rAOwkB5RYRzrFzjkzW0dQIBY+P1ar0DRmt/USIK+Q4RrQE0CScUa4cQyASKYAZE uhiSadrrsJLotyaSCa9kYqeDBJyrQdMo4c/OD2OfhVApdVjZJZoOD0p5unq/I5Tf hqCPDM5HETjuzVyWsA7qeCGU4rboFfErepSLb5RQWNIDAR0mbRNMnBmV3BxwKoqL Cl2TA6QefOCjiItO9qLSfkLl70WBzu97aHg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :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=fm1; t= 1678099784; x=1678186184; bh=5voqj1UTp1uxxITYu9fh9Ol0FbqK4YPPE+0 tPe4AYbI=; b=c6k6muqoTRfDOzgyjuDAEJCEP+DL3APUDle1M2sJFSbI3OI5wvB dBCZ1EBk3YLMtdSEykFqzVffnMRD4LSHPVU2vBJBfDBPVXkvEUzmZJ5Xcp79OgkO ekprCX6K90+gDxsh3sGViQPUn+kQVKZgMDpSp/9jdXxcfYI0vzdX+CfZOR9cz1XB M88jmRX+MmaRky9y4S3dXUHoatU5wDbEk0WzJk03FcgYVdnQY+ZDmH9F7xfKCvR8 UoSE0/cp0W1UzE2ziUtUQde3rVM8MhmGm3yx/RSs95xpBBa7qAuiq0bQkDoWoxJh OR8/OB9ASoytAcEBA8PO29zyi0rHT0J7M9A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvddtiedgudelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertdertdejnecuhfhrohhmpeforgig ihhmvgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrf grthhtvghrnhepgfffgeeiteevheffudfgkeetvddvhfduiefftdelheegudevgfevfeel ffekffdunecuffhomhgrihhnpehmrghrghhinhhsrdhtohhpnecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhgrgihimhgvsegtvghrnhhordht vggthh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 6 Mar 2023 05:49:43 -0500 (EST) From: Maxime Ripard Date: Mon, 06 Mar 2023 11:46:43 +0100 Subject: [PATCH v3 2/9] drm/vc4: hdmi: Update all the planes if the TV margins are changed MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20221207-rpi-hdmi-improvements-v3-2-bdd54f66884e@cerno.tech> References: <20221207-rpi-hdmi-improvements-v3-0-bdd54f66884e@cerno.tech> In-Reply-To: <20221207-rpi-hdmi-improvements-v3-0-bdd54f66884e@cerno.tech> To: Emma Anholt , Maxime Ripard , David Airlie , Daniel Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Dave Stevenson , Hans Verkuil , Maxime Ripard , Thomas Zimmermann X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2097; i=maxime@cerno.tech; h=from:subject:message-id; bh=/Ss7R3gA1j6Cq8lhyLN7QCMVAwk0YkENDxLmFGr0ejY=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDCmsR6Yn3L30oTe8XohdvLNKxm8HZ82ndf6syTJcq6Msg7nN HyV1lLIwiHExyIopssQImy+JOzXrdScb3zyYOaxMIEMYuDgFYCITIhn+F6UcucF6IG7TS0PevqwrrD VWhxonuNtaxHd9No+eG+gnzMiw/fKtVfLFV5c/z/r1s/GU7hbWm02SORoKaxyMkucfT9rECAA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On VC4, the TV margins on the HDMI connector are implemented by scaling the planes. However, if only the TV margins or the connector are changed by a new state, the planes ending up on that connector won't be. Thus, they won't be updated properly and we'll effectively ignore that change until the next commit affecting these planes. Let's make sure to add all the planes attached to the connector so that we can update them properly. Reviewed-by: Thomas Zimmermann Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_hdmi.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index ea22c9bf223a..522cfbc83fe4 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -535,6 +535,32 @@ static int vc4_hdmi_connector_atomic_check(struct drm_connector *connector, if (!crtc) return 0; + if (old_state->tv.margins.left != new_state->tv.margins.left || + old_state->tv.margins.right != new_state->tv.margins.right || + old_state->tv.margins.top != new_state->tv.margins.top || + old_state->tv.margins.bottom != new_state->tv.margins.bottom) { + struct drm_crtc_state *crtc_state; + int ret; + + crtc_state = drm_atomic_get_crtc_state(state, crtc); + if (IS_ERR(crtc_state)) + return PTR_ERR(crtc_state); + + /* + * Strictly speaking, we should be calling + * drm_atomic_helper_check_planes() after our call to + * drm_atomic_add_affected_planes(). However, the + * connector atomic_check is called as part of + * drm_atomic_helper_check_modeset() that already + * happens before a call to + * drm_atomic_helper_check_planes() in + * drm_atomic_helper_check(). + */ + ret = drm_atomic_add_affected_planes(state, crtc); + if (ret) + return ret; + } + if (old_state->colorspace != new_state->colorspace || !drm_connector_atomic_hdr_metadata_equal(old_state, new_state)) { struct drm_crtc_state *crtc_state; -- 2.39.2