Message ID | 20230509093036.3303-4-a-bhatia1@ti.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2748700vqo; Tue, 9 May 2023 02:49:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ42MgQihx9EOYxI6KBrw4uAmbjrP5fcNrDI9fQT56ROXqktVIroh7Oi54Q9drCGN2LxVfVR X-Received: by 2002:a17:902:8481:b0:1a9:826c:8f44 with SMTP id c1-20020a170902848100b001a9826c8f44mr11999029plo.32.1683625784032; Tue, 09 May 2023 02:49:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683625784; cv=none; d=google.com; s=arc-20160816; b=ow1sbsxgSliuLUfwwSxMYZK99HtCs48DqT12dCJni34nUgwNSlAKWGQSAkyr+BsgCx gZjhWZe6UUJqRd2nwpYan7BuFm0NFUCW3DBV2ozoIXyuswQuz/x9Vje24I8LA1Cx5nT6 BCt2QZhx11dAm2YoKEHmSkxVPZFYBA7EexQAxm8REVJFCE1bJoA83RfH6zHSvA6+CMYI Eg1H2KayLqKXQ8dSjprBFriLjslqZjOJHt38freafq0jTJRqwxipPJwuEABeFDiGwLZj 5XBHzYyprJeZmXxToYI9JOu5lfaGK+Jp95gKQsSIeIgjvAhqqWTqR5QfgbJ0AacWUKiB VGEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vY3Q3GCHsjquVCmMgoZ2yhC4R121K3G0gkk1ot9VvUo=; b=0Gla7mr4/t9cxKs2GPUzVj7HFJ5R783OyclKOsNVIslfKmUXVatkpp0kMpvCTNg5vd pb+DQNj49UHu8Pgo7Bcb0AXQUYOAekfOvSxJsNegFmf4YvRVvOg68v6X5x5IxX26TtKD K/bC07b+VKlI3giUf9ZcAyC5yHX17inTxhTHDitCQxOJgiwlEkkJ7VmDsOmK49uLtg9S jIv+QiYUEXK2hlWp3vVWvqOw3PHEWQaDae3OFFQuwT/CYor+ah4Uc4PeHASFpJuFl07F 4DoRqycOMfL0c6uWZrWE8MsF2f2EMmyN17C18mbkeIIRoDIOZSQo9zq2MIOz2w/4ppbu UjLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=fezUtltp; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c9-20020a170903234900b001a5264640cesi1213417plh.534.2023.05.09.02.49.27; Tue, 09 May 2023 02:49:44 -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=@ti.com header.s=ti-com-17Q1 header.b=fezUtltp; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235068AbjEIJbZ (ORCPT <rfc822;baris.duru.linux@gmail.com> + 99 others); Tue, 9 May 2023 05:31:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234986AbjEIJbP (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 9 May 2023 05:31:15 -0400 Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2A371A4 for <linux-kernel@vger.kernel.org>; Tue, 9 May 2023 02:31:12 -0700 (PDT) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 3499UfKV022682; Tue, 9 May 2023 04:30:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1683624642; bh=vY3Q3GCHsjquVCmMgoZ2yhC4R121K3G0gkk1ot9VvUo=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=fezUtltp2e4SCP+3uHZIMz5ei4CSeRFHpZHW5FPYcWe22sicUPwtBB6Rs6Z37K+/9 DrFhw0ZOUeyV7fB9+CSjyx11PZbdRY8bOkYLZc+wsT2wfOWeur5nthUPIdxFUOdvh9 AnRSAKP2Ld+NTk2VQOoTHP9CVpWKFDgrBIlud5FM= Received: from DFLE105.ent.ti.com (dfle105.ent.ti.com [10.64.6.26]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 3499Ufrh107181 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 9 May 2023 04:30:41 -0500 Received: from DFLE110.ent.ti.com (10.64.6.31) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Tue, 9 May 2023 04:30:41 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE110.ent.ti.com (10.64.6.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; Tue, 9 May 2023 04:30:41 -0500 Received: from localhost (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 3499UeXN017870; Tue, 9 May 2023 04:30:41 -0500 From: Aradhya Bhatia <a-bhatia1@ti.com> To: Tomi Valkeinen <tomba@kernel.org>, Jyri Sarha <jyri.sarha@iki.fi>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>, Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Andrzej Hajda <andrzej.hajda@intel.com>, Neil Armstrong <neil.armstrong@linaro.org>, Robert Foss <rfoss@kernel.org>, Jonas Karlman <jonas@kwiboo.se>, Jernej Skrabec <jernej.skrabec@gmail.com>, Rahul T R <r-ravikumar@ti.com>, Swapnil Jakhade <sjakhade@cadence.com>, Boris Brezillon <boris.brezillon@collabora.com>, Francesco Dolcini <francesco@dolcini.it> CC: DRI Development List <dri-devel@lists.freedesktop.org>, Linux Kernel List <linux-kernel@vger.kernel.org>, Nishanth Menon <nm@ti.com>, Vignesh Raghavendra <vigneshr@ti.com>, Devarsh Thakkar <devarsht@ti.com>, Jayesh Choudhary <j-choudhary@ti.com>, Aradhya Bhatia <a-bhatia1@ti.com> Subject: [PATCH v6 3/8] drm/bridge: mhdp8546: Add minimal format negotiation Date: Tue, 9 May 2023 15:00:31 +0530 Message-ID: <20230509093036.3303-4-a-bhatia1@ti.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230509093036.3303-1-a-bhatia1@ti.com> References: <20230509093036.3303-1-a-bhatia1@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765409590289749780?= X-GMAIL-MSGID: =?utf-8?q?1765409590289749780?= |
Series |
drm/tidss: Use new connector model for tidss
|
|
Commit Message
Aradhya Bhatia
May 9, 2023, 9:30 a.m. UTC
From: Nikhil Devshatwar <nikhil.nd@ti.com> With new connector model, mhdp bridge will not create the connector and SoC driver will rely on format negotiation to setup the encoder format. Support minimal format negotiations hooks in the drm_bridge_funcs. Complete format negotiation can be added based on EDID data. This patch adds the minimal required support to avoid failure after moving to new connector model. Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com> --- Notes: changes from v1: * cosmetic fixes, commit message update. changes from v5: * dropped the default_bus_format variable and directly assigned MEDIA_BUS_FMT_RGB121212_1X36 to input_fmts. .../drm/bridge/cadence/cdns-mhdp8546-core.c | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+)
Comments
On 09/05/2023 12:30, Aradhya Bhatia wrote: > From: Nikhil Devshatwar <nikhil.nd@ti.com> > > With new connector model, mhdp bridge will not create the connector and > SoC driver will rely on format negotiation to setup the encoder format. > > Support minimal format negotiations hooks in the drm_bridge_funcs. > Complete format negotiation can be added based on EDID data. > This patch adds the minimal required support to avoid failure > after moving to new connector model. > > Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com> > Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com> You need to add your SoB to this and the other patches. > --- > > Notes: > > changes from v1: > * cosmetic fixes, commit message update. > > changes from v5: > * dropped the default_bus_format variable and directly assigned > MEDIA_BUS_FMT_RGB121212_1X36 to input_fmts. > > .../drm/bridge/cadence/cdns-mhdp8546-core.c | 25 +++++++++++++++++++ > 1 file changed, 25 insertions(+) > > diff --git a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c > index f6822dfa3805..623e4235c94f 100644 > --- a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c > +++ b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c > @@ -2146,6 +2146,30 @@ cdns_mhdp_bridge_atomic_reset(struct drm_bridge *bridge) > return &cdns_mhdp_state->base; > } > > +static u32 *cdns_mhdp_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; > + > + if (output_fmt != MEDIA_BUS_FMT_FIXED) > + return NULL; The tfp410 and sii902x drivers don't have the above check. Why does mhdp need it? Or the other way, why don't tfp410 and sii902x need it? I guess at the moment we always do get MEDIA_BUS_FMT_FIXED as the out fmt (in all three bridge drivers), don't we? Tomi
Hi Tomi, On 12-May-23 14:45, Tomi Valkeinen wrote: > On 09/05/2023 12:30, Aradhya Bhatia wrote: >> From: Nikhil Devshatwar <nikhil.nd@ti.com> >> >> With new connector model, mhdp bridge will not create the connector and >> SoC driver will rely on format negotiation to setup the encoder format. >> >> Support minimal format negotiations hooks in the drm_bridge_funcs. >> Complete format negotiation can be added based on EDID data. >> This patch adds the minimal required support to avoid failure >> after moving to new connector model. >> >> Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com> >> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com> > > You need to add your SoB to this and the other patches. Okay! > >> --- >> >> Notes: >> >> changes from v1: >> * cosmetic fixes, commit message update. >> >> changes from v5: >> * dropped the default_bus_format variable and directly assigned >> MEDIA_BUS_FMT_RGB121212_1X36 to input_fmts. >> >> .../drm/bridge/cadence/cdns-mhdp8546-core.c | 25 +++++++++++++++++++ >> 1 file changed, 25 insertions(+) >> >> diff --git a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c >> b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c >> index f6822dfa3805..623e4235c94f 100644 >> --- a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c >> +++ b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c >> @@ -2146,6 +2146,30 @@ cdns_mhdp_bridge_atomic_reset(struct drm_bridge >> *bridge) >> return &cdns_mhdp_state->base; >> } >> +static u32 *cdns_mhdp_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; >> + >> + if (output_fmt != MEDIA_BUS_FMT_FIXED) >> + return NULL; > > The tfp410 and sii902x drivers don't have the above check. Why does mhdp > need it? Or the other way, why don't tfp410 and sii902x need it? I had removed this condition in order to follow status quo, from the ITE-66121 HDMI bridge driver. The idea would have been to drop this for MHDP as well, but I guess I overlooked this one. However... > I guess at the moment we always do get MEDIA_BUS_FMT_FIXED as the out > fmt (in all three bridge drivers), don't we? ... I tested again to ensure that the above is indeed the case. And ended up catching some odd behavior. It turns out that for all the HDMI bridges (TFP410, SII902X, ITE-66121), the format negotiation doesn't stop at output_fmt = MEDIA_BUS_FMT_FIXED. The {bridge}_get_input_format API gets called again with the output_fmt = MEDIA_BUS_FMT_RGB24_1X24. This doesn't happen with the MHDP driver. Format negotiation with MHDP bridge stops after one round, at output_fmt = MEDIA_BUS_FMT_FIXED. Regards Aradhya
On 15/05/2023 17:59, Aradhya Bhatia wrote: > Hi Tomi, > > On 12-May-23 14:45, Tomi Valkeinen wrote: >> On 09/05/2023 12:30, Aradhya Bhatia wrote: >>> From: Nikhil Devshatwar <nikhil.nd@ti.com> >>> >>> With new connector model, mhdp bridge will not create the connector and >>> SoC driver will rely on format negotiation to setup the encoder format. >>> >>> Support minimal format negotiations hooks in the drm_bridge_funcs. >>> Complete format negotiation can be added based on EDID data. >>> This patch adds the minimal required support to avoid failure >>> after moving to new connector model. >>> >>> Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com> >>> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com> >> >> You need to add your SoB to this and the other patches. > > Okay! > >> >>> --- >>> >>> Notes: >>> >>> changes from v1: >>> * cosmetic fixes, commit message update. >>> >>> changes from v5: >>> * dropped the default_bus_format variable and directly assigned >>> MEDIA_BUS_FMT_RGB121212_1X36 to input_fmts. >>> >>> .../drm/bridge/cadence/cdns-mhdp8546-core.c | 25 +++++++++++++++++++ >>> 1 file changed, 25 insertions(+) >>> >>> diff --git a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c >>> b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c >>> index f6822dfa3805..623e4235c94f 100644 >>> --- a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c >>> +++ b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c >>> @@ -2146,6 +2146,30 @@ cdns_mhdp_bridge_atomic_reset(struct drm_bridge >>> *bridge) >>> return &cdns_mhdp_state->base; >>> } >>> +static u32 *cdns_mhdp_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; >>> + >>> + if (output_fmt != MEDIA_BUS_FMT_FIXED) >>> + return NULL; >> >> The tfp410 and sii902x drivers don't have the above check. Why does mhdp >> need it? Or the other way, why don't tfp410 and sii902x need it? > > I had removed this condition in order to follow status quo, from the > ITE-66121 HDMI bridge driver. > > The idea would have been to drop this for MHDP as well, but I guess I > overlooked this one. > > However... > >> I guess at the moment we always do get MEDIA_BUS_FMT_FIXED as the out >> fmt (in all three bridge drivers), don't we? > > ... I tested again to ensure that the above is indeed the case. And > ended up catching some odd behavior. > > It turns out that for all the HDMI bridges (TFP410, SII902X, ITE-66121), > the format negotiation doesn't stop at output_fmt = MEDIA_BUS_FMT_FIXED. > The {bridge}_get_input_format API gets called again with the output_fmt > = MEDIA_BUS_FMT_RGB24_1X24. > > This doesn't happen with the MHDP driver. Format negotiation with MHDP > bridge stops after one round, at output_fmt = MEDIA_BUS_FMT_FIXED. This is because the bridge negociation logic will test with all possible output formats from the chain, and won't stop at first working test. If your bridge only supports a single input format, it should return the same format whatever output_fmt is tried. So indeed remove this test on mhdp aswell, or filter out invalid output formats. The MEDIA_BUS_FMT_FIXED is when there's no output format to test, so this should be always supported. Neil > > > Regards > Aradhya
Hi Neil, Thank you for reviewing the patch. On 16-May-23 12:51, Neil Armstrong wrote: > On 15/05/2023 17:59, Aradhya Bhatia wrote: >> Hi Tomi, >> >> On 12-May-23 14:45, Tomi Valkeinen wrote: >>> On 09/05/2023 12:30, Aradhya Bhatia wrote: >>>> From: Nikhil Devshatwar <nikhil.nd@ti.com> >>>> >>>> With new connector model, mhdp bridge will not create the connector and >>>> SoC driver will rely on format negotiation to setup the encoder format. >>>> >>>> Support minimal format negotiations hooks in the drm_bridge_funcs. >>>> Complete format negotiation can be added based on EDID data. >>>> This patch adds the minimal required support to avoid failure >>>> after moving to new connector model. >>>> >>>> Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com> >>>> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com> >>> >>> You need to add your SoB to this and the other patches. >> >> Okay! >> >>> >>>> --- >>>> >>>> Notes: >>>> >>>> changes from v1: >>>> * cosmetic fixes, commit message update. >>>> >>>> changes from v5: >>>> * dropped the default_bus_format variable and directly assigned >>>> MEDIA_BUS_FMT_RGB121212_1X36 to input_fmts. >>>> >>>> .../drm/bridge/cadence/cdns-mhdp8546-core.c | 25 >>>> +++++++++++++++++++ >>>> 1 file changed, 25 insertions(+) >>>> >>>> diff --git a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c >>>> b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c >>>> index f6822dfa3805..623e4235c94f 100644 >>>> --- a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c >>>> +++ b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c >>>> @@ -2146,6 +2146,30 @@ cdns_mhdp_bridge_atomic_reset(struct drm_bridge >>>> *bridge) >>>> return &cdns_mhdp_state->base; >>>> } >>>> +static u32 *cdns_mhdp_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; >>>> + >>>> + if (output_fmt != MEDIA_BUS_FMT_FIXED) >>>> + return NULL; >>> >>> The tfp410 and sii902x drivers don't have the above check. Why does mhdp >>> need it? Or the other way, why don't tfp410 and sii902x need it? >> >> I had removed this condition in order to follow status quo, from the >> ITE-66121 HDMI bridge driver. >> >> The idea would have been to drop this for MHDP as well, but I guess I >> overlooked this one. >> >> However... >> >>> I guess at the moment we always do get MEDIA_BUS_FMT_FIXED as the out >>> fmt (in all three bridge drivers), don't we? >> >> ... I tested again to ensure that the above is indeed the case. And >> ended up catching some odd behavior. >> >> It turns out that for all the HDMI bridges (TFP410, SII902X, ITE-66121), >> the format negotiation doesn't stop at output_fmt = MEDIA_BUS_FMT_FIXED. >> The {bridge}_get_input_format API gets called again with the output_fmt >> = MEDIA_BUS_FMT_RGB24_1X24. >> >> This doesn't happen with the MHDP driver. Format negotiation with MHDP >> bridge stops after one round, at output_fmt = MEDIA_BUS_FMT_FIXED. > > This is because the bridge negociation logic will test with all possible > output formats from the chain, and won't stop at first working test. > Okay.. > If your bridge only supports a single input format, it should return the > same format whatever output_fmt is tried. > > So indeed remove this test on mhdp aswell, or filter out invalid output > formats. Agreed. I have been looking into the code deeper and trying to understand the logic flow around the format negotiation in the framework. Here are the 2 points that I want to mention. Please let me know if I have missed something with my understanding. Firstly, the mhdp-8546 output connects to the display-connector (with the compatible, "dp-connector") in the devicetree. When the negotiation begins at 'drm_atomic_bridge_chain_select_bus_fmts' the display-connector bridge *should* act as the 'last_bridge', and the atomic_get_output_bus_fmts hook of the display-connector should get called. However, for some reason I am not yet sure of, the condition :: if (last_bridge->funcs->atomic_get_output_bus_fmts) fails and the 'select_bus_fmt_recursive' function gets called instead, (with MEDIA_BUS_FMT_FIXED as output_fmt), which in turn calls the atomic_get_input_bus_fmts hook of the mhdp-8546. This entirely skips the display-connector out of the format negotiation. This doesn't happen when the HDMI bridges are in concern, even though, they too are connected with display-connector (with compatible "hdmi-connector"). I looked into the display-connector driver hoping to find if the 2 types of connectors are being treated differently wrt format negotiation, but I did not find any clue. Please let me know if you have any idea about this. Secondly, as mentioned in the display-connector driver, this bridge is essentially a pass-through. And hence to reflect that, both the format negotiation hooks of display-connector driver call their counter-parts from the previous bridge if they are available, and if not, the formats are assigned MEDIA_BUS_FMT_FIXED. While this makes sense for the atomic_get_output_bus_fmts hook, it seems to me that, the same may not hold true for the atomic_get_input_bus_fmts hook. If the bridge is indeed a pass-through, should it not also pass the output_format as its input format (which it actually got from the output of previous bridge)? This way all the following will remain same. 1. output_fmt of prev_bridge, 2. input_fmt of display-connector, and 3. output_fmt of display-connector. Currently, since the atomic_get_input_bus_fmts hook of display-connector calls its counter-part from the prev_bridge, the input_fmt it passes (for HDMI bridges) is MEDIA_BUS_FMT_RGB888_1X24. The atomic_get_ouput_bus_fmts hook of the HDMI bridge has to, then, set an input bus format considering MEDIA_BUS_FMT_RGB888_1X24 as its output instead of MEDIA_BUS_FMT_FIXED. Let me know what you think! Regards Aradhya
On 16/05/2023 17:25, Aradhya Bhatia wrote: > Hi Neil, > > Thank you for reviewing the patch. > > On 16-May-23 12:51, Neil Armstrong wrote: >> On 15/05/2023 17:59, Aradhya Bhatia wrote: >>> Hi Tomi, >>> >>> On 12-May-23 14:45, Tomi Valkeinen wrote: >>>> On 09/05/2023 12:30, Aradhya Bhatia wrote: >>>>> From: Nikhil Devshatwar <nikhil.nd@ti.com> >>>>> >>>>> With new connector model, mhdp bridge will not create the connector and >>>>> SoC driver will rely on format negotiation to setup the encoder format. >>>>> >>>>> Support minimal format negotiations hooks in the drm_bridge_funcs. >>>>> Complete format negotiation can be added based on EDID data. >>>>> This patch adds the minimal required support to avoid failure >>>>> after moving to new connector model. >>>>> >>>>> Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com> >>>>> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com> >>>> >>>> You need to add your SoB to this and the other patches. >>> >>> Okay! >>> >>>> >>>>> --- >>>>> >>>>> Notes: >>>>> >>>>> changes from v1: >>>>> * cosmetic fixes, commit message update. >>>>> >>>>> changes from v5: >>>>> * dropped the default_bus_format variable and directly assigned >>>>> MEDIA_BUS_FMT_RGB121212_1X36 to input_fmts. >>>>> >>>>> .../drm/bridge/cadence/cdns-mhdp8546-core.c | 25 >>>>> +++++++++++++++++++ >>>>> 1 file changed, 25 insertions(+) >>>>> >>>>> diff --git a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c >>>>> b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c >>>>> index f6822dfa3805..623e4235c94f 100644 >>>>> --- a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c >>>>> +++ b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c >>>>> @@ -2146,6 +2146,30 @@ cdns_mhdp_bridge_atomic_reset(struct drm_bridge >>>>> *bridge) >>>>> return &cdns_mhdp_state->base; >>>>> } >>>>> +static u32 *cdns_mhdp_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; >>>>> + >>>>> + if (output_fmt != MEDIA_BUS_FMT_FIXED) >>>>> + return NULL; >>>> >>>> The tfp410 and sii902x drivers don't have the above check. Why does mhdp >>>> need it? Or the other way, why don't tfp410 and sii902x need it? >>> >>> I had removed this condition in order to follow status quo, from the >>> ITE-66121 HDMI bridge driver. >>> >>> The idea would have been to drop this for MHDP as well, but I guess I >>> overlooked this one. >>> >>> However... >>> >>>> I guess at the moment we always do get MEDIA_BUS_FMT_FIXED as the out >>>> fmt (in all three bridge drivers), don't we? >>> >>> ... I tested again to ensure that the above is indeed the case. And >>> ended up catching some odd behavior. >>> >>> It turns out that for all the HDMI bridges (TFP410, SII902X, ITE-66121), >>> the format negotiation doesn't stop at output_fmt = MEDIA_BUS_FMT_FIXED. >>> The {bridge}_get_input_format API gets called again with the output_fmt >>> = MEDIA_BUS_FMT_RGB24_1X24. >>> >>> This doesn't happen with the MHDP driver. Format negotiation with MHDP >>> bridge stops after one round, at output_fmt = MEDIA_BUS_FMT_FIXED. >> >> This is because the bridge negociation logic will test with all possible >> output formats from the chain, and won't stop at first working test. >> > Okay.. > >> If your bridge only supports a single input format, it should return the >> same format whatever output_fmt is tried. >> >> So indeed remove this test on mhdp aswell, or filter out invalid output >> formats. > Agreed. > > I have been looking into the code deeper and trying to understand the > logic flow around the format negotiation in the framework. Here are the > 2 points that I want to mention. Please let me know if I have missed > something with my understanding. > > > Firstly, the mhdp-8546 output connects to the display-connector (with > the compatible, "dp-connector") in the devicetree. > > When the negotiation begins at 'drm_atomic_bridge_chain_select_bus_fmts' > the display-connector bridge *should* act as the 'last_bridge', and the > atomic_get_output_bus_fmts hook of the display-connector should get > called. However, for some reason I am not yet sure of, the condition > > :: if (last_bridge->funcs->atomic_get_output_bus_fmts) > > fails and the 'select_bus_fmt_recursive' function gets called instead, > (with MEDIA_BUS_FMT_FIXED as output_fmt), which in turn calls the > atomic_get_input_bus_fmts hook of the mhdp-8546. This entirely skips the > display-connector out of the format negotiation. > > This doesn't happen when the HDMI bridges are in concern, even though, > they too are connected with display-connector (with compatible > "hdmi-connector"). > > I looked into the display-connector driver hoping to find if the 2 types > of connectors are being treated differently wrt format negotiation, but > I did not find any clue. > > Please let me know if you have any idea about this. The display connector is probed, but not attached to the bridge chain, so the last bridge is the mdhp. You need to call drm_bridge_attach in the mhdp driver to attach the next bridge. See e.g. tfp410's tfp410_attach(). Also, I think the support in mhdp for the !DRM_BRIDGE_ATTACH_NO_CONNECTOR case should be dropped. > Secondly, as mentioned in the display-connector driver, this bridge is > essentially a pass-through. And hence to reflect that, both the format > negotiation hooks of display-connector driver call their counter-parts > from the previous bridge if they are available, and if not, the formats > are assigned MEDIA_BUS_FMT_FIXED. > > While this makes sense for the atomic_get_output_bus_fmts hook, it seems > to me that, the same may not hold true for the atomic_get_input_bus_fmts > hook. > If the bridge is indeed a pass-through, should it not also pass the > output_format as its input format (which it actually got from the output > of previous bridge)? > > This way all the following will remain same. > > 1. output_fmt of prev_bridge, > 2. input_fmt of display-connector, and > 3. output_fmt of display-connector. > > Currently, since the atomic_get_input_bus_fmts hook of display-connector > calls its counter-part from the prev_bridge, the input_fmt it passes > (for HDMI bridges) is MEDIA_BUS_FMT_RGB888_1X24. The > atomic_get_ouput_bus_fmts hook of the HDMI bridge has to, then, set an > input bus format considering MEDIA_BUS_FMT_RGB888_1X24 as its output > instead of MEDIA_BUS_FMT_FIXED. > > Let me know what you think! Yes, it does sound odd to me. Returning the same from the display-connector's get-input-fmt and get-output-fmt makes more sense. Btw, we seem to be missing get-output-fmt from the mdhp driver. Tomi
Hi Tomi, Thank you for taking a look at this. On 26/05/23 14:59, Tomi Valkeinen wrote: > On 16/05/2023 17:25, Aradhya Bhatia wrote: >> Hi Neil, >> >> Thank you for reviewing the patch. >> >> On 16-May-23 12:51, Neil Armstrong wrote: >>> On 15/05/2023 17:59, Aradhya Bhatia wrote: >>>> Hi Tomi, >>>> >>>> On 12-May-23 14:45, Tomi Valkeinen wrote: >>>>> On 09/05/2023 12:30, Aradhya Bhatia wrote: >>>>>> From: Nikhil Devshatwar <nikhil.nd@ti.com> >>>>>> >>>>>> With new connector model, mhdp bridge will not create the >>>>>> connector and >>>>>> SoC driver will rely on format negotiation to setup the encoder >>>>>> format. >>>>>> >>>>>> Support minimal format negotiations hooks in the drm_bridge_funcs. >>>>>> Complete format negotiation can be added based on EDID data. >>>>>> This patch adds the minimal required support to avoid failure >>>>>> after moving to new connector model. >>>>>> >>>>>> Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com> >>>>>> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com> >>>>> >>>>> You need to add your SoB to this and the other patches. >>>> >>>> Okay! >>>> >>>>> >>>>>> --- >>>>>> >>>>>> Notes: >>>>>> >>>>>> changes from v1: >>>>>> * cosmetic fixes, commit message update. >>>>>> >>>>>> changes from v5: >>>>>> * dropped the default_bus_format variable and directly >>>>>> assigned >>>>>> MEDIA_BUS_FMT_RGB121212_1X36 to input_fmts. >>>>>> >>>>>> .../drm/bridge/cadence/cdns-mhdp8546-core.c | 25 >>>>>> +++++++++++++++++++ >>>>>> 1 file changed, 25 insertions(+) >>>>>> >>>>>> diff --git a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c >>>>>> b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c >>>>>> index f6822dfa3805..623e4235c94f 100644 >>>>>> --- a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c >>>>>> +++ b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c >>>>>> @@ -2146,6 +2146,30 @@ cdns_mhdp_bridge_atomic_reset(struct >>>>>> drm_bridge >>>>>> *bridge) >>>>>> return &cdns_mhdp_state->base; >>>>>> } >>>>>> +static u32 *cdns_mhdp_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; >>>>>> + >>>>>> + if (output_fmt != MEDIA_BUS_FMT_FIXED) >>>>>> + return NULL; >>>>> >>>>> The tfp410 and sii902x drivers don't have the above check. Why does >>>>> mhdp >>>>> need it? Or the other way, why don't tfp410 and sii902x need it? >>>> >>>> I had removed this condition in order to follow status quo, from the >>>> ITE-66121 HDMI bridge driver. >>>> >>>> The idea would have been to drop this for MHDP as well, but I guess I >>>> overlooked this one. >>>> >>>> However... >>>> >>>>> I guess at the moment we always do get MEDIA_BUS_FMT_FIXED as the out >>>>> fmt (in all three bridge drivers), don't we? >>>> >>>> ... I tested again to ensure that the above is indeed the case. And >>>> ended up catching some odd behavior. >>>> >>>> It turns out that for all the HDMI bridges (TFP410, SII902X, >>>> ITE-66121), >>>> the format negotiation doesn't stop at output_fmt = >>>> MEDIA_BUS_FMT_FIXED. >>>> The {bridge}_get_input_format API gets called again with the output_fmt >>>> = MEDIA_BUS_FMT_RGB24_1X24. >>>> >>>> This doesn't happen with the MHDP driver. Format negotiation with MHDP >>>> bridge stops after one round, at output_fmt = MEDIA_BUS_FMT_FIXED. >>> >>> This is because the bridge negociation logic will test with all possible >>> output formats from the chain, and won't stop at first working test. >>> >> Okay.. >> >>> If your bridge only supports a single input format, it should return the >>> same format whatever output_fmt is tried. >>> >>> So indeed remove this test on mhdp aswell, or filter out invalid output >>> formats. >> Agreed. >> >> I have been looking into the code deeper and trying to understand the >> logic flow around the format negotiation in the framework. Here are the >> 2 points that I want to mention. Please let me know if I have missed >> something with my understanding. >> >> >> Firstly, the mhdp-8546 output connects to the display-connector (with >> the compatible, "dp-connector") in the devicetree. >> >> When the negotiation begins at 'drm_atomic_bridge_chain_select_bus_fmts' >> the display-connector bridge *should* act as the 'last_bridge', and the >> atomic_get_output_bus_fmts hook of the display-connector should get >> called. However, for some reason I am not yet sure of, the condition >> >> :: if (last_bridge->funcs->atomic_get_output_bus_fmts) >> >> fails and the 'select_bus_fmt_recursive' function gets called instead, >> (with MEDIA_BUS_FMT_FIXED as output_fmt), which in turn calls the >> atomic_get_input_bus_fmts hook of the mhdp-8546. This entirely skips the >> display-connector out of the format negotiation. >> >> This doesn't happen when the HDMI bridges are in concern, even though, >> they too are connected with display-connector (with compatible >> "hdmi-connector"). >> >> I looked into the display-connector driver hoping to find if the 2 types >> of connectors are being treated differently wrt format negotiation, but >> I did not find any clue. >> >> Please let me know if you have any idea about this. > > The display connector is probed, but not attached to the bridge chain, > so the last bridge is the mdhp. You need to call drm_bridge_attach in > the mhdp driver to attach the next bridge. See e.g. tfp410's > tfp410_attach(). Okay, understood. Thank you! > > Also, I think the support in mhdp for the > !DRM_BRIDGE_ATTACH_NO_CONNECTOR case should be dropped. Agreed. I will send a separate series for this and drm_bridge_attach add. > >> Secondly, as mentioned in the display-connector driver, this bridge is >> essentially a pass-through. And hence to reflect that, both the format >> negotiation hooks of display-connector driver call their counter-parts >> from the previous bridge if they are available, and if not, the formats >> are assigned MEDIA_BUS_FMT_FIXED. >> >> While this makes sense for the atomic_get_output_bus_fmts hook, it seems >> to me that, the same may not hold true for the atomic_get_input_bus_fmts >> hook. >> If the bridge is indeed a pass-through, should it not also pass the >> output_format as its input format (which it actually got from the output >> of previous bridge)? >> >> This way all the following will remain same. >> >> 1. output_fmt of prev_bridge, >> 2. input_fmt of display-connector, and >> 3. output_fmt of display-connector. >> >> Currently, since the atomic_get_input_bus_fmts hook of display-connector >> calls its counter-part from the prev_bridge, the input_fmt it passes >> (for HDMI bridges) is MEDIA_BUS_FMT_RGB888_1X24. The >> atomic_get_ouput_bus_fmts hook of the HDMI bridge has to, then, set an >> input bus format considering MEDIA_BUS_FMT_RGB888_1X24 as its output >> instead of MEDIA_BUS_FMT_FIXED. >> >> Let me know what you think! > > Yes, it does sound odd to me. Returning the same from the > display-connector's get-input-fmt and get-output-fmt makes more sense. Yes, it does make more sense! I can send a separate fix for this. > > Btw, we seem to be missing get-output-fmt from the mdhp driver. Yes, we are. With the drm_bridge_attach call added, the display-connector bridge will assign MEDIA_BUS_FMT_FIXED as the default output format. And most bridges support only their primary output bus format in their get-output-fmt hooks. I suppose it would be RGB121212_1X36 in mhdp8546's case. Do we require this when there is no comprehensive way to determine if another bus format may be more suitable (depending on the hardware configurations)? Regards Aradhya
On 29/05/2023 08:37, Aradhya Bhatia wrote: >> Btw, we seem to be missing get-output-fmt from the mdhp driver. > Yes, we are. > > With the drm_bridge_attach call added, the display-connector bridge will > assign MEDIA_BUS_FMT_FIXED as the default output format. And most > bridges support only their primary output bus format in their > get-output-fmt hooks. I suppose it would be RGB121212_1X36 in mhdp8546's > case. > > Do we require this when there is no comprehensive way to determine if > another bus format may be more suitable (depending on the hardware > configurations)? If I recall right, mhdp supports other formats than RGB121212_1X36 on the input side (different bit depths and also yuv). On the output side, even if the input is 12 bits per component, when connected to a normal monitor, the output bpc would be 8. I'm not sure if any of that matters, as nobody (?) will use the output format of mhdp, as it just goes "outside" to the monitor, and it is the mhdp driver that negotiates a suitable output format with the monitor. Tomi
diff --git a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c index f6822dfa3805..623e4235c94f 100644 --- a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +++ b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c @@ -2146,6 +2146,30 @@ cdns_mhdp_bridge_atomic_reset(struct drm_bridge *bridge) return &cdns_mhdp_state->base; } +static u32 *cdns_mhdp_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; + + if (output_fmt != MEDIA_BUS_FMT_FIXED) + return NULL; + + input_fmts = kzalloc(sizeof(*input_fmts), GFP_KERNEL); + if (!input_fmts) + return NULL; + + *num_input_fmts = 1; + input_fmts[0] = MEDIA_BUS_FMT_RGB121212_1X36; + + return input_fmts; +} + static int cdns_mhdp_atomic_check(struct drm_bridge *bridge, struct drm_bridge_state *bridge_state, struct drm_crtc_state *crtc_state, @@ -2210,6 +2234,7 @@ static const struct drm_bridge_funcs cdns_mhdp_bridge_funcs = { .atomic_duplicate_state = cdns_mhdp_bridge_atomic_duplicate_state, .atomic_destroy_state = cdns_mhdp_bridge_atomic_destroy_state, .atomic_reset = cdns_mhdp_bridge_atomic_reset, + .atomic_get_input_bus_fmts = cdns_mhdp_get_input_bus_fmts, .detect = cdns_mhdp_bridge_detect, .get_edid = cdns_mhdp_bridge_get_edid, .hpd_enable = cdns_mhdp_bridge_hpd_enable,