Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3099643rwe; Mon, 29 Aug 2022 05:58:32 -0700 (PDT) X-Google-Smtp-Source: AA6agR4QKL14bwyWea59s00vUQNZ547BEmnL4I0SWKLil3xrC2ZhXDaTeeQH9yQrNKKG5lrw86EZ X-Received: by 2002:a05:6402:ea1:b0:443:d90a:5d31 with SMTP id h33-20020a0564020ea100b00443d90a5d31mr16716075eda.121.1661777911759; Mon, 29 Aug 2022 05:58:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661777911; cv=none; d=google.com; s=arc-20160816; b=MZ2biC8cFsn3MFCf968bmNnRqstCnrh3mMetuFPakFMi0Rkoo1V958cVSNKqbKN5VI sfOypLiNkY7bPQ5GH0r+taA8mEZc8aAgttiDCXBA5DGg3WY5xLxZweo+Pssu1Ef86zI7 nlynbqdhrJDSPK2fZB+FgAlNIectKfBfXLw43sf8OS68yFJr3ddVQqIEtcNjIvN/0UBb t7YOqM2j6vLSE3xXmtQtugICFij9ySv0klVKSuPuuH0YUqGWnWi1muiLeJsuuTbw5jjq fI8HSWYcK9sb33qywdDGLqMFDL9mlW3DBfdTvXFPsGO/UFwFZax8OdRXiOY6l9sMqM6a hrkg== 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=mTveQVWkV1vZ4UHqLteArY1kTT3T3MkF8rU++sYP7DQ=; b=Fhm20c5Omd8T/mzyrFmn5AZwWThalUoaF4eGBpWvBMrZjUYhuj7zvDrggfl58ZRV8W K77629rDCXzo8Vcl6uraisO82NPFJzg9jKCPx9ZfagP2yFddheir7z7IIjeOdLoo4QeI y/SJy2Z9cV49dSbCMOtvQ6/uLcPjEpDsEYDgmpudIQDcEVCqq4QV+SX8Pk+78Z1akBbx KFw1df/eM4beLVDuab1M4IqV5AUj0pyyu2CImpjxBK6EW74TXINIIOwBQJPoT/T3Ibvr QbZ5kjKaTKc49OE4znF7LrumGPZblm0/3dGcoCkKuTR8IrxY3lsrzCJXkNdDjWc9NYWn q9vQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm3 header.b=deQ85rmX; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=bWRLiPP6; 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 k28-20020a508adc000000b004479e9c138dsi6720947edk.447.2022.08.29.05.58.06; Mon, 29 Aug 2022 05:58:31 -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=deQ85rmX; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=bWRLiPP6; 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 S230214AbiH2Mbp (ORCPT + 99 others); Mon, 29 Aug 2022 08:31:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231209AbiH2Ma5 (ORCPT ); Mon, 29 Aug 2022 08:30:57 -0400 Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 722254B495 for ; Mon, 29 Aug 2022 05:15:03 -0700 (PDT) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.west.internal (Postfix) with ESMTP id A3DD12B05FEA; Mon, 29 Aug 2022 08:13:59 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 29 Aug 2022 08:14:01 -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=1661775239; x=1661782439; bh=mTveQVWkV1 vZ4UHqLteArY1kTT3T3MkF8rU++sYP7DQ=; b=deQ85rmXbmk9EU5yPkeT4FeMzw ajssLQD6g5oBcELNrx4UU+HbXmlm0HidRFe7oyKb3gVjx4SF4t96+MIvCiauIQZ6 VkkFblw4iMQtqKR/igP21fIjxUxTpIQfnZnlPmsa4tgUOnPjVK8+09gXQx+7MQEt zSQiQ5nD50lpJNZh8MaEeJd35xziKHuU7RL5Vvt7nyWXtZNUFdUx2rHgY2DyKmIE Y+WOVKYpJnJnkQDv1RvApX9WS4BCZm3hnvpngtlRdjEQ9jtGbbJFNAqGfmCBaoZ2 z0N8Wb1KccCN6URDL7oQ4kpCizVLnIffHfmYflWHSPkM9NOM4d5uJz+5Hfeg== 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=1661775239; x=1661782439; bh=mTveQVWkV1vZ4UHqLteArY1kTT3T 3MkF8rU++sYP7DQ=; b=bWRLiPP6oKwtq6YNktjqK55u0c0PEav/PI4LGA7vm0G8 07eaFtMArYcfxlmNU+esxlAqtTOcqxEJI0B9bx8pqxdFLiRfSgxQX+Yocd9WBf7r Dlqds0ZumsVLHaEYV2WspNGz7rFuvTHIhCSmH36loAiUCRMCRiL0ZDdNYI7CPnCI WszS8SwUfmie0luDpSOU2HB4hpe6dvX9VlxVFvSmjzFuUedE8UdXp1r5anCg19xY bYr+KTt8uMK5ml/ysZOohGMU+xc8NUkvF7qm3v0qHnXye+0teFqx71Bfi9X0Cz2K jNTHsNaK//4NL7H6A2HqzDay85EaIA12z85Wsdnucg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgheduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesghdtreertddtudenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeejveefheefkeeiffegveelveetgffffeektdefuefhtedtgeejhefggedu ffffudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 08:13:56 -0400 (EDT) Date: Mon, 29 Aug 2022 14:13:53 +0200 From: Maxime Ripard To: Noralf =?utf-8?Q?Tr=C3=B8nnes?= Cc: Jernej Skrabec , Martin Blumenstingl , Chen-Yu Tsai , Philipp Zabel , Jerome Brunet , Samuel Holland , Thomas Zimmermann , Daniel Vetter , Emma Anholt , David Airlie , Maarten Lankhorst , Kevin Hilman , Neil Armstrong , linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Phil Elwell , Mateusz Kwiatkowski , linux-arm-kernel@lists.infradead.org, Geert Uytterhoeven , Dave Stevenson , linux-amlogic@lists.infradead.org, dri-devel@lists.freedesktop.org, Dom Cobley Subject: Re: [PATCH v1 23/35] drm/vc4: vec: Convert to the new TV mode property Message-ID: <20220829121353.kbgjmkmmcdtm5ujs@houat> References: <20220728-rpi-analog-tv-properties-v1-0-3d53ae722097@cerno.tech> <20220728-rpi-analog-tv-properties-v1-23-3d53ae722097@cerno.tech> <0255f7c6-0484-6456-350d-cf24f3fee5d6@tronnes.org> <20220824152619.5def5b2puj5b2a3o@houat> <7bdcc3c4-e04c-c2f3-5691-bcbdb158276f@tronnes.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="uu4iphtbpnfop3qu" Content-Disposition: inline In-Reply-To: <7bdcc3c4-e04c-c2f3-5691-bcbdb158276f@tronnes.org> 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 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 --uu4iphtbpnfop3qu Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Noralf, On Thu, Aug 25, 2022 at 03:14:01PM +0200, Noralf Tr=F8nnes wrote: > Den 24.08.2022 17.26, skrev Maxime Ripard: > > On Sat, Aug 20, 2022 at 07:22:48PM +0200, Noralf Tr=F8nnes wrote: > >> Den 29.07.2022 18.35, skrev Maxime Ripard: > >>> Now that the core can deal fine with analog TV modes, let's convert t= he vc4 > >>> VEC driver to leverage those new features. > >>> > >>> We've added some backward compatibility to support the old TV mode pr= operty > >>> and translate it into the new TV norm property. > >>> > >>> Signed-off-by: Maxime Ripard > >>> > >>> diff --git a/drivers/gpu/drm/vc4/vc4_vec.c b/drivers/gpu/drm/vc4/vc4_= vec.c > >> > >>> static int vc4_vec_connector_get_modes(struct drm_connector *connect= or) > >>> { > >>> - struct drm_connector_state *state =3D connector->state; > >>> struct drm_display_mode *mode; > >>> =20 > >>> - mode =3D drm_mode_duplicate(connector->dev, > >>> - vc4_vec_tv_modes[state->tv.mode].mode); > >>> + mode =3D drm_mode_duplicate(connector->dev, &drm_mode_480i); > >>> + if (!mode) { > >>> + DRM_ERROR("Failed to create a new display mode\n"); > >>> + return -ENOMEM; > >>> + } > >>> + > >>> + drm_mode_probed_add(connector, mode); > >>> + > >>> + mode =3D drm_mode_duplicate(connector->dev, &drm_mode_576i); > >> > >> Maybe the mode that matches tv.norm should be marked as preferred so > >> userspace knows which one to pick? > >=20 > > I'm not sure how realistic that would be. Doing this based on the driver > > / cmdline preference is going to be fairly easy, but then it's a > > property, it's going to be updated, and we probably don't want to mess > > around the mode flags based on new property values? > >=20 >=20 > Strictly speaking we need to fire an event to userspace if the mode > changes, and this is probably not straightforward to do underneath > modeset locks, would probably need a worker. I'm not sure this would work in all cases. Kodi for example doesn't handle hotplug events at all, so we might end up in situations where the state is not consistent anymore. Even if we were to only expose one mode to the userspace, depending on the current TV mode, userspace could still end up trying to push a mode into KMS that isn't the one we expose anymore, so I'm not sure we can solve this entirely. > Clever userspace like GNOME will try to use the active mode, so it will > handle this that way. If someone has set up the pipeline first that is. > drm_client/fbdev and plymouth can do that because they honour userdef mod= es. >=20 > Other userspace that don't know the userdef flag will fallback to the > first mode which is NTSC which is also the default tvmode, so maybe this > is good enough. PAL users will have to specify the mode, or teach their > program about the userdef flag. >=20 > But ofc relying on the userdef flag depends on the fact that there's a > mode on the kernel command line, but maybe there's no way to avoid that > since much/most? userspace treat "unknown" connector status as > disconnected so many will have to force the connector to "connected" > anyway. At least I don't know any way to permanetly force the connector > status other than using video=3D. You can do it through sysfs as well, in .../status Maxime --uu4iphtbpnfop3qu Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCYwytgQAKCRDj7w1vZxhR xdrUAP4k5/bAViOVsfkyqYMzYbFSqC3YumRaateY7yAcEsSePgEA8/P6xzOj3aWN v+oUtOVIlchXHuCettlv2W7y1xCzCgs= =mGM/ -----END PGP SIGNATURE----- --uu4iphtbpnfop3qu--