Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp5474535rwb; Wed, 21 Sep 2022 08:16:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM621GB0GKpDHpG/Gba2Up86GVGcv97ZL4GbDACy6m8J8TyvcImHEL2jbuZFCy9s3F2RhztY X-Received: by 2002:a63:6c88:0:b0:430:662:e24c with SMTP id h130-20020a636c88000000b004300662e24cmr25413074pgc.318.1663773382675; Wed, 21 Sep 2022 08:16:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663773382; cv=none; d=google.com; s=arc-20160816; b=ssoU5+Dh5HyHYAZXpHGcXGTQabqtFAbwoCyBpLJqadGeBEzQF7OkW7h0YyHPfErZol 5aYrc08S1NE01edYxl2ruQO6y5t6Nupl2xwKOakWjLtfSvSHdxEyl0Bd3RmjCJSX5Ams Lkn+ZiZh34ufjDgjKOXR7ZkwCL3+wJRMoFxs52sBJ00DSlF5lO8MRyL0/SP2OceAUvwp NvrbXriEE5vs+VfL5n5qpZJFvVrOfmStf59mHfQxyQ3PXNl9E7rvyNluCyqkiYSVNzOC S1I6U5taXWvjd/kU2wrOeCgAIuB3a/FQ7JGGz2ZdiU+5m6/jp5Sci5zYfqCmfEbVAM9T ORww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:feedback-id :dkim-signature:dkim-signature; bh=zeS7eGWYYnWb55o8vuEX3/JmL16HTSaXpqzOa1s1OmM=; b=ZilLHRCNfo3eHBbINuRwSOwsEVNHZhuogOzJE0NlJfniplZFVlbTPLCoY17Mv/4yBO kwnwzivvuccSjhnjI6yLxICvSgfOzsnnOgg2AtgaKMpwBDR76rdVOxL61X2UUyfbXSXJ cpsoDf4hJICB8OqP9Grlmjvde+7EAR+rVtSbUxM5Sz8itUquCcVvdFJFURt41ksFw1fn JMzdf8alJSAaSfP4ykE87/IeMN5WxxrXdLSRsW1SPkqAkt4kjozQgXSya7sclrQgk//O /+pARYPln8KRYC6Q79ibheCYP8+t/6rw9PrWwSYtotz4V5dyVbcXG0L6FnTlRsa/rBhr guwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm2 header.b=0M0YkAeo; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=Q4FoZUSX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m15-20020a17090a414f00b00200320efa1asi2781286pjg.33.2022.09.21.08.16.10; Wed, 21 Sep 2022 08:16:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm2 header.b=0M0YkAeo; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=Q4FoZUSX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229687AbiIUPFi (ORCPT + 99 others); Wed, 21 Sep 2022 11:05:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230024AbiIUPFd (ORCPT ); Wed, 21 Sep 2022 11:05:33 -0400 Received: from new1-smtp.messagingengine.com (new1-smtp.messagingengine.com [66.111.4.221]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12ABA419A8 for ; Wed, 21 Sep 2022 08:05:32 -0700 (PDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id C21DF5817DE; Wed, 21 Sep 2022 11:05:24 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Wed, 21 Sep 2022 11:05:24 -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=fm2; t=1663772724; x=1663779924; bh=zeS7eGWYYn Wb55o8vuEX3/JmL16HTSaXpqzOa1s1OmM=; b=0M0YkAeojZnssmyhGXTFWP/RJZ 4B8i4ouZeY4Z0QBWU2jdU/tzOhqGkJ1aqGFIB2I04jyXAxjSy0ci//9zfroeC7wM LMhxWYautGXCGopjGBLTDH1FfyC+SfUGoOibhhRwdC+Ce/YdLlG9kTXffTYdu7SR Hc0N2svmjWpTyfyUzmbi79YgSkM9dkHe907rAXMjcNhnIg88r1LrpeyMcdsqe1KZ Qpg4SRjzHeUYWzrbQDI40b2zvETLltU4hWGPw/h6K2UaiJpS2W8tghWMoRUAVmge tjzvPmZvnewYbJK1A1qNqwF0DMbHD9+Ozt//ouyH3ZfmFq/OtaSlHd/m/rXg== 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= fm2; t=1663772724; x=1663779924; bh=zeS7eGWYYnWb55o8vuEX3/JmL16H TSaXpqzOa1s1OmM=; b=Q4FoZUSX4afJiLdXFgUX6H3zrL89vNlEFmSRSXS6LrJ6 Ef8fRPiTCNuyN3jetlga5TL/UJtnNEdkRiHKaNqeTkfmJUm/QLvlhaQ/+uKMTBFe Fb+3rOhcLc/FkboGJOJdAZqcLFHNreA+HtC03cpW58fk9MdfEkFeGmMqWrbnEquy fDbRb6aGvmY6bwafdLYJ2wbiKo+8gNZetyJjimUY3wso5RbK4Sk/FUVCjPu5gMq3 ESVdiPCTFfqTcrc0SBn3ikXEzTmvx1XX5tOximQ1/6HhE2ElwMP7mKT1K0u0fAu7 sGAzubusb+SRToiLf63KGpTVCM9W/c4bC5cX/8gqBQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeefuddgkeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesghdtreertddtudenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeejveefheefkeeiffegveelveetgffffeektdefuefhtedtgeejhefggedu ffffudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 21 Sep 2022 11:05:21 -0400 (EDT) Date: Wed, 21 Sep 2022 17:05:19 +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: <20220921150519.hijgemsk7o2tdrb3@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> <20220905133755.gcmmntg3wnecyqjq@houat> <10ce686a-d7c8-9ce4-3979-735ad8eab3b5@gmail.com> <20220907143421.4iopqwhp3yfircsh@houat> <20220909135444.5oi6oh6nqwuke3jl@houat> <79ab3fef-fdaa-e191-d839-4af88191e672@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="f6nvjv3uvyvilujx" Content-Disposition: inline In-Reply-To: <79ab3fef-fdaa-e191-d839-4af88191e672@gmail.com> X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --f6nvjv3uvyvilujx Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Sun, Sep 11, 2022 at 06:48:50AM +0200, Mateusz Kwiatkowski wrote: > >> Those extra vbp lines will be treated as a black bar at the top of the= frame, > >> and extra vfp lines will be at the bottom of the frame. > >> > >> However if someone specifies e.g. 720x604, there's nothing more you co= uld > >> remove from vfp, so your only option is to reduce vbp compared to the = standard > >> mode, so you'll end up with (vfp=3D=3D4, vsync=3D=3D6, vbp=3D=3D11). T= he image will not be > >> centered, the topmost lines will get cropped out, but that's the best = we can do > >> and if someone is requesting such resolution, they most likely want to= actually > >> access the VBI to e.g. emit teletext. > >> > >> Your current code always starts at (vfp=3D=3D5 or 6, vsync=3D6, vbp=3D= =3D6) and then > >> increases both vfp and vbp proportionately. This puts vsync dead cente= r in the > >> VBI, which is not how it's supposed to be - and that in turn causes th= e image > >> to be significantly shifted upwards. > >> > >> I hope this makes more sense to you now. > > > > I'm really struggling with this, so thanks for explaining this further > > (and patiently ;)) > > > > If I get this right, what you'd like to change is this part of the > > calculus (simplified a bit, and using PAL, 576i): > > > >=A0=A0 vfp_min =3D params->vfp_lines.even + params->vfp_lines.odd; // 5 > >=A0=A0 vbp_min =3D params->vbp_lines.even + params->vbp_lines.odd; // 6 > >=A0=A0 vslen =3D params->vslen_lines.even + params->vslen_lines.odd; // 6 > > > >=A0=A0 porches =3D params->num_lines - vactive - vslen; // 43 > >=A0=A0 porches_rem =3D porches - vfp_min - vbp_min; // 32 > > > >=A0=A0 vfp =3D vfp_min + (porches_rem / 2); // 21 > >=A0=A0 vbp =3D porches - vfp; // 22 > > > > Which is indeed having sync centered. > > > > I initially changed it to: > > > >=A0=A0 vfp =3D vfp_min; // 6 > >=A0=A0 vbp =3D num_lines - vactive - vslen - vfp; // 38 > > > > Which is close enough for 576i, but at 480i/50Hz would end up with 134, > > so still fairly far off. > > > > I guess your suggestion would be along the line of: > > > >=A0=A0 vfp_min =3D params->vfp_lines.even + params->vfp_lines.odd; // 5 > >=A0=A0 vbp_min =3D params->vbp_lines.even + params->vbp_lines.odd; // 38 > >=A0=A0 vslen =3D params->vslen_lines.even + params->vslen_lines.odd; // 6 > > > >=A0=A0 porches =3D params->num_lines - vactive - vslen; // 0 > >=A0=A0 porches_rem =3D porches - vfp_min - vbp_min; // 0 > > > >=A0=A0 vfp =3D vfp_min + (porches_rem / 2); // 5 > >=A0=A0 vbp =3D porches - vfp; // 38 > > > > Which is still close enough for 576i, but for 480i would end up with: > > > >=A0=A0 porches =3D params->num_lines - vactive - vslen; // 139 > >=A0=A0 porches_rem =3D porches - vfp_min - vbp_min; // 96 > > > >=A0=A0 vfp =3D vfp_min + (porches_rem / 2); // 53 > >=A0=A0 vbp =3D porches - vfp; // 86 > > > > Right? >=20 > Yes. And if that's supposed to mean 480i in 50 Hz "PAL" mode, that's also > "close enough" to the values I suggested above. >=20 > If you substitute values for true 60 Hz "NTSC" 480i, you should also get = values > that are "close enough" to the official spec. >=20 > The only thing I'd conceptually change is that the 38 lines is not really > "vbp_min". It's more like "vbp_typ". As I mentioned above, we may want to= lower > this value if someone wants more active lines than the official 486/576. porches_rem is an int, so if vactive > (num_lines + vslen + vfp_min + vbp_min), porches_rem is going to be negative and we'll remove equally between vfp and vbp to match what's been asked So I believe this should work fine? Maxime --f6nvjv3uvyvilujx Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCYysoLwAKCRDj7w1vZxhR xURjAQCbncH6Fc/QtaLetEslcTLx/26P2Sm8OvJplugFXHTJ7QD/dTht2uJh+cg/ SgzXrpjHpRt/MIrMNo1Y+QG6L3LLpgY= =4e/k -----END PGP SIGNATURE----- --f6nvjv3uvyvilujx--