Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp458131rwb; Thu, 18 Aug 2022 06:52:40 -0700 (PDT) X-Google-Smtp-Source: AA6agR6JZu5iaFydp9/JIxlHHJw3bzwBAsUkvO+dax0H3TauA1ZoxJ6NsAGtmHuJUOBXX5U/BrnQ X-Received: by 2002:a17:90a:ab14:b0:1fa:b97f:c28b with SMTP id m20-20020a17090aab1400b001fab97fc28bmr3256035pjq.71.1660830760081; Thu, 18 Aug 2022 06:52:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660830760; cv=none; d=google.com; s=arc-20160816; b=Ao4EVpIr+Gbrg6q8kuD45aFtvCc2I7fM6LtHecWpR4GSY15vTHCjIoQXPTGGR09xKp TWg6iWGq848qvAssSbuoGvyx8d5mCnzWZYLXD4waaArRSNEIKx58eJma19F0iAPsK0cC WkEWiCFUlMWHLURIkgO9jgUa+Zld4H2UnyCX7329axXwYAVULjkM5nCxW1t9Raomwhh7 fq4X5BBhKUVxxfT8OBf619LEdyLyBh9LflSy/IJr855dhnsbCgR6Li+pDdsfqwP8Ku2C 8BMcwQVRgFqaQrnwS0BR9bYN+1ofE8K5qwvOLvsCyk0RYwxqxXWCFs14Xp/3Hy7x/uXa u65Q== 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=HQC2uQh9jTR5zuhwO9XMFeqtwLctTZY2rM1W/lF/1i0=; b=efk588KnU3Iho+z0y6vUhr70gXN5J+6zZ4a3Js/+HJlBp4+YDrCkwroyEOZF68RbtC v2+/QtuKqdrjMH/caa1PY4ho2bFR/v0IGhC+csI1kuO3ehVmR6hyQuiUjzr+MSX2oqE4 mGtB2b44vk7cnWUrAP9R6Uvq8cUP129lHpGO9MBws+edSKdhl+ETU0dWxBFDjJeFzYwe mh5nuq8EiTBUVAmDRYZA5cBORmxtC5J0PqUcgDWqmvefLbONa2s1ouanQYZHkVU/raXy YNcRLIvZTVMoMi1AOwfaHGiBtm/DVTo77bns1W0FdgHRmUTYq/+7lXD850ITvu9aaGVK n7mQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm3 header.b=ltryRsjY; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=CQPiA58v; 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 t12-20020a170902bc4c00b0016ef8a85941si1213086plz.496.2022.08.18.06.52.28; Thu, 18 Aug 2022 06:52:40 -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=fm3 header.b=ltryRsjY; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=CQPiA58v; 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 S245279AbiHRNnY (ORCPT + 99 others); Thu, 18 Aug 2022 09:43:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244804AbiHRNnC (ORCPT ); Thu, 18 Aug 2022 09:43:02 -0400 Received: from wnew3-smtp.messagingengine.com (wnew3-smtp.messagingengine.com [64.147.123.17]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEA7BB5A64 for ; Thu, 18 Aug 2022 06:42:09 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.west.internal (Postfix) with ESMTP id 2FD8A2B05FEE; Thu, 18 Aug 2022 09:42:05 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 18 Aug 2022 09:42:07 -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=1660830124; x=1660837324; bh=HQC2uQh9jT R5zuhwO9XMFeqtwLctTZY2rM1W/lF/1i0=; b=ltryRsjYqi1O97i1fEor/8CUH0 eV9s5UGSADqzroBSY3eVnDaNvBwGKasz2b6MSimH5N8JxjAHhclmoLCVeG2qq0wp HLHzV9DhvCJ3jRXKcz7GHj8jeKKYEV6oNRFk8Cy90HbGMlwn55on0oDpCq2I7gSq H5ZCs5qUCFGQWPfB2FqkmYBH14oorz13RRNzkzanntYz4hgr7Cn6EJlU6h3UofJp Bzca/XJh+tTvIXS3S3kJS2pEKzzr8B6O8DU617LOsJHMVAKK1gyxHUsuiijkPOnt TbNraVdN+DcqZmbKHyiv9XvUngyfSM5UdQ1LMdIC1N8BwekRI/zOEzazf5Tw== 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=1660830124; x=1660837324; bh=HQC2uQh9jTR5zuhwO9XMFeqtwLct TZY2rM1W/lF/1i0=; b=CQPiA58vVLxmJMqggX/oIptmnHPvW6R1i8JljDcmqS+a j/YU5Gm8+tGP++JlUpAb4CoSmBlBn8iFVO4FRt1G/7hHFapMqA4gPQgIvy7iL5h6 h/DKzE36elER5UwM6HrASreqJ8DP/2WplprYmAIg9Mtu5NPrtJ/qnvigT3Au5vBc s2iqHi9JVXZy2dCgKq6obmD84xwwT0nESJyDGuzcgyleFf0q9Bz/p+GAKUoatobb UEU7qhhxr5tFlcIFLerlP2ywHlX2c/bkhCL7lFyFjj9kyq74Ncy/q9zisxk6q/WJ G98p0o/JRuuPXUZywqFAjoHexcDQw/yWPs+bB5NfbA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdehledggedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesghdtreertddtvdenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeevkefhveeffeeiuedtiedttdfhjeeiteefffegieeijeeigfelhfeltdei leejfeenucffohhmrghinhephhhinhhnvghrrdhinhhfohdpfihikhhiphgvughirgdroh hrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehm rgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 18 Aug 2022 09:42:03 -0400 (EDT) Date: Thu, 18 Aug 2022 15:42:00 +0200 From: Maxime Ripard To: Geert Uytterhoeven Cc: Jernej Skrabec , Martin Blumenstingl , Chen-Yu Tsai , Philipp Zabel , Jerome Brunet , Samuel Holland , Thomas Zimmermann , Daniel Vetter , Emma Anholt , David Airlie , Maarten Lankhorst , Noralf =?utf-8?Q?Tr=C3=B8nnes?= , Kevin Hilman , Neil Armstrong , linux-sunxi@lists.linux.dev, Linux Kernel Mailing List , Phil Elwell , Mateusz Kwiatkowski , Linux ARM , Dave Stevenson , "open list:ARM/Amlogic Meson..." , DRI Development , Dom Cobley Subject: Re: [PATCH v1 04/35] drm/modes: Introduce 480i and 576i modes Message-ID: <20220818134200.cr22bftmjn226ehn@houat> References: <20220728-rpi-analog-tv-properties-v1-4-3d53ae722097@cerno.tech> <20220816132636.3tmwqmrox64pu3lt@houat> <20220817075351.4xpsqdngjgtiqvob@houat> <20220817131454.qcuywcuc4ts4hswm@houat> <20220818123934.eim2bfrgbxsmviqx@houat> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="bjiayi7n6oays3ln" Content-Disposition: inline In-Reply-To: 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,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 --bjiayi7n6oays3ln Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Aug 18, 2022 at 02:57:55PM +0200, Geert Uytterhoeven wrote: > Hi Maxime, >=20 > On Thu, Aug 18, 2022 at 2:39 PM Maxime Ripard wrote: > > On Wed, Aug 17, 2022 at 04:01:48PM +0200, Geert Uytterhoeven wrote: > > > > I've looked around and it looks like the entire blanking area is > > > > supposed to be 40 pixels in interlaced, but I couldn't find anywher= e how > > > > > > 625 lines - 575[*] visible lines =3D 50 lines. > > > > > > [*] BT.656 uses 576 visible lines as that's a multiple of 2, for spli= tting > > > a frame in two fields of equal size. > > > > > > "visible" is relative, as it includes the overscan region. > > > Some PAL monitors used with computers had knobs to control width/heig= ht > > > and position of the screen, so you could make use of most or all of > > > the overscan region > > > > It brings back some memories :) > > > > > but on a real TV you're limited to ca. 640x512 (on PAL) which is what > > > an Amiga used by default (with a 14 MHz pixclock). > > > > > > it's supposed to be split between the upper and lower margins and t= he > > > > sync period. > > > > > > "Field Synchronization of PAL System" on > > > http://martin.hinner.info/vga/pal.html shows the split. > > > > Thanks, that's excellent as well. > > > > I'm mostly done with a function that creates a PAL mode, but I still > > have one question. > > > > If I understand well, the blanking period is made up (interlace) of 16 > > pulses for the first field, 14 for the second, each pulse taking half a > > line. That amount to 30 pulses, so 15 lines. > > > > I first assumed that the pre-equalizing pulses would be the back porch, > > the long sync pulses the vsync, and the post-equalizing pulses the front > > porch. But... we're still missing 35 lines to amount to 625 lines, that > > seems to be counted in the field itself (305 lines =3D=3D (575 + 35) / = 2) > > > > So I guess my assumption was wrong to begin with. >=20 > The back porch is the number of lines between the last "visible" line > and the start of the synchronization pulse, i.e. "l" in the "Field > Synchronization of PAL System" drawing. > Virtual sync length is "m". > The front porch is the number of lines between the end of > the synchronization pulse, and the first "visible" line, i.e. > "j - l - m" (I think you used "n", thus missing lines 6-23 and 319-335). Ah, yes, that makes sense > > You seem to have used a fixed vsync in amifb to 4 lines, and I don't >=20 > Actually "m" is 2.5 lines in the first field, and 3 lines in the second f= ield, > so "4" is not that much off of 2.5 + 3. Is it? If I'm reading that drawing well, l before the first field starts on the second half of line 623 and stops at the end of line 625, so 2.5 line, and on the second field starts at the beginning of line 311, and stops half-way through 313 so 2.5 line again. Then, for the first field, m starts at the beginning of line 1, stops half-way through line 3, so 2.5 line indeed, and then on the second field starts on the second half of 313 and stops at the end of line 315. So 2.5 again? Thus, both should be 5? > > understand how you come up with the upper and lower margins (or rather, > > how they are linked to what's described in that page) >=20 > These margins probably came from the Amiga hardware reference manual, > for the default 640x512 (PAL) and 640x400 (NTSC) modes. Ok. I started adding more sanity checks to my code, and I just realised I don't seem to be able to reach 720 pixels over a single line though. If I understood it properly, and according to [1] the active part of a line is supposed to be 51.95us, and the blanking period taking 12.05us. [2] in the timing section has pretty much the same numbers, so it looks sane. At 13.5Mhz, a pixel is going to take roughly 74ns, and 51950 / 74 =3D 702 pixels It seems we can go push it to 52350 ns, but that still gives us only 706 pixels. Similarly, if I just choose to ignore that limit and just take the active time I need, 720 * 74 =3D 53280ns That leaves us 10720ns for the blanking period, and that's not enough to fit even the minimum of the front porch, hsync and back porch (1.55 + 4.5 + 5.5 =3D 11.55us). Are those constraints merely recommendations, or am I missing something? Thanks! Maxime 1: https://en.wikipedia.org/wiki/PAL#PAL_signal_details 2: http://martin.hinner.info/vga/pal.html --bjiayi7n6oays3ln Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCYv5BqAAKCRDj7w1vZxhR xWtBAQDibwVaic8Y/y58QuWnOuhXnUvfjLJQpEPWFoP8AcS2PAEApAMrj2LZQrsW 1JWlpoRTdj2V5czk8fjcIqqDqWHqrQE= =Vc6t -----END PGP SIGNATURE----- --bjiayi7n6oays3ln--