From mboxrd@z Thu Jan 1 00:00:00 1970 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 C0B3AECAAD3 for ; Mon, 5 Sep 2022 16:57:24 +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-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=eaQBmZm+xQ0Tcraac2eJAtoYertr31fuMLEX/yDDulo=; b=3PVee8CZDwlEjcy1tdbqlpjjWn x1aHn/8HXplr+6PnPy6yuNvkkLlTxFMSWCb3FxXXuTWpH231hmH3YwRxVI2mWVNJEf0D01+JcnL4Q evxu3Kt8YyKDcanM6zuafNYuiwCHpfihSvwAUh2S244bBZs8iRG17xq5MqiTE+HER5fvz/+3NoO8K wCi0nJboiU+ingIU71KLd9sdSAaaplaTRrce1FHeTtAU2LRtIhw0UCTnlkF77vbEqY1EHmOcxjqWx iVydD2EfErK6U/BdbfMAxSz6wQitZdCh1kxzzmp3Er0VMLb/TUWh4/PfdDPPoE9m9RnhIC1oIymcX 5lTVN1+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVFKL-0076y0-AC; Mon, 05 Sep 2022 16:52:03 +0000 Received: from desiato.infradead.org ([90.155.92.199]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVCnb-004BgZ-SB for linux-arm-kernel@bombadil.infradead.org; Mon, 05 Sep 2022 14:10:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=0O41lIsAoQE7Npc7joN//WSwmuH7s7KunBYUx8/vABE=; b=HpYLZU+bIH0poa6AcU5pzVGoXc k+HDejELB0QEDqDE5sANrW/PyGlkwv3OKyIWafS7YlyEJoMu5ukolkyABkvE1UJnaVORjKwSlFqba uh2rVexN6TQ+W0u2xfKg2Em6UFE0aWbdZEzyb6Mpiw53rKNZpQq+kaCjZuUMUi5c0jdvI0sGZrIIm lY6+VIltbS2729Td3aExT2HSz+4rG6CbywDOaktQ6DVqi0FYS7kw5GAPHAtsU6FRsw78GyIpDU5d2 hEaRBvmEdL+HJyONXHC/IJKwpVVTMas3rQfULeKpUAlTSb3UHH1H41tH+sVeXGrsEEld1T3Xu1ZOJ Om5kdE3w==; Received: from new4-smtp.messagingengine.com ([66.111.4.230]) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVCIg-009f3D-Dh for linux-arm-kernel@lists.infradead.org; Mon, 05 Sep 2022 13:38:08 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id 0AAC7580281; Mon, 5 Sep 2022 09:37:58 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 05 Sep 2022 09:37:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc: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=fm3; t=1662385078; x=1662392278; bh=0O41lIsAoQ E7Npc7joN//WSwmuH7s7KunBYUx8/vABE=; b=X7HWNhyjGfDlsQRlHJm0m7wprr 6MFfZlhumCRQ3p4goinni3jIkeUQf4wueWlUdIWrJ4uEKSLLsgDihlVS7h8NI0So W3IBZU0nCWqt6lcprZaMfQt+MdhJHQnb/fikIDm3i2mWEKS1+83DLroJ5FL8rtla Zsg8ziSEc1AfokXUmnhpFS5GYU80ZBOAND76jLKH2U115nexXrrE6xPnki3ot+v2 auZcnuSPcKaQd2WIhOUsvlmmO2uAQbXQaFNLN3V38gg6kejHXtkWIpGetN5hW1sF 3LSBVWWAshMasYkAzu3JsB75wgKmKhgFC++sTAEg98VImAOXbJogQmUo59Xg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc: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=1662385078; x=1662392278; bh=0O41lIsAoQE7Npc7joN//WSwmuH7 s7KunBYUx8/vABE=; b=GVlBEYLqTO4rnteutkIbGoa1BxOG7P5pOdaf/SCczvni Rfs3e+UBVE6kP/hQvryAZs7xMI5vGrFmlmuLiwiBg06SBrWrAtKgDFwQEegEY8D+ XUhaOOa8h1gGUUhCGMBRWQCsmOyo2Wcf3SdsqA+75+dpPtpyB3RJX9rqDf3RvsA7 mflQjKITUnKFVg+NQVrIWR3UMuI36HLsgJxlJfUyj+UIRyImf1t+7SxiehvdEK19 uCDv9GLBNMj4EhFJzFnis+tcFRCZzh7bhq0C7f9eGtBhJf/nf4+Lm/Trd0k7m21h bNCLgGwUYSP+DcrhHzxPLYy+eQ7DPmqfrWfXZ3Y6uw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdeliedgieekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesghdtreertddtudenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeejveefheefkeeiffegveelveetgffffeektdefuefhtedtgeejhefggedu ffffudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 5 Sep 2022 09:37:56 -0400 (EDT) Date: Mon, 5 Sep 2022 15:37:55 +0200 From: Maxime Ripard To: Mateusz Kwiatkowski Cc: Ben Skeggs , David Airlie , Chen-Yu Tsai , Thomas Zimmermann , Jani Nikula , Lyude Paul , Philipp Zabel , Maarten Lankhorst , Rodrigo Vivi , Tvrtko Ursulin , Jernej Skrabec , Samuel Holland , Karol Herbst , Noralf =?utf-8?Q?Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen , Hans de Goede , linux-arm-kernel@lists.infradead.org, Phil Elwell , intel-gfx@lists.freedesktop.org, Dave Stevenson , dri-devel@lists.freedesktop.org, Dom Cobley , linux-kernel@vger.kernel.org, nouveau@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven Subject: Re: [PATCH v2 10/41] drm/modes: Add a function to generate analog display modes Message-ID: <20220905133755.gcmmntg3wnecyqjq@houat> References: <20220728-rpi-analog-tv-properties-v2-0-459522d653a7@cerno.tech> <20220728-rpi-analog-tv-properties-v2-10-459522d653a7@cerno.tech> <242d272b-5b79-986c-9aaf-64e62f6b37ff@gmail.com> MIME-Version: 1.0 In-Reply-To: <242d272b-5b79-986c-9aaf-64e62f6b37ff@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220905_143806_612296_32739E32 X-CRM114-Status: GOOD ( 18.84 ) 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: , Content-Type: multipart/mixed; boundary="===============2262309434247223570==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============2262309434247223570== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="duymfdwojjs2xq73" Content-Disposition: inline --duymfdwojjs2xq73 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Wed, Aug 31, 2022 at 03:44:52AM +0200, Mateusz Kwiatkowski wrote: > > +#define NTSC_HFP_DURATION_TYP_NS=A0=A0 =A01500 > > +#define NTSC_HFP_DURATION_MIN_NS=A0=A0 =A01270 > > +#define NTSC_HFP_DURATION_MAX_NS=A0=A0 =A02220 >=20 > You've defined those min/typ/max ranges, but you're not using the "typ" f= ield > for anything other than hslen. Yeah... I've left most of them because it was so hard to find most of them, it's useful at least for documentation purposes. And it's a define so there's pretty much no downside to it as far as the final binary is involved. > The actual "typical" value is thus always the midpoint, which isn't > necessarily the best choice. >=20 > In particular, for the standard 720px wide modes at 13.5 MHz, hsync_start > ends up being 735 for 480i and 734 for 576i, instead of 736 and 732 reque= sted > by BT.601. That's all obviously within tolerances, but the image ends up > noticeably off-center (at least on modern TVs), especially in the 576i ca= se. I'll try to fix that up. > > +=A0=A0 =A0htotal =3D params->line_duration_ns * pixel_clock_hz / NSEC_= PER_SEC; >=20 > You're multiplying an unsigned int and an unsigned long - both types are = only > required to be 32 bit, so this is likely to overflow. You need to use a c= ast to > unsigned long long, and then call do_div() for 64-bit division. >=20 > This actually overflowed on me on my Pi running ARM32 kernel, resulting in > negative horizontal porch lengths, and drm_helper_probe_add_cmdline_mode() > taking over the mode generation (badly), and a horrible mess on screen. Indeed, that's bad. > > +=A0=A0 =A0vfp =3D vfp_min + (porches_rem / 2); > > +=A0=A0 =A0vbp =3D porches - vfp; >=20 > Relative position of the vertical sync within the VBI effectively moves t= he > image up and down. Adding that (porches_rem / 2) moves the image up off c= enter > by that many pixels. I'd keep the VFP always at minimum to keep the image > centered. And you would increase the back porch only then? Maxime --duymfdwojjs2xq73 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCYxX7swAKCRDj7w1vZxhR xYNaAP9smEnRh5n1ZGmEenQrzOJSe2qrC45ne/SGvv82vvsHOAD/S1/3mpdTYjRp q9UQRTTfatktAcjCnUHE0eBICMwRtA4= =w772 -----END PGP SIGNATURE----- --duymfdwojjs2xq73-- --===============2262309434247223570== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============2262309434247223570==--