From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26967C4332F for ; Tue, 15 Nov 2022 09:21:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229698AbiKOJVL (ORCPT ); Tue, 15 Nov 2022 04:21:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229455AbiKOJVK (ORCPT ); Tue, 15 Nov 2022 04:21:10 -0500 Received: from mail-il1-x134.google.com (mail-il1-x134.google.com [IPv6:2607:f8b0:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 587EC1F4 for ; Tue, 15 Nov 2022 01:21:08 -0800 (PST) Received: by mail-il1-x134.google.com with SMTP id i5so7081425ilc.12 for ; Tue, 15 Nov 2022 01:21:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=eTHlNx224MYgFGEKj1x0yVtfV7nyotfOs7IW/rNlccw=; b=AcKggX/DTb0H6fGM1GpPvvhxRgDRGi65XhhzCvvsKzwSKXA+Asuy2L2lcpXuWwMxVh dt7mKVqoeSitG6PX0oJ3Gao69lZtzU7/HdnUO3AflrEXnXXzulVjsbWHMvCJ/6hfd37t d96Pi5zSwqQ+JJL6oP3pB1vc4vd7GsXw78Ifw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eTHlNx224MYgFGEKj1x0yVtfV7nyotfOs7IW/rNlccw=; b=WfE2H2P1ZcOwkq8OaEj3wPikGKJopkBJ2XG9N7IBe8M4XhRH0ECnUM/tTIZeDwOtAW ltH09prwhqThy2LuTmQW5hXA2VUw9/VGn0ltRONRckaaLANgyeGZrATj6aJg5BeglGt8 jh7aXU8nNTrAFMah+pgky3LwKXykvgztiuw+mn1hoQFpM0dWZZzytNgUvap8AUgk1CLi Jr3S4qm5yziUQDEuQsh7sxbOupjpjDIubX/fpvMzk/RVUapOQ9IbFH0pqq4WqXaf05QQ EFQKaYGRNVyZVzKSH+hl/2ks51kDqGu6lGJFLg9JqAYNDbzqbdxucOKCZOFeWxeYi5JP ttlA== X-Gm-Message-State: ANoB5pmMFDqJ1q/7qJyypzHwxai54nrsGs4WZRDpMtqVT0pyUtn7sKRB lnad0WZ8n0D2r9IXJ4MCDPTdicpH51Bb3cZTtJc0kQ== X-Google-Smtp-Source: AA0mqf6NRX7+7kBngydA9jwxOk2aRKtJ5TZV3B8MNwAMo0KnJAUqd8O6aVaN2Ppz4Jc+6fAkUu9AFxwhd8D2/ysv30Q= X-Received: by 2002:a92:ce8f:0:b0:300:c63a:796c with SMTP id r15-20020a92ce8f000000b00300c63a796cmr7460695ilo.43.1668504067612; Tue, 15 Nov 2022 01:21:07 -0800 (PST) MIME-Version: 1.0 References: <20221110183853.3678209-1-jagan@amarulasolutions.com> <20221110183853.3678209-10-jagan@amarulasolutions.com> <56cab7d0-d9fb-d890-0b1c-678980eafd9c@samsung.com> <928ec100-83c0-cbfe-8005-ccf872538999@samsung.com> <4f9dd1bd-a5c8-c14a-fabd-bcc53406a4a9@kontron.de> In-Reply-To: <4f9dd1bd-a5c8-c14a-fabd-bcc53406a4a9@kontron.de> From: Jagan Teki Date: Tue, 15 Nov 2022 14:50:56 +0530 Message-ID: Subject: Re: [PATCH v8 09/14] drm: bridge: samsung-dsim: Add atomic_get_input_bus_fmts To: Frieder Schrempf , Marek Szyprowski , Marek Vasut Cc: Andrzej Hajda , Inki Dae , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , Fancy Fang , Tim Harvey , Michael Nazzareno Trimarchi , Adam Ford , Neil Armstrong , Robert Foss , Laurent Pinchart , Tommaso Merciai , Matteo Lisi , dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, NXP Linux Team , linux-amarula Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org On Tue, Nov 15, 2022 at 2:18 PM Frieder Schrempf wrote: > > On 15.11.22 09:09, Marek Szyprowski wrote: > > Hi Jagan, > > > > On 14.11.2022 18:07, Jagan Teki wrote: > >> On Mon, Nov 14, 2022 at 8:10 PM Marek Szyprowski > >> wrote: > >>> On 14.11.2022 11:57, Marek Szyprowski wrote: > >>>> On 10.11.2022 19:38, Jagan Teki wrote: > >>>>> Finding the right input bus format throughout the pipeline is hard > >>>>> so add atomic_get_input_bus_fmts callback and initialize with the > >>>>> proper input format from list of supported output formats. > >>>>> > >>>>> This format can be used in pipeline for negotiating bus format betw= een > >>>>> the DSI-end of this bridge and the other component closer to pipeli= ne > >>>>> components. > >>>>> > >>>>> List of Pixel formats are taken from, > >>>>> AN13573 i.MX 8/RT MIPI DSI/CSI-2, Rev. 0, 21 March 2022 > >>>>> 3.7.4 Pixel formats > >>>>> Table 14. DSI pixel packing formats > >>>>> > >>>>> v8: > >>>>> * added pixel formats supported by NXP AN13573 i.MX 8/RT MIPI DSI/C= SI-2 > >>>>> > >>>>> v7, v6, v5, v4: > >>>>> * none > >>>>> > >>>>> v3: > >>>>> * include media-bus-format.h > >>>>> > >>>>> v2: > >>>>> * none > >>>>> > >>>>> v1: > >>>>> * new patch > >>>>> > >>>>> Signed-off-by: Jagan Teki > >>>>> --- > >>>>> drivers/gpu/drm/bridge/samsung-dsim.c | 53 +++++++++++++++++++++= ++++++ > >>>>> 1 file changed, 53 insertions(+) > >>>>> > >>>>> diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c > >>>>> b/drivers/gpu/drm/bridge/samsung-dsim.c > >>>>> index 0fe153b29e4f..33e5ae9c865f 100644 > >>>>> --- a/drivers/gpu/drm/bridge/samsung-dsim.c > >>>>> +++ b/drivers/gpu/drm/bridge/samsung-dsim.c > >>>>> @@ -15,6 +15,7 @@ > >>>>> #include > >>>>> #include > >>>>> #include > >>>>> +#include > >>>>> #include > >>>>> #include > >>>>> @@ -1321,6 +1322,57 @@ static void > >>>>> samsung_dsim_atomic_post_disable(struct drm_bridge *bridge, > >>>>> pm_runtime_put_sync(dsi->dev); > >>>>> } > >>>>> +/* > >>>>> + * This pixel output formats list referenced from, > >>>>> + * AN13573 i.MX 8/RT MIPI DSI/CSI-2, Rev. 0, 21 March 2022 > >>>>> + * 3.7.4 Pixel formats > >>>>> + * Table 14. DSI pixel packing formats > >>>>> + */ > >>>>> +static const u32 samsung_dsim_pixel_output_fmts[] =3D { > >>>>> + MEDIA_BUS_FMT_UYVY8_1X16, > >>>>> + MEDIA_BUS_FMT_RGB101010_1X30, > >>>>> + MEDIA_BUS_FMT_RGB121212_1X36, > >>>>> + MEDIA_BUS_FMT_RGB565_1X16, > >>>>> + MEDIA_BUS_FMT_RGB666_1X18, > >>>>> + MEDIA_BUS_FMT_RGB888_1X24, > >>>>> +}; > >>>>> + > >>>>> +static bool samsung_dsim_pixel_output_fmt_supported(u32 fmt) > >>>>> +{ > >>>>> + int i; > >>>>> + > >>>>> + for (i =3D 0; i < ARRAY_SIZE(samsung_dsim_pixel_output_fmts); = i++) { > >>>>> + if (samsung_dsim_pixel_output_fmts[i] =3D=3D fmt) > >>>>> + return true; > >>>>> + } > >>>>> + > >>>>> + return false; > >>>>> +} > >>>>> + > >>>>> +static u32 * > >>>>> +samsung_dsim_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; > >>>>> + > >>>>> + if (!samsung_dsim_pixel_output_fmt_supported(output_fmt)) > >>>>> + return NULL; > >>>> > >>>> Please add support for MEDIA_BUS_FMT_FIXED and maybe default to > >>>> MEDIA_BUS_FMT_RGB888_1X24 if requested format is not matched. > >>>> > >>>> Otherwise the above check breaks all current clients of the Samsung > >>>> DSIM/Exynos DSI. I didn't dig into the bus matching code yet, but al= l > >>>> DSI panels requests such format on my test systems... > >>> I've checked a bit more the bus format related code and it looks that > >>> there are more issues. The DSI panels don't use the MEDIA_BUS_FMT_* > >>> formats thus the bridge negotiation code selects MEDIA_BUS_FMT_FIXED = for > >>> them. On Arndale board with Toshiba tc358764 bridge the > >>> MEDIA_BUS_FMT_RGB888_1X7X4_SPWG output_fmt is requested in > >>> samsung_dsim_atomic_get_input_bus_fmts() (forwarded from the LVDS pan= el, > >> dsim =3D> tc358764 =3D> panel-simple > >> > >> If I understand the bridge format negotiation correctly - If > >> atomic_get_input_bus_fmts is not implemented in tc358764 then > >> MEDIA_BUS_FMT_FIXED will be the output_fmt for dsim so we can assign > >> MEDIA_BUS_FMT_RGB888_1X24 for FIXED formats. > >> > >> from include/drm/drm_bridge.h: > >> > >> * This method is called on all elements of the bridge chain = as part of > >> * the bus format negotiation process that happens in > >> * drm_atomic_bridge_chain_select_bus_fmts(). > >> * This method is optional. When not implemented, the core wi= ll bypass > >> * bus format negotiation on this element of the bridge witho= ut > >> * failing, and the previous element in the chain will be pas= sed > >> * MEDIA_BUS_FMT_FIXED as its output bus format. > >> > >> As I can see tc358764 is not implemented either > >> atomic_get_input_bus_fmts or atomic API, so I think dsim gets the > >> MEDIA_BUS_FMT_FIXED bridge pipeline. I have tested sn65dsi without > >> atomic_get_input_bus_fmts I can see the dsim is getting > >> MEDIA_BUS_FMT_FIXED. > >> > >> Can you check the same from your side? > > > > Here in case of Arndale 5250 with the following pipeline: > > > > dsim =3D> tc358764 =3D> panel-simple (boe,hv070wsa-100 panel) > > > > the DRM core requests MEDIA_BUS_FMT_RGB888_1X7X4_SPWG format, taken fro= m the boe_hv070wsa panel (see from drivers/gpu/drm/panel/panel-simple.c). P= lease note that in case of Exynos, the reversed bridge chain order is used = for dsim, so this is another nasty consequence of that hack. :/ > > > > Maybe if no compatible bus format is found, the driver should force > > MEDIA_BUS_FMT_RGB888_1X24 until a proper format negotiation is > > implemented and hacks removed? > > For this specific case, wouldn't it be better to just fix the format > negotiation for tc358764 using atomic_get_input_bus_fmts()? It should > probably do the same as sn65dsi83 and request MEDIA_BUS_FMT_RGB888_1X24 > from the DSI. > > Forwarding the LVDS-specific format to the input is obviously the wrong > thing for the tc358764 driver to do. > > But I agree, if there are other problematic pipelines with other > bridge/display drivers that don't pass a correct format, we should > accept them for now and fall back to a sane default > (MEDIA_BUS_FMT_RGB888_1X24) and fix the other drivers afterwards. > > Let's not delay this series any further and better work on how to get it > merged before we miss another merge window. Agreed this point, here is the updated diff (on top of this patch) for falling back to the default format for those. +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -1387,6 +1387,8 @@ static const u32 samsung_dsim_pixel_output_fmts[] =3D= { MEDIA_BUS_FMT_RGB565_1X16, MEDIA_BUS_FMT_RGB666_1X18, MEDIA_BUS_FMT_RGB888_1X24, + + MEDIA_BUS_FMT_FIXED, }; static bool samsung_dsim_pixel_output_fmt_supported(u32 fmt) @@ -1412,7 +1414,13 @@ samsung_dsim_atomic_get_input_bus_fmts(struct drm_bridge *bridge, u32 *input_fmts; if (!samsung_dsim_pixel_output_fmt_supported(output_fmt)) - return NULL; + /* + * Some bridge/display drivers are still not able to pass + * the correct format, so handle those pipelines by falling + * back to the default format till the supported format lis= t + * gets finalized. + */ + output_fmt =3D MEDIA_BUS_FMT_RGB888_1X24; *num_input_fmts =3D 1; @@ -1420,7 +1428,14 @@ samsung_dsim_atomic_get_input_bus_fmts(struct drm_bridge *bridge, if (!input_fmts) return NULL; - input_fmts[0] =3D output_fmt; + switch (output_fmt) { + case MEDIA_BUS_FMT_FIXED: + input_fmts[0] =3D MEDIA_BUS_FMT_RGB888_1X24; + break; + default: + input_fmts[0] =3D output_fmt; + break; + } return input_fmts; If all is okay, I will send v9 which would probably test it for the final version to merge. Thanks, Jagan. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8B5A0C43217 for ; Tue, 15 Nov 2022 09:21:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C54C610E387; Tue, 15 Nov 2022 09:21:12 +0000 (UTC) Received: from mail-il1-x134.google.com (mail-il1-x134.google.com [IPv6:2607:f8b0:4864:20::134]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7812810E387 for ; Tue, 15 Nov 2022 09:21:08 +0000 (UTC) Received: by mail-il1-x134.google.com with SMTP id d3so7123866ils.1 for ; Tue, 15 Nov 2022 01:21:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=eTHlNx224MYgFGEKj1x0yVtfV7nyotfOs7IW/rNlccw=; b=AcKggX/DTb0H6fGM1GpPvvhxRgDRGi65XhhzCvvsKzwSKXA+Asuy2L2lcpXuWwMxVh dt7mKVqoeSitG6PX0oJ3Gao69lZtzU7/HdnUO3AflrEXnXXzulVjsbWHMvCJ/6hfd37t d96Pi5zSwqQ+JJL6oP3pB1vc4vd7GsXw78Ifw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eTHlNx224MYgFGEKj1x0yVtfV7nyotfOs7IW/rNlccw=; b=FwQ/eU+yXnNW5QS8U7HvZWbN7o2fxPC6Wujw76au86DKQBd2lcRgz6oHyDWvV5gyFb SyNRHRDzsKA4272n2ofQqo5kBFnJtSlYBnMHvUCcRGV7eN3oKA2/aHxIUDIJgBt4FO9m lY1G7jH3etAEmrPQngmGBD8KKxhGb82f1R4KgSuoAYel4TJ+MbePE+PPFdcHe2HS8EbT cFfD/uNdL6q/8ofvzJ7MNecIpKAyq/l1BhhUorfSSC3xqsBAstrP0RIg/MKACws+oIzP kvuApFvN3QZ3J+/ZHKpLuQhjpIF9/ipfNP4ZK/c8UvFFhrbwmP1eV87B2OqCGzrnHTNP adSA== X-Gm-Message-State: ANoB5pl+RfC1P0omuDP+q6IPwbr1blT+xE6HUc6pXChwFZJKUjVhwvoA N2cHczxyy4IMt+et5S7Z9rUIPIde4e2evMQGbXM5+Q== X-Google-Smtp-Source: AA0mqf6NRX7+7kBngydA9jwxOk2aRKtJ5TZV3B8MNwAMo0KnJAUqd8O6aVaN2Ppz4Jc+6fAkUu9AFxwhd8D2/ysv30Q= X-Received: by 2002:a92:ce8f:0:b0:300:c63a:796c with SMTP id r15-20020a92ce8f000000b00300c63a796cmr7460695ilo.43.1668504067612; Tue, 15 Nov 2022 01:21:07 -0800 (PST) MIME-Version: 1.0 References: <20221110183853.3678209-1-jagan@amarulasolutions.com> <20221110183853.3678209-10-jagan@amarulasolutions.com> <56cab7d0-d9fb-d890-0b1c-678980eafd9c@samsung.com> <928ec100-83c0-cbfe-8005-ccf872538999@samsung.com> <4f9dd1bd-a5c8-c14a-fabd-bcc53406a4a9@kontron.de> In-Reply-To: <4f9dd1bd-a5c8-c14a-fabd-bcc53406a4a9@kontron.de> From: Jagan Teki Date: Tue, 15 Nov 2022 14:50:56 +0530 Message-ID: Subject: Re: [PATCH v8 09/14] drm: bridge: samsung-dsim: Add atomic_get_input_bus_fmts To: Frieder Schrempf , Marek Szyprowski , Marek Vasut Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, Joonyoung Shim , Tommaso Merciai , linux-amarula , Seung-Woo Kim , Neil Armstrong , Robert Foss , Kyungmin Park , Laurent Pinchart , Andrzej Hajda , NXP Linux Team , Fancy Fang , Michael Nazzareno Trimarchi , Adam Ford , linux-arm-kernel@lists.infradead.org, Matteo Lisi Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Tue, Nov 15, 2022 at 2:18 PM Frieder Schrempf wrote: > > On 15.11.22 09:09, Marek Szyprowski wrote: > > Hi Jagan, > > > > On 14.11.2022 18:07, Jagan Teki wrote: > >> On Mon, Nov 14, 2022 at 8:10 PM Marek Szyprowski > >> wrote: > >>> On 14.11.2022 11:57, Marek Szyprowski wrote: > >>>> On 10.11.2022 19:38, Jagan Teki wrote: > >>>>> Finding the right input bus format throughout the pipeline is hard > >>>>> so add atomic_get_input_bus_fmts callback and initialize with the > >>>>> proper input format from list of supported output formats. > >>>>> > >>>>> This format can be used in pipeline for negotiating bus format betw= een > >>>>> the DSI-end of this bridge and the other component closer to pipeli= ne > >>>>> components. > >>>>> > >>>>> List of Pixel formats are taken from, > >>>>> AN13573 i.MX 8/RT MIPI DSI/CSI-2, Rev. 0, 21 March 2022 > >>>>> 3.7.4 Pixel formats > >>>>> Table 14. DSI pixel packing formats > >>>>> > >>>>> v8: > >>>>> * added pixel formats supported by NXP AN13573 i.MX 8/RT MIPI DSI/C= SI-2 > >>>>> > >>>>> v7, v6, v5, v4: > >>>>> * none > >>>>> > >>>>> v3: > >>>>> * include media-bus-format.h > >>>>> > >>>>> v2: > >>>>> * none > >>>>> > >>>>> v1: > >>>>> * new patch > >>>>> > >>>>> Signed-off-by: Jagan Teki > >>>>> --- > >>>>> drivers/gpu/drm/bridge/samsung-dsim.c | 53 +++++++++++++++++++++= ++++++ > >>>>> 1 file changed, 53 insertions(+) > >>>>> > >>>>> diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c > >>>>> b/drivers/gpu/drm/bridge/samsung-dsim.c > >>>>> index 0fe153b29e4f..33e5ae9c865f 100644 > >>>>> --- a/drivers/gpu/drm/bridge/samsung-dsim.c > >>>>> +++ b/drivers/gpu/drm/bridge/samsung-dsim.c > >>>>> @@ -15,6 +15,7 @@ > >>>>> #include > >>>>> #include > >>>>> #include > >>>>> +#include > >>>>> #include > >>>>> #include > >>>>> @@ -1321,6 +1322,57 @@ static void > >>>>> samsung_dsim_atomic_post_disable(struct drm_bridge *bridge, > >>>>> pm_runtime_put_sync(dsi->dev); > >>>>> } > >>>>> +/* > >>>>> + * This pixel output formats list referenced from, > >>>>> + * AN13573 i.MX 8/RT MIPI DSI/CSI-2, Rev. 0, 21 March 2022 > >>>>> + * 3.7.4 Pixel formats > >>>>> + * Table 14. DSI pixel packing formats > >>>>> + */ > >>>>> +static const u32 samsung_dsim_pixel_output_fmts[] =3D { > >>>>> + MEDIA_BUS_FMT_UYVY8_1X16, > >>>>> + MEDIA_BUS_FMT_RGB101010_1X30, > >>>>> + MEDIA_BUS_FMT_RGB121212_1X36, > >>>>> + MEDIA_BUS_FMT_RGB565_1X16, > >>>>> + MEDIA_BUS_FMT_RGB666_1X18, > >>>>> + MEDIA_BUS_FMT_RGB888_1X24, > >>>>> +}; > >>>>> + > >>>>> +static bool samsung_dsim_pixel_output_fmt_supported(u32 fmt) > >>>>> +{ > >>>>> + int i; > >>>>> + > >>>>> + for (i =3D 0; i < ARRAY_SIZE(samsung_dsim_pixel_output_fmts); = i++) { > >>>>> + if (samsung_dsim_pixel_output_fmts[i] =3D=3D fmt) > >>>>> + return true; > >>>>> + } > >>>>> + > >>>>> + return false; > >>>>> +} > >>>>> + > >>>>> +static u32 * > >>>>> +samsung_dsim_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; > >>>>> + > >>>>> + if (!samsung_dsim_pixel_output_fmt_supported(output_fmt)) > >>>>> + return NULL; > >>>> > >>>> Please add support for MEDIA_BUS_FMT_FIXED and maybe default to > >>>> MEDIA_BUS_FMT_RGB888_1X24 if requested format is not matched. > >>>> > >>>> Otherwise the above check breaks all current clients of the Samsung > >>>> DSIM/Exynos DSI. I didn't dig into the bus matching code yet, but al= l > >>>> DSI panels requests such format on my test systems... > >>> I've checked a bit more the bus format related code and it looks that > >>> there are more issues. The DSI panels don't use the MEDIA_BUS_FMT_* > >>> formats thus the bridge negotiation code selects MEDIA_BUS_FMT_FIXED = for > >>> them. On Arndale board with Toshiba tc358764 bridge the > >>> MEDIA_BUS_FMT_RGB888_1X7X4_SPWG output_fmt is requested in > >>> samsung_dsim_atomic_get_input_bus_fmts() (forwarded from the LVDS pan= el, > >> dsim =3D> tc358764 =3D> panel-simple > >> > >> If I understand the bridge format negotiation correctly - If > >> atomic_get_input_bus_fmts is not implemented in tc358764 then > >> MEDIA_BUS_FMT_FIXED will be the output_fmt for dsim so we can assign > >> MEDIA_BUS_FMT_RGB888_1X24 for FIXED formats. > >> > >> from include/drm/drm_bridge.h: > >> > >> * This method is called on all elements of the bridge chain = as part of > >> * the bus format negotiation process that happens in > >> * drm_atomic_bridge_chain_select_bus_fmts(). > >> * This method is optional. When not implemented, the core wi= ll bypass > >> * bus format negotiation on this element of the bridge witho= ut > >> * failing, and the previous element in the chain will be pas= sed > >> * MEDIA_BUS_FMT_FIXED as its output bus format. > >> > >> As I can see tc358764 is not implemented either > >> atomic_get_input_bus_fmts or atomic API, so I think dsim gets the > >> MEDIA_BUS_FMT_FIXED bridge pipeline. I have tested sn65dsi without > >> atomic_get_input_bus_fmts I can see the dsim is getting > >> MEDIA_BUS_FMT_FIXED. > >> > >> Can you check the same from your side? > > > > Here in case of Arndale 5250 with the following pipeline: > > > > dsim =3D> tc358764 =3D> panel-simple (boe,hv070wsa-100 panel) > > > > the DRM core requests MEDIA_BUS_FMT_RGB888_1X7X4_SPWG format, taken fro= m the boe_hv070wsa panel (see from drivers/gpu/drm/panel/panel-simple.c). P= lease note that in case of Exynos, the reversed bridge chain order is used = for dsim, so this is another nasty consequence of that hack. :/ > > > > Maybe if no compatible bus format is found, the driver should force > > MEDIA_BUS_FMT_RGB888_1X24 until a proper format negotiation is > > implemented and hacks removed? > > For this specific case, wouldn't it be better to just fix the format > negotiation for tc358764 using atomic_get_input_bus_fmts()? It should > probably do the same as sn65dsi83 and request MEDIA_BUS_FMT_RGB888_1X24 > from the DSI. > > Forwarding the LVDS-specific format to the input is obviously the wrong > thing for the tc358764 driver to do. > > But I agree, if there are other problematic pipelines with other > bridge/display drivers that don't pass a correct format, we should > accept them for now and fall back to a sane default > (MEDIA_BUS_FMT_RGB888_1X24) and fix the other drivers afterwards. > > Let's not delay this series any further and better work on how to get it > merged before we miss another merge window. Agreed this point, here is the updated diff (on top of this patch) for falling back to the default format for those. +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -1387,6 +1387,8 @@ static const u32 samsung_dsim_pixel_output_fmts[] =3D= { MEDIA_BUS_FMT_RGB565_1X16, MEDIA_BUS_FMT_RGB666_1X18, MEDIA_BUS_FMT_RGB888_1X24, + + MEDIA_BUS_FMT_FIXED, }; static bool samsung_dsim_pixel_output_fmt_supported(u32 fmt) @@ -1412,7 +1414,13 @@ samsung_dsim_atomic_get_input_bus_fmts(struct drm_bridge *bridge, u32 *input_fmts; if (!samsung_dsim_pixel_output_fmt_supported(output_fmt)) - return NULL; + /* + * Some bridge/display drivers are still not able to pass + * the correct format, so handle those pipelines by falling + * back to the default format till the supported format lis= t + * gets finalized. + */ + output_fmt =3D MEDIA_BUS_FMT_RGB888_1X24; *num_input_fmts =3D 1; @@ -1420,7 +1428,14 @@ samsung_dsim_atomic_get_input_bus_fmts(struct drm_bridge *bridge, if (!input_fmts) return NULL; - input_fmts[0] =3D output_fmt; + switch (output_fmt) { + case MEDIA_BUS_FMT_FIXED: + input_fmts[0] =3D MEDIA_BUS_FMT_RGB888_1X24; + break; + default: + input_fmts[0] =3D output_fmt; + break; + } return input_fmts; If all is okay, I will send v9 which would probably test it for the final version to merge. Thanks, Jagan. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BBE23C433FE for ; Tue, 15 Nov 2022 09:24:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=27BBij5UmrCodOHt+O60pHYl+W3NBb1litoRX16hWog=; b=XwWenxlm+NWVLe p4gMfMp9S1jbfF31FxI8F3gQ5EXTLRftfs51Q7/aK2yZP269QSVc1wO8Ykf08K609OvuiJ7TILDty io95BnnCwb/OXLHQ9qVERSzbZ2kAXF/vqjO7Vbcx3wRYcdYiWcuHSFPRwdGVTNw7bMsq6UFbglGOY Ru7rU1xGluIUGbHQzQzJYs9mdxiOWWcs1yO1LhkraXlIGxMmye03NVUnEMUe4i7bb/Bm+GpBU+0GY 1sT57IOiznqfeKSja8n9bJhqHZfEXCg2hm9rTBcDaC3EoPWG/plNZlt/wZqgbpY/hjPVDYuxoObbZ VN6FCuAtDpLZwmc8aw1Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ous9i-009KFO-Aj; Tue, 15 Nov 2022 09:22:58 +0000 Received: from mail-il1-x133.google.com ([2607:f8b0:4864:20::133]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ous7z-009ItS-HU for linux-arm-kernel@lists.infradead.org; Tue, 15 Nov 2022 09:21:13 +0000 Received: by mail-il1-x133.google.com with SMTP id x16so7097806ilm.5 for ; Tue, 15 Nov 2022 01:21:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=eTHlNx224MYgFGEKj1x0yVtfV7nyotfOs7IW/rNlccw=; b=AcKggX/DTb0H6fGM1GpPvvhxRgDRGi65XhhzCvvsKzwSKXA+Asuy2L2lcpXuWwMxVh dt7mKVqoeSitG6PX0oJ3Gao69lZtzU7/HdnUO3AflrEXnXXzulVjsbWHMvCJ/6hfd37t d96Pi5zSwqQ+JJL6oP3pB1vc4vd7GsXw78Ifw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eTHlNx224MYgFGEKj1x0yVtfV7nyotfOs7IW/rNlccw=; b=wwDYWWdoIiy6GGgpz/kb2mOqGnB2/H9wzEf7uDb7n9bgKsWEWZSycjc9qXmKJuST/S 1V7rdGkJUD4hIN03Lm115itCgjvXNAM0pjRTJFDtStFjR/zDAj4KlcGGa40mYOhw+l3K Aay4yTV6YL8r3EO5r8MhTjsbHjevfrJtdtJqDmMnGKitPSJrqs/GRLmrPV28GHaKtQ2r 6F7Ehzh9KmredWvk6wA8gBTH73VIuBvtfLSfs76MQr+DvbGwxsecFeDYgkp8czfJ6AWo g/ONk9lzF6IkY0vxxn80e3bUN7rA58hXzv0pvtGzpuua9pH63U1WslXLvN163oTNCEmL ++QQ== X-Gm-Message-State: ANoB5pnmMDRM1Q7G2/djFoRdeyFhUyABYhP/85e0M8gmAUyyyVX0oIwi lnztgjBDHqigkDVvBWZGlT4oTCwIfc3ZljnkdwFkiA== X-Google-Smtp-Source: AA0mqf6NRX7+7kBngydA9jwxOk2aRKtJ5TZV3B8MNwAMo0KnJAUqd8O6aVaN2Ppz4Jc+6fAkUu9AFxwhd8D2/ysv30Q= X-Received: by 2002:a92:ce8f:0:b0:300:c63a:796c with SMTP id r15-20020a92ce8f000000b00300c63a796cmr7460695ilo.43.1668504067612; Tue, 15 Nov 2022 01:21:07 -0800 (PST) MIME-Version: 1.0 References: <20221110183853.3678209-1-jagan@amarulasolutions.com> <20221110183853.3678209-10-jagan@amarulasolutions.com> <56cab7d0-d9fb-d890-0b1c-678980eafd9c@samsung.com> <928ec100-83c0-cbfe-8005-ccf872538999@samsung.com> <4f9dd1bd-a5c8-c14a-fabd-bcc53406a4a9@kontron.de> In-Reply-To: <4f9dd1bd-a5c8-c14a-fabd-bcc53406a4a9@kontron.de> From: Jagan Teki Date: Tue, 15 Nov 2022 14:50:56 +0530 Message-ID: Subject: Re: [PATCH v8 09/14] drm: bridge: samsung-dsim: Add atomic_get_input_bus_fmts To: Frieder Schrempf , Marek Szyprowski , Marek Vasut Cc: Andrzej Hajda , Inki Dae , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , Fancy Fang , Tim Harvey , Michael Nazzareno Trimarchi , Adam Ford , Neil Armstrong , Robert Foss , Laurent Pinchart , Tommaso Merciai , Matteo Lisi , dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, NXP Linux Team , linux-amarula X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221115_012111_646100_0ABBF0AE X-CRM114-Status: GOOD ( 49.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Nov 15, 2022 at 2:18 PM Frieder Schrempf wrote: > > On 15.11.22 09:09, Marek Szyprowski wrote: > > Hi Jagan, > > > > On 14.11.2022 18:07, Jagan Teki wrote: > >> On Mon, Nov 14, 2022 at 8:10 PM Marek Szyprowski > >> wrote: > >>> On 14.11.2022 11:57, Marek Szyprowski wrote: > >>>> On 10.11.2022 19:38, Jagan Teki wrote: > >>>>> Finding the right input bus format throughout the pipeline is hard > >>>>> so add atomic_get_input_bus_fmts callback and initialize with the > >>>>> proper input format from list of supported output formats. > >>>>> > >>>>> This format can be used in pipeline for negotiating bus format between > >>>>> the DSI-end of this bridge and the other component closer to pipeline > >>>>> components. > >>>>> > >>>>> List of Pixel formats are taken from, > >>>>> AN13573 i.MX 8/RT MIPI DSI/CSI-2, Rev. 0, 21 March 2022 > >>>>> 3.7.4 Pixel formats > >>>>> Table 14. DSI pixel packing formats > >>>>> > >>>>> v8: > >>>>> * added pixel formats supported by NXP AN13573 i.MX 8/RT MIPI DSI/CSI-2 > >>>>> > >>>>> v7, v6, v5, v4: > >>>>> * none > >>>>> > >>>>> v3: > >>>>> * include media-bus-format.h > >>>>> > >>>>> v2: > >>>>> * none > >>>>> > >>>>> v1: > >>>>> * new patch > >>>>> > >>>>> Signed-off-by: Jagan Teki > >>>>> --- > >>>>> drivers/gpu/drm/bridge/samsung-dsim.c | 53 +++++++++++++++++++++++++++ > >>>>> 1 file changed, 53 insertions(+) > >>>>> > >>>>> diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c > >>>>> b/drivers/gpu/drm/bridge/samsung-dsim.c > >>>>> index 0fe153b29e4f..33e5ae9c865f 100644 > >>>>> --- a/drivers/gpu/drm/bridge/samsung-dsim.c > >>>>> +++ b/drivers/gpu/drm/bridge/samsung-dsim.c > >>>>> @@ -15,6 +15,7 @@ > >>>>> #include > >>>>> #include > >>>>> #include > >>>>> +#include > >>>>> #include > >>>>> #include > >>>>> @@ -1321,6 +1322,57 @@ static void > >>>>> samsung_dsim_atomic_post_disable(struct drm_bridge *bridge, > >>>>> pm_runtime_put_sync(dsi->dev); > >>>>> } > >>>>> +/* > >>>>> + * This pixel output formats list referenced from, > >>>>> + * AN13573 i.MX 8/RT MIPI DSI/CSI-2, Rev. 0, 21 March 2022 > >>>>> + * 3.7.4 Pixel formats > >>>>> + * Table 14. DSI pixel packing formats > >>>>> + */ > >>>>> +static const u32 samsung_dsim_pixel_output_fmts[] = { > >>>>> + MEDIA_BUS_FMT_UYVY8_1X16, > >>>>> + MEDIA_BUS_FMT_RGB101010_1X30, > >>>>> + MEDIA_BUS_FMT_RGB121212_1X36, > >>>>> + MEDIA_BUS_FMT_RGB565_1X16, > >>>>> + MEDIA_BUS_FMT_RGB666_1X18, > >>>>> + MEDIA_BUS_FMT_RGB888_1X24, > >>>>> +}; > >>>>> + > >>>>> +static bool samsung_dsim_pixel_output_fmt_supported(u32 fmt) > >>>>> +{ > >>>>> + int i; > >>>>> + > >>>>> + for (i = 0; i < ARRAY_SIZE(samsung_dsim_pixel_output_fmts); i++) { > >>>>> + if (samsung_dsim_pixel_output_fmts[i] == fmt) > >>>>> + return true; > >>>>> + } > >>>>> + > >>>>> + return false; > >>>>> +} > >>>>> + > >>>>> +static u32 * > >>>>> +samsung_dsim_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; > >>>>> + > >>>>> + if (!samsung_dsim_pixel_output_fmt_supported(output_fmt)) > >>>>> + return NULL; > >>>> > >>>> Please add support for MEDIA_BUS_FMT_FIXED and maybe default to > >>>> MEDIA_BUS_FMT_RGB888_1X24 if requested format is not matched. > >>>> > >>>> Otherwise the above check breaks all current clients of the Samsung > >>>> DSIM/Exynos DSI. I didn't dig into the bus matching code yet, but all > >>>> DSI panels requests such format on my test systems... > >>> I've checked a bit more the bus format related code and it looks that > >>> there are more issues. The DSI panels don't use the MEDIA_BUS_FMT_* > >>> formats thus the bridge negotiation code selects MEDIA_BUS_FMT_FIXED for > >>> them. On Arndale board with Toshiba tc358764 bridge the > >>> MEDIA_BUS_FMT_RGB888_1X7X4_SPWG output_fmt is requested in > >>> samsung_dsim_atomic_get_input_bus_fmts() (forwarded from the LVDS panel, > >> dsim => tc358764 => panel-simple > >> > >> If I understand the bridge format negotiation correctly - If > >> atomic_get_input_bus_fmts is not implemented in tc358764 then > >> MEDIA_BUS_FMT_FIXED will be the output_fmt for dsim so we can assign > >> MEDIA_BUS_FMT_RGB888_1X24 for FIXED formats. > >> > >> from include/drm/drm_bridge.h: > >> > >> * This method is called on all elements of the bridge chain as part of > >> * the bus format negotiation process that happens in > >> * drm_atomic_bridge_chain_select_bus_fmts(). > >> * This method is optional. When not implemented, the core will bypass > >> * bus format negotiation on this element of the bridge without > >> * failing, and the previous element in the chain will be passed > >> * MEDIA_BUS_FMT_FIXED as its output bus format. > >> > >> As I can see tc358764 is not implemented either > >> atomic_get_input_bus_fmts or atomic API, so I think dsim gets the > >> MEDIA_BUS_FMT_FIXED bridge pipeline. I have tested sn65dsi without > >> atomic_get_input_bus_fmts I can see the dsim is getting > >> MEDIA_BUS_FMT_FIXED. > >> > >> Can you check the same from your side? > > > > Here in case of Arndale 5250 with the following pipeline: > > > > dsim => tc358764 => panel-simple (boe,hv070wsa-100 panel) > > > > the DRM core requests MEDIA_BUS_FMT_RGB888_1X7X4_SPWG format, taken from the boe_hv070wsa panel (see from drivers/gpu/drm/panel/panel-simple.c). Please note that in case of Exynos, the reversed bridge chain order is used for dsim, so this is another nasty consequence of that hack. :/ > > > > Maybe if no compatible bus format is found, the driver should force > > MEDIA_BUS_FMT_RGB888_1X24 until a proper format negotiation is > > implemented and hacks removed? > > For this specific case, wouldn't it be better to just fix the format > negotiation for tc358764 using atomic_get_input_bus_fmts()? It should > probably do the same as sn65dsi83 and request MEDIA_BUS_FMT_RGB888_1X24 > from the DSI. > > Forwarding the LVDS-specific format to the input is obviously the wrong > thing for the tc358764 driver to do. > > But I agree, if there are other problematic pipelines with other > bridge/display drivers that don't pass a correct format, we should > accept them for now and fall back to a sane default > (MEDIA_BUS_FMT_RGB888_1X24) and fix the other drivers afterwards. > > Let's not delay this series any further and better work on how to get it > merged before we miss another merge window. Agreed this point, here is the updated diff (on top of this patch) for falling back to the default format for those. +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -1387,6 +1387,8 @@ static const u32 samsung_dsim_pixel_output_fmts[] = { MEDIA_BUS_FMT_RGB565_1X16, MEDIA_BUS_FMT_RGB666_1X18, MEDIA_BUS_FMT_RGB888_1X24, + + MEDIA_BUS_FMT_FIXED, }; static bool samsung_dsim_pixel_output_fmt_supported(u32 fmt) @@ -1412,7 +1414,13 @@ samsung_dsim_atomic_get_input_bus_fmts(struct drm_bridge *bridge, u32 *input_fmts; if (!samsung_dsim_pixel_output_fmt_supported(output_fmt)) - return NULL; + /* + * Some bridge/display drivers are still not able to pass + * the correct format, so handle those pipelines by falling + * back to the default format till the supported format list + * gets finalized. + */ + output_fmt = MEDIA_BUS_FMT_RGB888_1X24; *num_input_fmts = 1; @@ -1420,7 +1428,14 @@ samsung_dsim_atomic_get_input_bus_fmts(struct drm_bridge *bridge, if (!input_fmts) return NULL; - input_fmts[0] = output_fmt; + switch (output_fmt) { + case MEDIA_BUS_FMT_FIXED: + input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24; + break; + default: + input_fmts[0] = output_fmt; + break; + } return input_fmts; If all is okay, I will send v9 which would probably test it for the final version to merge. Thanks, Jagan. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel