Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp2362550rdf; Mon, 6 Nov 2023 11:48:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IFHUBlBoiickkRpW6bX2ZUrUEwQfA0HUKLr8j0FL+9BLRoxeTCR8oxkqwfH0jSbzvXqMx+G X-Received: by 2002:a17:903:32c2:b0:1cc:4985:fbf8 with SMTP id i2-20020a17090332c200b001cc4985fbf8mr23693450plr.59.1699300112238; Mon, 06 Nov 2023 11:48:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699300112; cv=none; d=google.com; s=arc-20160816; b=ifSwTb1BADGu7edS9jZPZO8AkcCmYGJc59ZTnbrUnfj1yw9XS7GN6ohGCsjWhIVNsE yTpdzLc6d36qB954yYyTI25O7P+83DVkyt/nV9mCekCGWVfafwM8W7R/32IcFCWmX37R 75q7kgGHM/GSjixVx0YY+1iMuf6jiVtZF0Fua6Z9mA8ztEzoclCVEORsU4oYH/exMPVU TTnVR/suMGaZ//67qlF8HTairzCheJ0vlEmSDIZ7VwEN5+ggUx6RWwcDiHHUPL1oQ3Ya RGlGsaU5dHt0ogE6NDQzul2JTEmGMy3njIQOx3+xm1q7iOAScROX3avA4o6TVGQox29c EIZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=+HEBZEmwqWXwwim2AP8dyF8xCUmJaEi9Wbfg++614Iw=; fh=sP2qBCkuVPqBnIzh14jBhxHPItMbGRjig869WvgeVZk=; b=RzPjlz5v18ypx/onsyvbyxzEFyHIMrssN7Zo+7vGFUvsYHW5AjQhu2i2Vcz+MoNbJw 1DfVVNznbbNDarhQVR8DryiNygP5q9weQVBfYXDh6PjMkVo7dSOA3CS3SrVEozQdNT0v xRAB+JFynQzBhHjmUYiSa3TmihlSp+nxKaPUjoL2wnOeehuUVcsExEJsAFMeZTYjTBRL sVRKdS53LrexRKdSjjieWrGwKvOMYrMCiNjK+Y6pdtb0gHrHI0FVMVvq6ZHvPAWq9yLl 19AbeCoD6sN1XRwo7yblyCwcNAqpJQvx6UGmMX4SDKwTGn9+B4JAdHyl7ZJMxfj7+t7Z Tayg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=kLAM0gbX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id j20-20020a170902f25400b001c610ae885bsi8390880plc.59.2023.11.06.11.48.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 11:48:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=kLAM0gbX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 213E580C3A8C; Mon, 6 Nov 2023 11:48:29 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232618AbjKFTsN (ORCPT + 99 others); Mon, 6 Nov 2023 14:48:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231555AbjKFTsM (ORCPT ); Mon, 6 Nov 2023 14:48:12 -0500 Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9687D95 for ; Mon, 6 Nov 2023 11:48:09 -0800 (PST) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 3A6JlM5R060343; Mon, 6 Nov 2023 13:47:22 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1699300042; bh=+HEBZEmwqWXwwim2AP8dyF8xCUmJaEi9Wbfg++614Iw=; h=Date:Subject:To:CC:References:From:In-Reply-To; b=kLAM0gbX53yzYuh0ezW1Amru9Y9A46Xg44VL7oMNQPgEOlKtPbFQg2bSsvXDAkbFL qK0z0iT9hTjzGoH2CCb96W2xMbNO3Gen98KjFRGqbYlN7E+4FCcur2/CIC9IZsbKXl 6q0H+T08yDX3WwBJcc3izZEwb8pdC3cMlai45KYA= Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 3A6JlMKL027642 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 6 Nov 2023 13:47:22 -0600 Received: from DLEE101.ent.ti.com (157.170.170.31) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 6 Nov 2023 13:47:22 -0600 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Mon, 6 Nov 2023 13:47:22 -0600 Received: from [10.249.132.69] (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 3A6Jl4Gg098807; Mon, 6 Nov 2023 13:47:05 -0600 Message-ID: <7ddf0edb-2925-4b7c-ad07-27c030dd0232@ti.com> Date: Tue, 7 Nov 2023 01:17:03 +0530 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] drm/bridge: tc358767: Support input format negotiation hook Content-Language: en-US To: Sam Ravnborg CC: Tomi Valkeinen , Jyri Sarha , David Airlie , Daniel Vetter , Laurent Pinchart , Andrzej Hajda , Neil Armstrong , Robert Foss , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Boris Brezillon , Maxime Ripard , Thomas Zimmermann , Francesco Dolcini , Jan Kiszka , DRI Development List , Linux Kernel List , Nishanth Menon , Vignesh Raghavendra , Devarsh Thakkar , Jayesh Choudhary References: <20231030192846.27934-1-a-bhatia1@ti.com> <20231106123800.GC47195@ravnborg.org> From: Aradhya Bhatia In-Reply-To: <20231106123800.GC47195@ravnborg.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Mon, 06 Nov 2023 11:48:29 -0800 (PST) Hi Sam, Thank you for the suggestion! On 06-Nov-23 18:08, Sam Ravnborg wrote: > Hi Aradhya, > > On Tue, Oct 31, 2023 at 12:58:46AM +0530, Aradhya Bhatia wrote: >> With new connector model, tc358767 will not create the connector, when >> DRM_BRIDGE_ATTACH_NO_CONNECTOR is set and display-controller driver will >> rely on format negotiation to setup the encoder format. >> >> Add the missing input-format negotiation hook in the >> drm_bridge_funcs to complete DRM_BRIDGE_ATTACH_NO_CONNECTOR support. >> >> Input format is selected to MEDIA_BUS_FMT_RGB888_1X24 as default, as is >> the case with older model. >> >> Reported-by: Jan Kiszka >> Signed-off-by: Aradhya Bhatia >> --- >> >> Notes: >> >> * Since I do not have hardware with me, this was just build tested. I would >> appreciate it if someone could test and review it, especically somebody, who >> uses the bridge for DPI/DSI to eDP format conversion. >> >> * The Toshiba TC358767 bridge is not enabled in arm64 defconfig by default, >> when it should be. Hence, I sent a quick patch[0] earlier. >> >> [0]: https://lore.kernel.org/all/20231030152834.18450-1-a-bhatia1@ti.com/ >> >> drivers/gpu/drm/bridge/tc358767.c | 25 +++++++++++++++++++++++++ >> 1 file changed, 25 insertions(+) >> >> diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c >> index ef2e373606ba..0affcefdeb1c 100644 >> --- a/drivers/gpu/drm/bridge/tc358767.c >> +++ b/drivers/gpu/drm/bridge/tc358767.c >> @@ -1751,6 +1751,30 @@ tc_dpi_atomic_get_input_bus_fmts(struct drm_bridge *bridge, >> return input_fmts; >> } >> >> +static u32 * >> +tc_edp_atomic_get_input_bus_fmts(struct drm_bridge *bridge, >> + struct drm_bridge_state *bridge_state, >> + struct drm_crtc_state *crtc_state, >> + struct drm_connector_state *conn_state, >> + u32 output_fmt, >> + unsigned int *num_input_fmts) >> +{ >> + u32 *input_fmts; >> + >> + *num_input_fmts = 0; >> + >> + input_fmts = kcalloc(MAX_INPUT_SEL_FORMATS, sizeof(*input_fmts), >> + GFP_KERNEL); >> + if (!input_fmts) >> + return NULL; >> + >> + /* This is the DSI/DPI-end bus format */ >> + input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24; >> + *num_input_fmts = 1; >> + >> + return input_fmts; >> +} > > You could benefit from using the helper: > drm_atomic_helper_bridge_propagate_bus_fmt() You are right! Upon taking a second look, I realize that the bridge chain works with MEDIA_BUS_FMT_FIXED bus format, when tc358767 is being used in DPI/DSI to eDP mode (because the panel-bridge does not have a get_output_bus_fmt hook, and uses the same helper for its get_input_bus_fmt hook). My patch creates a deviation from that, by forcing MEDIA_BUS_FMT_RGB888_1X24 even when eDP is involved. Using the helper here, will certainly address this deviation. However, for the DPI/DSI to DP mode, MEDIA_BUS_FMT_RGB888_1X24 bus format is required, and *just* using the helper as its get_input_bus_fmt hook, might not be enough. Since tc358767 is the last bridge in DPI/DSI to DP mode, the output_fmt parameter get defaulted to MEDIA_BUS_FMT_FIXED too, as there is no get_output_bus_fmt hook present in the driver. If we simply us the helper here, the input_fmt will also get set to MEDIA_BUS_FMT_FIXED. This too is an unwanted deviation. It seems like the right way to address both the cases, would be by adding the get_output_bus_fmt hook that sets output_fmt to MEDIA_BUS_FMT_RGB888_1X24, as well as using the helper as the get_input_bus_fmt hook. If this seems good to you too, I will send a new version of Tomi's series[0] which incorporates this patch. Regards Aradhya [0]: https://lore.kernel.org/all/20231031-tc358767-v1-0-392081ad9f4b@ideasonboard.com/