From: Neil Armstrong <narmstrong@baylibre.com>
To: Boris Brezillon <boris.brezillon@collabora.com>
Cc: jernej.skrabec@siol.net, jonas@kwiboo.se,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
a.hajda@samsung.com, Laurent.pinchart@ideasonboard.com,
linux-amlogic@lists.infradead.org
Subject: Re: [PATCH v4 04/11] drm/bridge: synopsys: dw-hdmi: add bus format negociation
Date: Fri, 7 Feb 2020 14:36:38 +0100 [thread overview]
Message-ID: <ed11f2a3-2cc3-9d06-fcd8-886362a5ee36@baylibre.com> (raw)
In-Reply-To: <20200207120225.2ea76016@collabora.com>
On 07/02/2020 12:02, Boris Brezillon wrote:
> On Thu, 6 Feb 2020 20:18:27 +0100
> Neil Armstrong <narmstrong@baylibre.com> wrote:
>
>> Add the atomic_get_output_bus_fmts, atomic_get_input_bus_fmts to negociate
>
> ^ hooks?
>
>> the possible output and input formats for the current mode and monitor,
>> and use the negotiated formats in a basic atomic_check callback.
>>
>> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
>> ---
>
>> +
>> +/* Can return a maximum of 4 possible input formats for an output format */
>> +#define MAX_INPUT_SEL_FORMATS 4
>
> It seems to only be 3 in practice (based on the code) unless I missed
> something.
You're right...
>
>> +
>> +static u32 *dw_hdmi_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;
>> + int i = 0;
>> +
>> + *num_input_fmts = 0;
>> +
>> + input_fmts = kcalloc(MAX_INPUT_SEL_FORMATS, sizeof(*input_fmts),
>> + GFP_KERNEL);
>> + if (!input_fmts)
>> + return NULL;
>> +
>> + switch (output_fmt) {
>> + /* 8bit */
>> + case MEDIA_BUS_FMT_RGB888_1X24:
>> + input_fmts[i++] = MEDIA_BUS_FMT_RGB888_1X24;
>> + input_fmts[i++] = MEDIA_BUS_FMT_YUV8_1X24;
>> + input_fmts[i++] = MEDIA_BUS_FMT_UYVY8_1X16;
>> + break;
>> + case MEDIA_BUS_FMT_YUV8_1X24:
>> + input_fmts[i++] = MEDIA_BUS_FMT_YUV8_1X24;
>> + input_fmts[i++] = MEDIA_BUS_FMT_UYVY8_1X16;
>> + input_fmts[i++] = MEDIA_BUS_FMT_RGB888_1X24;
>> + break;
>> + case MEDIA_BUS_FMT_UYVY8_1X16:
>> + input_fmts[i++] = MEDIA_BUS_FMT_UYVY8_1X16;
>> + input_fmts[i++] = MEDIA_BUS_FMT_YUV8_1X24;
>> + input_fmts[i++] = MEDIA_BUS_FMT_RGB888_1X24;
>> + break;
>> +
>> + /* 10bit */
>> + case MEDIA_BUS_FMT_RGB101010_1X30:
>> + input_fmts[i++] = MEDIA_BUS_FMT_RGB101010_1X30;
>> + input_fmts[i++] = MEDIA_BUS_FMT_YUV10_1X30;
>> + input_fmts[i++] = MEDIA_BUS_FMT_UYVY10_1X20;
>> + break;
>> + case MEDIA_BUS_FMT_YUV10_1X30:
>> + input_fmts[i++] = MEDIA_BUS_FMT_YUV10_1X30;
>> + input_fmts[i++] = MEDIA_BUS_FMT_UYVY10_1X20;
>> + input_fmts[i++] = MEDIA_BUS_FMT_RGB101010_1X30;
>> + break;
>> + case MEDIA_BUS_FMT_UYVY10_1X20:
>> + input_fmts[i++] = MEDIA_BUS_FMT_UYVY10_1X20;
>> + input_fmts[i++] = MEDIA_BUS_FMT_YUV10_1X30;
>> + input_fmts[i++] = MEDIA_BUS_FMT_RGB101010_1X30;
>> + break;
>> +
>> + /* 12bit */
>> + case MEDIA_BUS_FMT_RGB121212_1X36:
>> + input_fmts[i++] = MEDIA_BUS_FMT_RGB121212_1X36;
>> + input_fmts[i++] = MEDIA_BUS_FMT_YUV12_1X36;
>> + input_fmts[i++] = MEDIA_BUS_FMT_UYVY12_1X24;
>> + break;
>> + case MEDIA_BUS_FMT_YUV12_1X36:
>> + input_fmts[i++] = MEDIA_BUS_FMT_YUV12_1X36;
>> + input_fmts[i++] = MEDIA_BUS_FMT_UYVY12_1X24;
>> + input_fmts[i++] = MEDIA_BUS_FMT_RGB121212_1X36;
>> + break;
>> + case MEDIA_BUS_FMT_UYVY12_1X24:
>> + input_fmts[i++] = MEDIA_BUS_FMT_UYVY12_1X24;
>> + input_fmts[i++] = MEDIA_BUS_FMT_YUV12_1X36;
>> + input_fmts[i++] = MEDIA_BUS_FMT_RGB121212_1X36;
>> + break;
>> +
>> + /* 16bit */
>> + case MEDIA_BUS_FMT_RGB161616_1X48:
>> + input_fmts[i++] = MEDIA_BUS_FMT_RGB161616_1X48;
>> + input_fmts[i++] = MEDIA_BUS_FMT_YUV16_1X48;
>> + break;
>> + case MEDIA_BUS_FMT_YUV16_1X48:
>> + input_fmts[i++] = MEDIA_BUS_FMT_YUV16_1X48;
>> + input_fmts[i++] = MEDIA_BUS_FMT_RGB161616_1X48;
>> + break;
>> +
>> + /* 420 */
>> + case MEDIA_BUS_FMT_UYYVYY8_0_5X24:
>> + case MEDIA_BUS_FMT_UYYVYY10_0_5X30:
>> + case MEDIA_BUS_FMT_UYYVYY12_0_5X36:
>> + case MEDIA_BUS_FMT_UYYVYY16_0_5X48:
>> + input_fmts[i++] = output_fmt;
>> + break;
>> + }
>> +
>> + *num_input_fmts = i;
>> +
>> + if (*num_input_fmts == 0) {
>> + kfree(input_fmts);
>> + input_fmts = NULL;
>> + }
>> +
>> + return input_fmts;
>> +}
>> +
>> +static int dw_hdmi_bridge_atomic_check(struct drm_bridge *bridge,
>> + struct drm_bridge_state *bridge_state,
>> + struct drm_crtc_state *crtc_state,
>> + struct drm_connector_state *conn_state)
>> +{
>> + struct dw_hdmi *hdmi = bridge->driver_private;
>> +
>> + dev_dbg(hdmi->dev, "selected output format %x\n",
>> + bridge_state->output_bus_cfg.format);
>
> Nit: not aligned on the open parens.
>
>> +
>> + hdmi->hdmi_data.enc_out_bus_format =
>> + bridge_state->output_bus_cfg.format;
>> +
>> + dev_dbg(hdmi->dev, "selected input format %x\n",
>> + bridge_state->input_bus_cfg.format);
>> +
>> + hdmi->hdmi_data.enc_in_bus_format =
>> + bridge_state->input_bus_cfg.format;
>> +
>> + return 0;
>> +}
>> +
>> static int dw_hdmi_bridge_attach(struct drm_bridge *bridge)
>> {
>> struct dw_hdmi *hdmi = bridge->driver_private;
>> @@ -2499,6 +2759,9 @@ static const struct drm_bridge_funcs dw_hdmi_bridge_funcs = {
>> .atomic_reset = drm_atomic_helper_bridge_reset,
>> .attach = dw_hdmi_bridge_attach,
>> .detach = dw_hdmi_bridge_detach,
>> + .atomic_check = dw_hdmi_bridge_atomic_check,
>> + .atomic_get_output_bus_fmts = dw_hdmi_bridge_atomic_get_output_bus_fmts,
>> + .atomic_get_input_bus_fmts = dw_hdmi_bridge_atomic_get_input_bus_fmts,
>> .enable = dw_hdmi_bridge_enable,
>> .disable = dw_hdmi_bridge_disable,
>> .mode_set = dw_hdmi_bridge_mode_set,
>> @@ -2963,6 +3226,7 @@ __dw_hdmi_probe(struct platform_device *pdev,
>>
>> hdmi->bridge.driver_private = hdmi;
>> hdmi->bridge.funcs = &dw_hdmi_bridge_funcs;
>> +
>
> Nit: not sure this has to be part of that patch.
>
> Looks good otherwise.
>
> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Thanks, will fixup in a v5 or while applying.
Neil
>
>> #ifdef CONFIG_OF
>> hdmi->bridge.of_node = pdev->dev.of_node;
>> #endif
>
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply other threads:[~2020-02-07 13:36 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-06 19:18 [PATCH v4 00/11] drm/bridge: dw-hdmi: implement bus-format negotiation and YUV420 support Neil Armstrong
2020-02-06 19:18 ` [PATCH v4 01/11] drm/bridge: dw-hdmi: set mtmdsclock for deep color Neil Armstrong
2020-03-02 9:05 ` Laurent Pinchart
2020-03-02 9:21 ` Neil Armstrong
2020-03-02 15:54 ` Neil Armstrong
2020-03-02 16:01 ` Laurent Pinchart
2020-02-06 19:18 ` [PATCH v4 02/11] drm/bridge: dw-hdmi: add max bpc connector property Neil Armstrong
2020-02-17 6:38 ` Jernej Škrabec
2020-02-21 8:50 ` Neil Armstrong
2020-03-02 9:18 ` Laurent Pinchart
2020-03-02 15:55 ` Neil Armstrong
2020-02-06 19:18 ` [PATCH v4 03/11] drm/bridge: dw-hdmi: Plug atomic state hooks to the default implementation Neil Armstrong
2020-02-07 10:57 ` Boris Brezillon
2020-03-02 9:56 ` Laurent Pinchart
2020-03-02 15:55 ` Neil Armstrong
2020-02-06 19:18 ` [PATCH v4 04/11] drm/bridge: synopsys: dw-hdmi: add bus format negociation Neil Armstrong
2020-02-07 11:02 ` Boris Brezillon
2020-02-07 13:36 ` Neil Armstrong [this message]
2020-02-29 7:42 ` Jernej Škrabec
2020-02-29 10:09 ` Jonas Karlman
2020-02-29 11:07 ` Jernej Škrabec
2020-02-29 12:15 ` Jonas Karlman
2020-02-29 14:42 ` Jernej Škrabec
2020-03-02 8:08 ` Neil Armstrong
2020-03-02 8:04 ` Neil Armstrong
2020-03-02 10:18 ` Laurent Pinchart
2020-03-02 15:57 ` Neil Armstrong
2020-02-06 19:18 ` [PATCH v4 05/11] drm/bridge: synopsys: dw-hdmi: allow ycbcr420 modes for >= 0x200a Neil Armstrong
2020-02-07 13:38 ` Neil Armstrong
2020-03-02 10:03 ` Laurent Pinchart
2020-03-02 15:58 ` Neil Armstrong
2020-02-06 19:18 ` [PATCH v4 06/11] drm/meson: venc: make drm_display_mode const Neil Armstrong
2020-02-07 13:39 ` Neil Armstrong
2020-03-02 9:59 ` Laurent Pinchart
2020-02-06 19:18 ` [PATCH v4 07/11] drm/meson: meson_dw_hdmi: add bridge and switch to drm_bridge_funcs Neil Armstrong
2020-02-07 14:57 ` Boris Brezillon
2020-02-07 15:36 ` Neil Armstrong
2020-02-06 19:18 ` [PATCH v4 08/11] drm/meson: dw-hdmi: stop enforcing input_bus_format Neil Armstrong
2020-02-06 19:18 ` [PATCH v4 09/11] drm/meson: venc: add support for YUV420 setup Neil Armstrong
2020-02-06 19:18 ` [PATCH v4 10/11] drm/meson: vclk: " Neil Armstrong
2020-02-06 19:18 ` [PATCH v4 11/11] drm/meson: Add YUV420 output support Neil Armstrong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ed11f2a3-2cc3-9d06-fcd8-886362a5ee36@baylibre.com \
--to=narmstrong@baylibre.com \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=a.hajda@samsung.com \
--cc=boris.brezillon@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jernej.skrabec@siol.net \
--cc=jonas@kwiboo.se \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).