Received: by 2002:a05:7208:13ce:b0:7f:395a:35b6 with SMTP id r14csp111710rbe; Wed, 28 Feb 2024 14:02:55 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWYlJx5Al2yjzEkV3e601VImDp4/JAsdxCGTet1keqNZcXQbgt/rxxy3bZ7LC3ILdonERIV/rx/nkgWK3AQ4IZUpL974S3xnb0CMdnP+Q== X-Google-Smtp-Source: AGHT+IFDRyo4QXaF81+EJliAEeQ5eQQko2hhpHZNyavW3pawd2Dj8TT76QtXaz9MLibpy4lQJR36 X-Received: by 2002:aa7:d958:0:b0:564:7962:4545 with SMTP id l24-20020aa7d958000000b0056479624545mr131408eds.15.1709157775029; Wed, 28 Feb 2024 14:02:55 -0800 (PST) Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id o7-20020aa7c507000000b00564a54bba27si1950800edq.544.2024.02.28.14.02.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 14:02:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-85762-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=@amd.com header.s=selector1 header.b=gMuRm0mO; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-85762-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85762-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com 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 9D31D1F24DC7 for ; Wed, 28 Feb 2024 22:02:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8D3E91361AD; Wed, 28 Feb 2024 22:00:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="gMuRm0mO" Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2078.outbound.protection.outlook.com [40.107.237.78]) (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 03E511361A6 for ; Wed, 28 Feb 2024 22:00:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.78 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709157627; cv=fail; b=EsNql2T/NbRnRexApQCKqTnyT25c9/WyKR2aE+y1eNZtcMji1fAh1/XwpbM3Wj0H+VwnraumBhCi19e6KQi3iTZP/z0Z0fFnsCnAUabT1J0kW0dPfYtOwzko8AgmjmJDP8WeXp9w0rC8tLhG4E5aXj5xmxgd+BNwvxymQJ1bVrw= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709157627; c=relaxed/simple; bh=fMyWN65/QhBl/ZYO5jmiX8kdeRmnzmkizoGr5xqXen4=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=rTJEW0jiVbQ12Ac4cGsFypYoTonn+UAJfv7fQiXh2i/9ZOPgYx0smSlXH7KyGXcFcboeLDqOyPzVtjDBA76gYdbJLZ2asip1z+18fEXiAh2S9z7Qf3HWfr5Q/u+92PH9a0vXyxnKKUsh3BykDY+v+eDEDl+/Uecy1SgyqyVmtHY= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=gMuRm0mO; arc=fail smtp.client-ip=40.107.237.78 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cNWHE7QWIaSQoUsPJamUSHOZRwptzizgZ2WalkIf+BGo/oG9yiJpzjUtC/G285flHQMxHmXlMTwCshKs6tOI7Z9RCAb5ThVUDDOHwzezosiThkIsZWuigD+QViUoFrgz0bjErpLgkol2Vl0RsJTiF1uOUBOSgHibBCP4bM8EXSUP3JOPqtmO0DYHVn8kTWptSJGXEEma73c5slbpD7W6jKeOVCtcX+siPzycGKrbcah2frHVEeJrz6uYm+IR/RgJpg4VyB5IVawpmm+Xq+vPXSaE0TZqpZ3nBsFBcyhLPeX8lojXl84sKengdvl+M7CX+LOscnLMwVPhreZrHPzW2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1rSSgaTNh4QcCH36G6qgl0xsQVtHbeyyLcQkloogpaM=; b=NULuYrTgsdLVzwMK/F58THnhndK3VtsNzQoUcl3Wfgl1BJqvzQ40mgPdsObEYfltCW6GrfGxazgP14JL7nHEOXsfggnTQ6XQaGWPgq/qR/pKgGCrP2AlCZFg2tY6zFg12Cd7+o4tIq5SXXL0e82h1I8MZnOlJNtdzG7Gzua++GWoNNihGQeiW1o9HN31OlXBV2a5nfVWH/DhPBTG8WH9J7VTTzJKiS322D4oPoi7R7GvZhM65N6pyu9Fk1K6CGVovMU+19KPCpJHWKT6SVYTygVlLCG//MFIB+Sc5XLUPKMaQXkulztqmiZTJPQSoxfJY1hvwlDTLheatenw6JRmsQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1rSSgaTNh4QcCH36G6qgl0xsQVtHbeyyLcQkloogpaM=; b=gMuRm0mOiQ3E3q1fNFYw6uJ0UKYtOf0ycA8DoVzvWEnRPiQXr+5ETNf+vFm16debq8zajRRdXi7bN8Nzkta+HJ4gCjkcIsuXmwwNIoJppzhjQnYxK8Q1ap0f9cTFPtTa4nIvQIM9E9r6rAohXWrkhqGrQ83pj+myitpEsA0ExmQ= Received: from PH7PR12MB7163.namprd12.prod.outlook.com (2603:10b6:510:202::14) by LV2PR12MB5775.namprd12.prod.outlook.com (2603:10b6:408:179::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.41; Wed, 28 Feb 2024 22:00:19 +0000 Received: from PH7PR12MB7163.namprd12.prod.outlook.com ([fe80::5f0:63bb:49fb:e647]) by PH7PR12MB7163.namprd12.prod.outlook.com ([fe80::5f0:63bb:49fb:e647%4]) with mapi id 15.20.7316.034; Wed, 28 Feb 2024 22:00:19 +0000 From: "Klymenko, Anatoliy" To: Maxime Ripard CC: Laurent Pinchart , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , "Simek, Michal" , 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 Thread-Topic: [PATCH 4/4] drm/atomic-helper: Add select_output_bus_format callback Thread-Index: AQHaapGE8X8PDnmqPkCPFIu/krDfHg== Date: Wed, 28 Feb 2024 22:00:19 +0000 Message-ID: References: <20240226-dp-live-fmt-v1-0-b78c3f69c9d8@amd.com> <20240226-dp-live-fmt-v1-4-b78c3f69c9d8@amd.com> <20240228-nifty-flashy-shrew-905edc@houat> In-Reply-To: <20240228-nifty-flashy-shrew-905edc@houat> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PH7PR12MB7163:EE_|LV2PR12MB5775:EE_ x-ms-office365-filtering-correlation-id: 73cde6fc-896a-4d18-0362-08dc38a8a754 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: btKIHyBsMatI9ppKIiWl/S3OVN7jp4DIw4kEw0rs4i+ATH00xjQbwgefUQImODlUeHbh0vKX2HbFOxAfYn6rbHGw3K4mNOiitERy96vamaE+hupb4J5RTzAhq6eGECSOCQZmgQs2+nAJxKaVA+1jaCErGBn2UMTnpXNlUuf8UmDy/9trvxLMTxGOqQbbUO0mZbbzo8AzxLrL8TCDCvAlpprMyWGC+zd+voaN2ivXXRSZZ7IN8CXVRD+R4TtS12Zc9qV36f37G+Md2xTYTJ8QvSsX4uf4lpY7Nm86XeartOcEbUqfZRxwucUqu517/0PNAYAx07btEHMUf3/U62/BrrH4QICahU8yAqvsEJo6NxppFV3BOXqfYRHBPc+2x7NL1eJwSkoSQCAJCeztKy7+6nCrTY7gVHSnTp/q32aLoHnkDHSS9P8ZBorerNaSp+eJN4VtJWL+xmvicGa1QC3Ky858UeNKvpQFBAvxroQ8uA7RLE1lAi+XvaGplI42Tz+jWeJLifvUCtfYyA+RZ/bEYzoBqxQB4yOovRa0tLgvK1W5n60yviP/sztfl0bHleC037jqOGz+IKWL/IcZPRD/HpLrDsD6m5Yr3isQ5Ms3K2ZnHKDjOW8kdFEDv+mGmSY/Dc+eykFgkDrtXD+XPSjGCerLZfiKJCeUM8aDK4Xe19xv0I0MV0HgYodhwV1oUeZzA/yLQQmmUy2zQ0XwENxXOg== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH7PR12MB7163.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(38070700009);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?5xV5nMQ5xmdWKHE7lynoFA05qa9ms7CAL9Eski1TifZ6ytDiuTm083hdZj/x?= =?us-ascii?Q?PbMl2PE9wmFZJQhBXADmvgsITUSMN9RgFZZLloPbIUaYHSptgteFr+QY15y0?= =?us-ascii?Q?0QIs5ndBaKbkypEyn6PMlWUu+RZmWj+/IQvTmIj2V19MomWo4VKrkWAfV7tz?= =?us-ascii?Q?RVFp+HfvLZqzYwQqGdXrLvlThJK0SuIzO3q8l8MaqsnIBWCJ1LvbBY2ZwQSh?= =?us-ascii?Q?tX9JN1TuCUI5gE3X1y09sKMZ/rCH9t1AAmTeIIzk1YRnJy+e70fBeDZMc+kr?= =?us-ascii?Q?RKsJqLL3gprghTKIagZb0Zuj7q1D2MN8uqW6f9xcScVjmbxeYqWOKdgaG4wH?= =?us-ascii?Q?Q74pqJi2b1m0luIUGbh+dVWa8ZaRUad1PBgAkhe5mha/aOGyO2230IXinC1J?= =?us-ascii?Q?zA18ISqJUOEyTT1XduiuCsbyUyR5dQT34psjtmTCca9SD4HNVVrSGW1AFvdu?= =?us-ascii?Q?6ydttgDFW3N+BPIUTr4/n/9Dlspk+sMGWgdGdTaSgi/KvczBMVX4z7t759sP?= =?us-ascii?Q?EP0cFU9j0/AlBQZQioxZbmg4/yiqmYNms7tW0L7lF86PVpuTZoh+fHosqjp9?= =?us-ascii?Q?efaSUuFDrr3LY7G1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aIlvUBrp5VhuvZ9inkzOjVtSeqWj4y0I7PaXCsSy1bfhod6Kc4XfvZxEGmj4?= =?us-ascii?Q?eTLUZXK2Rklmf8Xv6Hg=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH7PR12MB7163.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 73cde6fc-896a-4d18-0362-08dc38a8a754 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Feb 2024 22:00:19.2674 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 0WvIKRpAbGd4wAYmfDDKKujoo9p6lFoTpr6A2Vnj3wwCdhGKtGmAKhQaS3uCmO92gHF97j4ZikXNDRZHXXI7Ow== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR12MB5775 Hi Maxime, Thanks for the review. > -----Original Message----- > From: Maxime Ripard > Sent: Wednesday, February 28, 2024 7:30 AM > To: Klymenko, Anatoliy > Cc: Laurent Pinchart ; Maarten Lankhor= st > ; Thomas Zimmermann > ; David Airlie ; Daniel Vetter > ; Simek, Michal ; Andrzej Hajda > ; Neil Armstrong ; Ro= bert > 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 >=20 > Hi, >=20 > 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. > > > > Incorporate select_output_bus_format callback into the format > > negotiation stage to fix the input bus format of the first DRM bridge i= n the > chain. > > > > 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(-) > > > > 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 > > > > @@ -879,7 +880,8 @@ static int select_bus_fmt_recursive(struct drm_brid= ge > *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; > > > > prev_bridge =3D drm_bridge_get_prev_bridge(cur_bridge); > > @@ -933,7 +935,20 @@ static int select_bus_fmt_recursive(struct drm_bri= dge > *first_bridge, > > return -ENOMEM; > > > > 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; >=20 > I don't think we should start poking at the CRTC internals, but we should= rather > provide a helper here. Makes sense, thank you. ACK. >=20 > > 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_modeset_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. >=20 > There's nothing restricting it to bridges here. Please rephrase this to r= emove the > bridge mention. The user is typically going to be the encoder, and bridge= s are just > an automagic implementation of an encoder. >=20 OK. I'll fix than in the next version. > And generally speaking, I'd really like to have an implementation availab= le before > merging this. > Well, 2 instances of this callback implementations exist as drafts, as this= is the new API. A little bit of a chicken and egg problem. I'll try to gro= om at least one of them into upstreamable shape and attach it to the patch = set. > Maxime -Anatoliy