Message ID | 20230606082142.23760-6-a-bhatia1@ti.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3237441vqr; Tue, 6 Jun 2023 01:34:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6lw0a31Xi7s6wOhxSEPwrf9Q/5tUhUG05gtS6Qro2gQld0f3xaG2rJlBeb/4qKuo3Bzj5g X-Received: by 2002:a05:620a:2814:b0:75e:c64f:3db7 with SMTP id f20-20020a05620a281400b0075ec64f3db7mr1520655qkp.2.1686040458652; Tue, 06 Jun 2023 01:34:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686040458; cv=none; d=google.com; s=arc-20160816; b=F8UV/bLw9sZwvOXNvWfpSz5PqOtxMrjfcuqWYQjU93VTWPuj8jB1R7NLJ2dlNtcj4O l/3ZBG4kcipAOVsM5wlh6zEXd6cU95QFcWCuu/eMyJKL6DDPM36W4hoy3ZLm/2R+KjVz xbOKasVUsQhsz0jHKj5y5dzm6q4O3Plklj3/SCdJYDRAeY1fMxAwrxcoLVex0vPlhrUY CwhmS4kcC5ydwhwN7ldJKQIAQDpwm+MLvjvxEFAkPDKdc0mnWqJmFk4aao1J/Px6VheK w7hfWKu+jbP5DU9ir41N4U94pQkdzeXi3rI73FRA0FlQ00OysFKCa7OCiqiGoBXLyeOt SVxA== 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=tSOarY1oK5P3WdLn8Hnq0D9v4f4KHxiCVqh5EM0vuxw=; b=ic7Cdpsl44gPPMS6PyjcQ5KC30slfeGM90kwvnUCWkIgzm1kgEuWg11VpsHtJlm/XG 0321WNCtasIfVXrVSXUxXFuFM2c4aXG+KBJ0kx0dzid5PT9wD6jojUcRhW4Q5Itq7kLg EHfORnDybX/4RcrTPFuTET2GXupepkuRMDzsYDJIRW88dfDraXh9ZumR94DuPmB1AtJX /dRappn/mjHQjcXz/l76ubv4Bk4qLOxk9yYmArbpDdS+vdInHcowtS/aAgWN7r8ASZso +RGNG6X6mTMAyOIuti1JMHTOfE2PhuUhO0/t0szjWpegY2yv0S7cV7SaOkXgJMAVJsg3 24fQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="r/Ghi5Qn"; 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 pe35-20020a05620a852300b0075c9eae7323si5427488qkn.681.2023.06.06.01.34.04; Tue, 06 Jun 2023 01:34:18 -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="r/Ghi5Qn"; 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 S236512AbjFFIW2 (ORCPT <rfc822;xxoosimple@gmail.com> + 99 others); Tue, 6 Jun 2023 04:22:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236407AbjFFIWS (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 6 Jun 2023 04:22:18 -0400 Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80C59E5A for <linux-kernel@vger.kernel.org>; Tue, 6 Jun 2023 01:22:13 -0700 (PDT) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 3568LpmQ013072; Tue, 6 Jun 2023 03:21:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1686039711; bh=tSOarY1oK5P3WdLn8Hnq0D9v4f4KHxiCVqh5EM0vuxw=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=r/Ghi5QnqgTvobF8E7GvNafN5zmANSdORTc/eRZYkzlBF/G+5tIbmQjRK7TTC2bkS Z1Ob48mwPLFg2WAz2FtuxyJOBGn1Zlwst5/e4Y4RgxvJMrDEHoWbKCU0hRCn+sKBzB XZJt/NMY6HI9t6YUXdHk98CVNi7yduuDB4jMGPJw= Received: from DFLE101.ent.ti.com (dfle101.ent.ti.com [10.64.6.22]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 3568Lpvc012358 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 6 Jun 2023 03:21:51 -0500 Received: from DFLE107.ent.ti.com (10.64.6.28) by DFLE101.ent.ti.com (10.64.6.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Tue, 6 Jun 2023 03:21:51 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE107.ent.ti.com (10.64.6.28) 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, 6 Jun 2023 03:21:50 -0500 Received: from localhost (ileaxei01-snat.itg.ti.com [10.180.69.5]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 3568LolY019592; Tue, 6 Jun 2023 03:21:50 -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>, 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>, Rahul T R <r-ravikumar@ti.com>, Devarsh Thakkar <devarsht@ti.com>, Jayesh Choudhary <j-choudhary@ti.com>, Aradhya Bhatia <a-bhatia1@ti.com> Subject: [PATCH v7 5/8] drm/bridge: sii902x: Support format negotiation hooks Date: Tue, 6 Jun 2023 13:51:39 +0530 Message-ID: <20230606082142.23760-6-a-bhatia1@ti.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230606082142.23760-1-a-bhatia1@ti.com> References: <20230606082142.23760-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?1767941560014573845?= X-GMAIL-MSGID: =?utf-8?q?1767941560014573845?= |
Series |
drm/tidss: Use new connector model for tidss
|
|
Commit Message
Aradhya Bhatia
June 6, 2023, 8:21 a.m. UTC
With new connector model, sii902x will not create the connector, when DRM_BRIDGE_ATTACH_NO_CONNECTOR is set and SoC driver will rely on format negotiation to setup the encoder format. Support format negotiations hooks in the drm_bridge_funcs. Use helper functions for state management. Input format is selected to MEDIA_BUS_FMT_RGB888_1X24 as default, as is the case with older model. Signed-off-by: Aradhya Bhatia <a-bhatia1@ti.com> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> --- Notes: changes from v6: * Add Neil Armstrong's R-b tag. drivers/gpu/drm/bridge/sii902x.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
Comments
Hi Aradhya, On Tue, Jun 06, 2023 at 01:51:39PM +0530, Aradhya Bhatia wrote: > With new connector model, sii902x will not create the connector, when > DRM_BRIDGE_ATTACH_NO_CONNECTOR is set and SoC driver will rely on format > negotiation to setup the encoder format. > > Support format negotiations hooks in the drm_bridge_funcs. > Use helper functions for state management. > > Input format is selected to MEDIA_BUS_FMT_RGB888_1X24 as default, as is > the case with older model. > > Signed-off-by: Aradhya Bhatia <a-bhatia1@ti.com> > Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> As noted by Javier, this patch-set was forgotten, so sorry for not providing timely feedback. > --- > > Notes: > > changes from v6: > * Add Neil Armstrong's R-b tag. > > drivers/gpu/drm/bridge/sii902x.c | 25 +++++++++++++++++++++++++ > 1 file changed, 25 insertions(+) > > diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c > index ef66461e7f7c..70aeb04b7f77 100644 > --- a/drivers/gpu/drm/bridge/sii902x.c > +++ b/drivers/gpu/drm/bridge/sii902x.c > @@ -473,6 +473,27 @@ static struct edid *sii902x_bridge_get_edid(struct drm_bridge *bridge, > return sii902x_get_edid(sii902x, connector); > } > > +static u32 *sii902x_bridge_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(1, sizeof(*input_fmts), GFP_KERNEL); > + if (!input_fmts) > + return NULL; > + > + input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24; > + *num_input_fmts = 1; > + > + return input_fmts; > +} An alternative implementation of the above is: { switch (output_fmt) { case MEDIA_BUS_FMT_RGB888_1X24: break; default: /* Fail for any other formats */ *num_input_fmts = 0; return NULL; } return drm_atomic_helper_bridge_propagate_bus_fmt(bridge, bridge_state, crtc_state, conn_state, output_fmt, num_input_fmts); } If you agree and have the time to do it it would be nice to use this simpler variant. Mostly so we avoid more open coded variants like you already did, and which we have plenty of already. It would be even better to walk through other implementations of get_input_bus_fmts and update them accordingly. Again, sorry for being late here. Feel free to ignore if you already moved on with something else. Sam
Hi Sam, On 10-Jul-23 20:38, Sam Ravnborg wrote: > Hi Aradhya, > > On Tue, Jun 06, 2023 at 01:51:39PM +0530, Aradhya Bhatia wrote: >> With new connector model, sii902x will not create the connector, when >> DRM_BRIDGE_ATTACH_NO_CONNECTOR is set and SoC driver will rely on format >> negotiation to setup the encoder format. >> >> Support format negotiations hooks in the drm_bridge_funcs. >> Use helper functions for state management. >> >> Input format is selected to MEDIA_BUS_FMT_RGB888_1X24 as default, as is >> the case with older model. >> >> Signed-off-by: Aradhya Bhatia <a-bhatia1@ti.com> >> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> > > As noted by Javier, this patch-set was forgotten, so sorry for not > providing timely feedback. Thank you for reviewing my patch nevertheless! =) > > >> --- >> >> Notes: >> >> changes from v6: >> * Add Neil Armstrong's R-b tag. >> >> drivers/gpu/drm/bridge/sii902x.c | 25 +++++++++++++++++++++++++ >> 1 file changed, 25 insertions(+) >> >> diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c >> index ef66461e7f7c..70aeb04b7f77 100644 >> --- a/drivers/gpu/drm/bridge/sii902x.c >> +++ b/drivers/gpu/drm/bridge/sii902x.c >> @@ -473,6 +473,27 @@ static struct edid *sii902x_bridge_get_edid(struct drm_bridge *bridge, >> return sii902x_get_edid(sii902x, connector); >> } >> >> +static u32 *sii902x_bridge_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(1, sizeof(*input_fmts), GFP_KERNEL); >> + if (!input_fmts) >> + return NULL; >> + >> + input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24; >> + *num_input_fmts = 1; >> + >> + return input_fmts; >> +} > > An alternative implementation of the above is: > { > switch (output_fmt) { > case MEDIA_BUS_FMT_RGB888_1X24: > break; > > default: > /* Fail for any other formats */ > *num_input_fmts = 0; > return NULL; > } > > return drm_atomic_helper_bridge_propagate_bus_fmt(bridge, bridge_state, > crtc_state, conn_state, > output_fmt, > num_input_fmts); > } > > If you agree and have the time to do it it would be nice to use this > simpler variant. > Mostly so we avoid more open coded variants like you already did, and > which we have plenty of already. I agree with the idea that these hooks should get streamlined. However, this particular approach will break things when the output_fmt is defaulted to MEDIA_BUS_FMT_FIXED. Even if we add this format as a fall-through case along with MEDIA_BUS_FMT_RGB888_1X24, tidss driver will too then receive MEDIA_BUS_FMT_FIXED as an expected output format and will throw an error. The possibility of an equivalent if-check was discussed in the previous version[1]. > > It would be even better to walk through other implementations of > get_input_bus_fmts and update them accordingly. > > Again, sorry for being late here. Feel free to ignore if you already > moved on with something else. > I am working on adding OLDI support for tidss, but if we can resolve the above concern, and Javier agrees, I will be happy to add an incremental fix for this! =) Regards Aradhya [1]: https://patchwork.freedesktop.org/patch/536008/?series=82765&rev=6
Aradhya Bhatia <a-bhatia1@ti.com> writes: Hello Aradhya, > Hi Sam, > [...] >> >> It would be even better to walk through other implementations of >> get_input_bus_fmts and update them accordingly. >> >> Again, sorry for being late here. Feel free to ignore if you already >> moved on with something else. >> > > I am working on adding OLDI support for tidss, but if we can resolve the > above concern, and Javier agrees, I will be happy to add an incremental > fix for this! =) > > Yes, an incremental patch on top of what has already been merged in drm-misc-next works. Thanks!
diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c index ef66461e7f7c..70aeb04b7f77 100644 --- a/drivers/gpu/drm/bridge/sii902x.c +++ b/drivers/gpu/drm/bridge/sii902x.c @@ -473,6 +473,27 @@ static struct edid *sii902x_bridge_get_edid(struct drm_bridge *bridge, return sii902x_get_edid(sii902x, connector); } +static u32 *sii902x_bridge_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(1, sizeof(*input_fmts), GFP_KERNEL); + if (!input_fmts) + return NULL; + + input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24; + *num_input_fmts = 1; + + return input_fmts; +} + static const struct drm_bridge_funcs sii902x_bridge_funcs = { .attach = sii902x_bridge_attach, .mode_set = sii902x_bridge_mode_set, @@ -480,6 +501,10 @@ static const struct drm_bridge_funcs sii902x_bridge_funcs = { .enable = sii902x_bridge_enable, .detect = sii902x_bridge_detect, .get_edid = sii902x_bridge_get_edid, + .atomic_reset = drm_atomic_helper_bridge_reset, + .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, + .atomic_get_input_bus_fmts = sii902x_bridge_atomic_get_input_bus_fmts, }; static int sii902x_mute(struct sii902x *sii902x, bool mute)