Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2619878rbb; Wed, 28 Feb 2024 07:29:45 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWkxumQIPD5BhSEw0/pPHXHymE8+V6rdCiUE3F0mYWYsM//0zzZfLsRZxbfDXKkjrlEaGPtVgo3iBGhApx2iZ6T7kHYR32C/hFaNLQg3w== X-Google-Smtp-Source: AGHT+IG3tyx2FL4EQtbYIuucizyD+bBxmWsLerrZvVbJJWmxLMMxhJETgdTkST75q6VSZJD93aB/ X-Received: by 2002:a17:906:c00d:b0:a3f:b007:cfcd with SMTP id e13-20020a170906c00d00b00a3fb007cfcdmr2477390ejz.13.1709134184887; Wed, 28 Feb 2024 07:29:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709134184; cv=pass; d=google.com; s=arc-20160816; b=LksZSBPcyTgNYmKkakqLWkpXtwnJUACkAXywRYsnm5sX9leHO9NkCCjIGkkRy8JtHI Ubf5wa9huGLy3sSicc4UGimg46Y59zPKwpJc6HY5Y3I0vnfMCaUkXtsv7HZ/op6aZFH1 Ou4CHiep88rzPKZ+WGMhp3jRyCssKLawAQ57JOcpjrt1e3cw1oY+KEX/SzgpxGH+zv3t sRahlnhmvZoPqI1JIrIu0In/nbCg9oNF7BX9JUjw+leGIaQCpcGQNqktJ+ur81INzpYH ywcya3/+eu983g9RxhIZZp8aAHPBfOYAk/tGty5GXHQJZboRcCiaqVaidoJuSZJujFip pRWg== 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=Wra0KGW21UWGER9nP1lDB66tRobpSpJcAQarnOCWvaY=; fh=yVBkQIVCFv+HnZ9cWPw3ekjLILjhBxjQzvQv1MF02CE=; b=URXUZKyV4SsiPmCmFAY4x9qP0JDnc5r5OI1Yn2Mi+GjiCJkZu7m/Z3ycUHGk0PmvPj EYY9II7Pv8magJofez3iFtSwdeMXYC/L90OSrgfdelEQiKrI+iKaR/RGpW3iKSQQ4e2K iVjAx/Cv7P5sUjcWTLxTGTJNOQzhNnBIjf0dhzij8eB5pvb/ubUQehCPi4u8AZu+ZTTi PxRANu99aoq79NptrbBkIvYCydxosA2ugN+eKa3uZWZ8DkYsTXQsGWygBnoGyB8iSUlO be5tgW3LSojJkRIuijtQslp+2GwTIREp1mwhaX5Cyf/GCc5U7R7wb+lbOmaNg0NUoL+m I6hg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=H3twjr27; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-85261-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85261-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. [147.75.80.249]) by mx.google.com with ESMTPS id x2-20020a1709065ac200b00a433046e10bsi1876236ejs.934.2024.02.28.07.29.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 07:29:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-85261-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=H3twjr27; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-85261-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85261-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 A4BCE1F28CF8 for ; Wed, 28 Feb 2024 15:29:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2AB2815B99D; Wed, 28 Feb 2024 15:29:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="H3twjr27" 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 4EEEF73515 for ; Wed, 28 Feb 2024 15:29:36 +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=1709134177; cv=none; b=RSDd3yGG4D0iUaLd3BsfqDxBvjy/MPGACx3fWkLuOcuzBRAVqXEf+foz0YrJnEmslG7pRsmIKAEEEudT1E0wA/It4IvyrLTKP4spLbwTBDcRmmhMCZK5uz4aLLJkb0s9vnF/udrStWVpl7s2RyDg0lUI6OJI4EnhgaoXFan8yBk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709134177; c=relaxed/simple; bh=lRf/rIbATsUTI1YkCvuC+3znuOvvZIuYq5dyiYZsoXA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ojcgJunHPgTX5rAbeRxpEo2OmC48cEeJUAiqWRKmvdqK1E0zZWE1gFQviNAXkOhyHSErJbQhWMrb/ODBYrfioGc9ZmfoY/QF1ZTMQ/Cmz39HegG+pGQLapop84NybHeynbsJDxMqoThXtbYNdOv3wc04MJP/ELLq8dTVkR3KheI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=H3twjr27; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5403CC433F1; Wed, 28 Feb 2024 15:29:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709134176; bh=lRf/rIbATsUTI1YkCvuC+3znuOvvZIuYq5dyiYZsoXA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=H3twjr27b1HacuKRDSNxpv4YwUtDnjvSa7PX91jk2W+KLQn/tKQeVrFP5cBBaFMKY yfqR4EQNDiRuQsYvGU5EAuabsTfXLPkmKGxgd2RgeU1Obd+WbHAuowDK8sGTrok57w oPBzz2RYsBcaPd8y8BjPwKKkrWUhttL4CuV99jxSUsHJLzOALFQZYjM4Pt9y7MKt15 7der0X817Nodjt8yQR9gYxYm/kbUIlm0HjwIhXVLcNrP/NFrzfGKHtFRlxSizYWGp5 RbSXTVrB77BXGBg3NfiFWf3nHoi4D37BJC1kh2TzDhJthU6Urv0W5yhbZkTCH1S73e Q9PP4zay7kgtA== Date: Wed, 28 Feb 2024 16:29:33 +0100 From: Maxime Ripard To: Anatoliy Klymenko Cc: Laurent Pinchart , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Michal Simek , Andrzej Hajda , Neil Armstrong , Robert Foss , Jonas Karlman , Jernej Skrabec , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/4] drm/atomic-helper: Add select_output_bus_format callback Message-ID: <20240228-nifty-flashy-shrew-905edc@houat> References: <20240226-dp-live-fmt-v1-0-b78c3f69c9d8@amd.com> <20240226-dp-live-fmt-v1-4-b78c3f69c9d8@amd.com> 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="cidk5nrah5kgputl" Content-Disposition: inline In-Reply-To: <20240226-dp-live-fmt-v1-4-b78c3f69c9d8@amd.com> --cidk5nrah5kgputl Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Mon, Feb 26, 2024 at 08:44:45PM -0800, Anatoliy Klymenko wrote: > Add select_output_bus_format to CRTC atomic helpers callbacks. This > callback Will allow CRTC to participate in media bus format negotiation > over connected DRM bridge chain and impose CRTC-specific restrictions. > A good example is CRTC implemented as FPGA soft IP. This kind of CRTC will > most certainly support a single output media bus format, as supporting > multiple runtime options consumes extra FPGA resources. A variety of > options for FPGA are usually achieved by synthesizing IP with different > parameters. >=20 > Incorporate select_output_bus_format callback into the format negotiation > stage to fix the input bus format of the first DRM bridge in the chain. >=20 > Signed-off-by: Anatoliy Klymenko > --- > drivers/gpu/drm/drm_bridge.c | 19 +++++++++++++++++-- > include/drm/drm_modeset_helper_vtables.h | 31 ++++++++++++++++++++++++++= +++++ > 2 files changed, 48 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c > index 521a71c61b16..453ae3d174b4 100644 > --- a/drivers/gpu/drm/drm_bridge.c > +++ b/drivers/gpu/drm/drm_bridge.c > @@ -32,6 +32,7 @@ > #include > #include > #include > +#include > #include > #include > =20 > @@ -879,7 +880,8 @@ static int select_bus_fmt_recursive(struct drm_bridge= *first_bridge, > unsigned int i, num_in_bus_fmts =3D 0; > struct drm_bridge_state *cur_state; > struct drm_bridge *prev_bridge; > - u32 *in_bus_fmts; > + struct drm_crtc *crtc =3D crtc_state->crtc; > + u32 *in_bus_fmts, in_fmt; > int ret; > =20 > prev_bridge =3D drm_bridge_get_prev_bridge(cur_bridge); > @@ -933,7 +935,20 @@ static int select_bus_fmt_recursive(struct drm_bridg= e *first_bridge, > return -ENOMEM; > =20 > if (first_bridge =3D=3D cur_bridge) { > - cur_state->input_bus_cfg.format =3D in_bus_fmts[0]; > + in_fmt =3D in_bus_fmts[0]; > + if (crtc->helper_private && > + crtc->helper_private->select_output_bus_format) { > + in_fmt =3D crtc->helper_private->select_output_bus_format( > + crtc, > + crtc->state, > + in_bus_fmts, > + num_in_bus_fmts); > + if (!in_fmt) { > + kfree(in_bus_fmts); > + return -ENOTSUPP; > + } > + } > + cur_state->input_bus_cfg.format =3D in_fmt; I don't think we should start poking at the CRTC internals, but we should rather provide a helper here. > cur_state->output_bus_cfg.format =3D out_bus_fmt; > kfree(in_bus_fmts); > return 0; > diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_m= odeset_helper_vtables.h > index 881b03e4dc28..7c21ae1fe3ad 100644 > --- a/include/drm/drm_modeset_helper_vtables.h > +++ b/include/drm/drm_modeset_helper_vtables.h > @@ -489,6 +489,37 @@ struct drm_crtc_helper_funcs { > bool in_vblank_irq, int *vpos, int *hpos, > ktime_t *stime, ktime_t *etime, > const struct drm_display_mode *mode); > + > + /** > + * @select_output_bus_format > + * > + * Called by the first connected DRM bridge to negotiate input media > + * bus format. CRTC is expected to pick preferable media formats from > + * the list supported by the DRM bridge chain. There's nothing restricting it to bridges here. Please rephrase this to remove the bridge mention. The user is typically going to be the encoder, and bridges are just an automagic implementation of an encoder. And generally speaking, I'd really like to have an implementation available before merging this. Maxime --cidk5nrah5kgputl Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCZd9RXQAKCRDj7w1vZxhR xabiAPwMUBllLVjJ2R8GSARBjyjpbidi/etMNmmjB31GnUsLCQD9GXcs+YhUV+XC WZuXsHmZaEgjQI0Yn+ELSS5uW/RRqgg= =PnFN -----END PGP SIGNATURE----- --cidk5nrah5kgputl--