Received: by 2002:ab2:2994:0:b0:1ef:ca3e:3cd5 with SMTP id n20csp863674lqb; Fri, 15 Mar 2024 08:24:52 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUOu898crGv8nEnO1Lq5uJAfYtLVnL1g2f3Dfq93MXBXfkL8E+5GaSAtVdaJ/RJKBZEyyp3IQ9WvklVtGcVrseEMjUlJtbk0k7kU5HV6g== X-Google-Smtp-Source: AGHT+IFFcP63S513QipzbbROnRtSpP2kOrlldbS3qONY0bie6fsAFKPnFUM8KUOdIx3AjvYFM24d X-Received: by 2002:a17:906:f118:b0:a46:5597:596a with SMTP id gv24-20020a170906f11800b00a465597596amr3491708ejb.45.1710516292105; Fri, 15 Mar 2024 08:24:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710516292; cv=pass; d=google.com; s=arc-20160816; b=eP2jMYLN/S81yv0V0tXaCQZyWrL48MXpLsRlXoiPGomASZhiSrwLu6sNe0VYlnXnIg w+hnukbP0gYRnqU0buNNKIdChrlT4zM2w3d3Zmpnd7VOMIWmxuFr/aqieh7Pou+DW6kg HUy3ctWIgAQg7mzkPzTPMuhgsjad7oqee2ud1/hTuDuE8PejghE5JRtlCsY35AtXDUhf 5LKtomOshR1WWsnaGIE6ghWGKi5F6iPB3J0C0RYU1JBrANXYOvNbPqmMuXaPNfPilCtI wggiGorn2JcuI+yA7uWmiKHeXT/atC6cJniAP4newKA8WGvC5mG4GLclETeyljlwW5yO 4Csg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=FbHqADYw1PS4xE2YE8SIubadI0iV4N+wVD+f2V9I93g=; fh=nrObhJP7eJWn67kW7033+4cNT8lRSl7oREVam8bxxGI=; b=h9NgbGTp5FFXEBRLMcqZpMAMcgSJlCLhp+H8AcfftoymuXyaKGqrk1753rKAAQ+baK IKhO2Yie/NqDF97IrBp6G/rr/F0iJfb77ftNxyrqODTnlNKvydZNhXpG24gsjkOn5WQD LRdAUZ/LsmeN0/zEItk9AjHURcfivQgJm0dUhGcZd3auCA3CYwJ+k+Js2fAk/lUt7Thu l46eAadCr4U4EKIPGUrGsGZaASwtHPykNnyo9j8vt/5BA8/rGp3IUOTpT0exSRuX32Hv Nm50PZ7gRdnGhnq8/htXGCegoB5jrsfFtF0Bfl6gFx0dHtXgg0Hy5szi/lWN5dLozxFJ OUJg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=q3FqpOfr; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-104572-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-104572-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id kh24-20020a170906f81800b00a4466fdeec6si1855635ejb.674.2024.03.15.08.24.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Mar 2024 08:24:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-104572-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=q3FqpOfr; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-104572-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-104572-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id A9F881F2381F for ; Fri, 15 Mar 2024 15:24:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E92183F9EA; Fri, 15 Mar 2024 15:24:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="q3FqpOfr" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0CB163E48E; Fri, 15 Mar 2024 15:24:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710516271; cv=none; b=Tp8o7i9dxfeZBVvICPNr5U7dHQ5DtJTzF734KrDw015fDaPMJyMt3rF5i25OEsMsUL1GU1JNdUJGizy49nh0UgnnrgFPQWLPv9U1th2kK7kdc0PHS+zNEkNamEvwRmHHxCSeWnstjBzAHJx1LqOHgTlKwjNKRp/z30OlEW8yzYs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710516271; c=relaxed/simple; bh=dv2BQE3C1SVPJZ9yimIjK4LwzWdStVZ/9oh5jMElhhY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=JwrmAkdx/XrZYLul6Vr8jPTQoKwsIFbGOnpU7+dve/MzNF3Sh3dp3i2+eU3YfAgtRJ7WPwqmc6jq7U2HLQh4dZd2fwNLVChsa201cnQ1cYUlKG1U3PzO7eJeuqGP1KDF0tDCty9VRplOfAaIBAmMngKbkoOtTp4VGCgriza0rSE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=q3FqpOfr; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D9BEC43399; Fri, 15 Mar 2024 15:24:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710516270; bh=dv2BQE3C1SVPJZ9yimIjK4LwzWdStVZ/9oh5jMElhhY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=q3FqpOfrAyIR0n1E/BYxHdrafNQUI/II/3xPBGFjRQNvkIA01sH3u4copbooOrd3l cRwBP0tW8u99Seoh6KsfPE1T1QtAsMbO4zDIIF7MqubfKvhbJT3QT7LuxU791IX8GM UYz2rm9RIu2cFyNcBJjktCKjMZDq9YLqSWcfrs9bEa/ncZjulHerbNMkbnI07kw/ai OoMWt4pwdQzPG/WHuiPEx+viosvck3Xd+K48mJL/SOPmw/pq1eHIa/T8ejz0Gm7LIY kHEsgUD9Xm4HNHRh58vrGDimxevSRqZlNwLT/ZnktUXTFGENoXw00lLYMqUqOUDI0f oAU6KTk/Sgo9A== Date: Fri, 15 Mar 2024 16:24:27 +0100 From: Maxime Ripard To: "Klymenko, Anatoliy" Cc: Laurent Pinchart , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , "Simek, Michal" , Andrzej Hajda , Neil Armstrong , Robert Foss , Jonas Karlman , Jernej Skrabec , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Mauro Carvalho Chehab , "dri-devel@lists.freedesktop.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-media@vger.kernel.org" Subject: Re: [PATCH v2 8/8] drm: xlnx: Intoduce TPG CRTC driver Message-ID: <20240315-quiet-pragmatic-capuchin-79c2ab@houat> References: <20240312-dp-live-fmt-v2-0-a9c35dc5c50d@amd.com> <20240312-dp-live-fmt-v2-8-a9c35dc5c50d@amd.com> <20240314-esoteric-delicate-sidewinder-5dc4db@houat> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="uhyiww26fdxh7rdb" Content-Disposition: inline In-Reply-To: --uhyiww26fdxh7rdb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Mar 14, 2024 at 07:43:30PM +0000, Klymenko, Anatoliy wrote: > > > +/* > > > +--------------------------------------------------------------------- > > > +-------- > > > + * DRM CRTC > > > + */ > > > + > > > +static enum drm_mode_status xlnx_tpg_crtc_mode_valid(struct drm_crtc > > *crtc, > > > + const struct > > drm_display_mode *mode) { > > > + return MODE_OK; > > > +} > > > + > > > +static int xlnx_tpg_crtc_check(struct drm_crtc *crtc, > > > + struct drm_atomic_state *state) { > > > + struct drm_crtc_state *crtc_state =3D > > drm_atomic_get_new_crtc_state(state, crtc); > > > + int ret; > > > + > > > + if (!crtc_state->enable) > > > + goto out; > > > + > > > + ret =3D drm_atomic_helper_check_crtc_primary_plane(crtc_state); > > > + if (ret) > > > + return ret; > > > + > > > +out: > > > + return drm_atomic_add_affected_planes(state, crtc); } > > > + > >=20 > > [...] > >=20 > > > + > > > +static u32 xlnx_tpg_crtc_select_output_bus_format(struct drm_crtc *c= rtc, > > > + struct drm_crtc_state > > *crtc_state, > > > + const u32 *in_bus_fmts, > > > + unsigned int > > num_in_bus_fmts) { > > > + struct xlnx_tpg *tpg =3D crtc_to_tpg(crtc); > > > + unsigned int i; > > > + > > > + for (i =3D 0; i < num_in_bus_fmts; ++i) > > > + if (in_bus_fmts[i] =3D=3D tpg->output_bus_format) > > > + return tpg->output_bus_format; > > > + > > > + return 0; > > > +} > > > + > > > +static const struct drm_crtc_helper_funcs xlnx_tpg_crtc_helper_funcs= =3D { > > > + .mode_valid =3D xlnx_tpg_crtc_mode_valid, > > > + .atomic_check =3D xlnx_tpg_crtc_check, > > > + .atomic_enable =3D xlnx_tpg_crtc_enable, > > > + .atomic_disable =3D xlnx_tpg_crtc_disable, > > > + .select_output_bus_format =3D xlnx_tpg_crtc_select_output_bus_forma= t, > > > +}; > >=20 > > From that code, it's not clear to me how the CRTC is going to be able t= o get what > > the format is. > >=20 >=20 > It's coming from DT "bus-format" property. The idea is that this > property will reflect the FPGA design variation synthesized. >=20 > > It looks like you hardcode it here, but what if there's several that > > would fit the bill? Is the CRTC expected to store it into its > > private structure? > >=20 >=20 > It's impractical from the resources utilization point of view to > support multiple runtime options for FPGA-based CRTCs output signal > format, so the bus-format will be runtime fixed but can vary between > differently synthesized instances. > > > If so, I would expect it to be in the crtc state, and atomic_enable to = just reuse > > whatever is in the state. > >=20 >=20 > This could be totally valid for different kinds of CRTCs, although for > this particular case, the bus-fomat choice is runtime immutable. Sure, but we're still discussing an API to accomodate your use-case here. Your usecase is one thing, but the API has to be cover all cases, and there's definitely some CRTCs out there that support multiple output formats that would benefit from that API. And it would mimic the drm_bridge API, which is a nice consistency bonus. Maxime --uhyiww26fdxh7rdb Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCZfRoKwAKCRDj7w1vZxhR xbZ6AQCqyIWNrOekCzZErEBBgva8wYYFUxOXwSWD2p63fto44AEArbdEKOyhIRfR TluOQSyvoL63/q0ohUCoINatpqawVQo= =Yted -----END PGP SIGNATURE----- --uhyiww26fdxh7rdb--