dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Neil Armstrong <narmstrong@baylibre.com>
To: Boris Brezillon <boris.brezillon@collabora.com>
Cc: Jernej Skrabec <jernej.skrabec@siol.net>,
	Jonas Karlman <jonas@kwiboo.se>,
	Seung-Woo Kim <sw0312.kim@samsung.com>,
	dri-devel@lists.freedesktop.org,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	Chris Healy <Chris.Healy@zii.aero>,
	kernel@collabora.com, Sam Ravnborg <sam@ravnborg.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Subject: Re: [PATCH RFC 14/19] drm/bridge: Add the necessary bits to support bus format negotiation
Date: Thu, 22 Aug 2019 12:22:02 +0200	[thread overview]
Message-ID: <a8e16625-cdc2-ba28-059a-0d69196d0d20@baylibre.com> (raw)
In-Reply-To: <20190822120923.6b18e6dd@collabora.com>

On 22/08/2019 12:09, Boris Brezillon wrote:
> On Thu, 22 Aug 2019 11:29:40 +0200
> Neil Armstrong <narmstrong@baylibre.com> wrote:
> 
>>>>> +/**
>>>>> + * struct drm_bus_caps - bus capabilities
>>>>> + * @supported_fmts: array of MEDIA_BUS_FMT_ formats
>>>>> + * @num_supported_fmts: size of the supported_fmts array
>>>>> + *
>>>>> + * Used by the core to negotiate the bus format at runtime.
>>>>> + */
>>>>> +struct drm_bus_caps {
>>>>> +	const u32 *supported_fmts;
>>>>> +	unsigned int num_supported_fmts;
>>>>> +};
>>>>> +
>>>>>  /**
>>>>>   * struct drm_bridge_state - Atomic bridge state object
>>>>>   * @base: inherit from &drm_private_state
>>>>>   * @bridge: the bridge this state refers to
>>>>> + * @input_bus_info: input bus information
>>>>> + * @output_bus_info: output bus information    
>>>>
>>>> I would make this an array, to prepare for bridges that will have more
>>>> than one input or one output.  
>>>
>>> Hm, not sure how you'd represent that. I guess you want to support
>>> bridges that can activate several inputs+outputs in parallel. Do we
>>> even support that right now?
>>> Also, how do we link the input to the output in that case? By their
>>> position in the array? And we'd need an extra field in bus_caps to
>>> point to the corresponding bridge input/output port.
>>>
>>> I'm glad we can discuss all those problems, but I'd like to focus on
>>> what's needed right now, not what could potentially be needed in the
>>> future. If we can design things to be more future-proof that's great,
>>> but in my experience, trying to solve problems that do not exist yet
>>> often leads to complex designs which prove to be wrong when we try to
>>> apply them to real situations when they finally occur.  
>>
>> I had a thought when implementing bus format negotiation for dw-hdmi.
>>
>> Depending on the output bus-format, we could have different sets of possible
>> input drm_bus_caps.
>>
>> For example, if output is MEDIA_BUS_FMT_RGB888_1X24,
>> the input bus formats could only be MEDIA_BUS_FMT_RGB888_1X24 or MEDIA_BUS_FMT_YUV8_1X24.
>> Same for MEDIA_BUS_FMT_RGB101010_1X30, MEDIA_BUS_FMT_RGB121212_1X36, MEDIA_BUS_FMT_RGB161616_1X48...
>> And the special MEDIA_BUS_FMT_UYYVYY8_0_5X24, where input must be output.
> 
> Sounds exactly like what Laurent was describing.
> 
>>
>> How could we handle this ? I mean, could we have a fixed
>> output drm_bus_caps and be able to dynamically change the input drm_bus_caps ?
> 
> If all output ends of bridges have fixed formats (meaning that
> something sets it to a fixed value, like a DT prop), there's no need
> for negotiation at all, since the output of the previous element in
> the chain will force input format of the current element.
> 
>>
>> Adding matrix in struct drm_bridge seems over-engineered, no ?
> 
> Will have to try it to give an answer to that question :).

Another thought, I was thinking about a matrix with an optional callback checking
is this particular matrix line is possible, an example :

struct drm_bridge_bus_fmt_assoc dw_hdmi_bus_fmt_matrix[] = {
	{ MEDIA_BUS_FMT_RGB888_1X24,
		{MEDIA_BUS_FMT_RGB888_1X24, MEDIA_BUS_FMT_YUV8_1X24, 0},
		{dw_hdmi_bus_fmt_no_yuv420_check, NULL},
	},
	{ MEDIA_BUS_FMT_YUV8_1X24,
		{MEDIA_BUS_FMT_YUV8_1X24, 0},
		{dw_hdmi_bus_fmt_no_yuv420_check,
		 dw_hdmi_bus_fmt_yuv444_check,
		 NULL},
	},
	{ MEDIA_BUS_FMT_RGB101010_1X30,
		{MEDIA_BUS_FMT_RGB101010_1X30, MEDIA_BUS_FMT_YUV10_1X30, 0},
		{dw_hdmi_bus_fmt_no_yuv420_check,
		 dw_hdmi_bus_fmt_rgb_10bit_check,
		 NULL},
	},
	{ MEDIA_BUS_FMT_UYYVYY8_0_5X24,
		{MEDIA_BUS_FMT_UYYVYY8_0_5X24, 0},
		dw_hdmi_bus_fmt_yuv420_check,
	},
	{ MEDIA_BUS_FMT_UYYVYY10_0_5X30,
		{MEDIA_BUS_FMT_UYYVYY8_0_5X24, 0},
		{dw_hdmi_bus_fmt_yuv420_check,
		 dw_hdmi_bus_fmt_yuv420_10bit_check,
		 NULL},
	},
};

Or with some flags combinations to check on the mode and some on the edid ?

Neil

> 
>> Since it should take
>> in account the actual drm_display_mode.
> 
> Taking the display_mode into account is yet another thing, though it
> might impact the way we want to handle bus-format negotiation. The way
> I see it, we have 2 issues to solve:
> 
> 1/ make sure the atomic modeset does not fail if there's at least one
>    bus-format combination that works (this is what the
>    supported-transcoding matrix is for)
> 2/ make sure that we pick the best option among all the possibilities.
>    That requires defining what 'best' means. In some cases you might
>    want to reduce power-consumption/bandwidth in others you might want
>    to preserve image-quality (relative to the selected mode of course)
> 
> I decided to ignore problem #2 for now, but that's definitely something
> we should work on at some point. Problem #1 is a problem we should
> solve now. If we find a solution that solves both it's even better :-).
> 
>>
>> Maybe by passing a dynamic input drm_bus_caps to drm_atomic_bridge_choose_input_bus_cfg()
>> and take the default struct drm_bridge one if not provided ?
> 
> IIUC, you propose to restrict the set of input formats based on the
> selected output format from inside the driver ->atomic_check()
> implementation. That's basically like open-coding the
> supported-transcoding matrix: you'll have to have a list of supported
> input formats for each output format (or set of output formats), right?
> 
> Note that we could implement the supported-transcoding thing with a hook
> instead of a matrix, but, no matter the solution we pick, it will always
> be something that can answer this question "is bridge X able to convert
> input format A into output format B?".
> 
> The nice thing about having the transcoding matrix calculated at attach
> time is that you reject combinations that are not possible early instead
> of having to do this work at each atomic_check(). Also, if you're not
> rejecting impossible combinations early, I think you still have the
> problem Laurent was talking about when you have more than 2 elements in
> the chain.
> 
>> This would really simplify the bridge atomic_check implementation by reusing
>> the drm_atomic_bridge_choose_*() functions.
>>
> 

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2019-08-22 10:22 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-08 15:11 [PATCH RFC 00/19] drm: Add support for bus-format negotiation Boris Brezillon
2019-08-08 15:11 ` [PATCH RFC 01/19] drm: Stop including drm_bridge.h from drm_crtc.h Boris Brezillon
2019-08-08 18:05   ` Sam Ravnborg
2019-08-20 18:53   ` Laurent Pinchart
2019-08-21 15:44     ` Boris Brezillon
2019-08-08 15:11 ` [PATCH RFC 02/19] drm: Support custom encoder/bridge enable/disable sequences officially Boris Brezillon
2019-08-20 19:05   ` Laurent Pinchart
2019-08-21  8:21     ` Daniel Vetter
2019-08-21 13:57       ` Laurent Pinchart
2019-08-21 15:39       ` Boris Brezillon
2019-08-21 15:30     ` Boris Brezillon
2019-08-08 15:11 ` [PATCH RFC 03/19] drm/vc4: Get rid of the dsi->bridge field Boris Brezillon
2019-08-08 20:31   ` Eric Anholt
2019-08-08 15:11 ` [PATCH RFC 04/19] drm/exynos: Get rid of exynos_dsi->out_bridge Boris Brezillon
2019-08-08 15:11 ` [PATCH RFC 05/19] drm/exynos: Don't reset bridge->next Boris Brezillon
2019-08-08 21:04   ` Boris Brezillon
2019-08-21 14:01   ` Laurent Pinchart
2019-08-08 15:11 ` [PATCH RFC 06/19] drm/bridge: Create drm_bridge_chain_xx() wrappers Boris Brezillon
2019-08-21 14:45   ` Laurent Pinchart
2019-08-21 15:53     ` Boris Brezillon
2019-08-08 15:11 ` [PATCH RFC 07/19] drm/msm: Use drm_attach_bridge() to attach a bridge to an encoder Boris Brezillon
2019-08-19 17:19   ` Sam Ravnborg
2019-08-21 14:46     ` Laurent Pinchart
2019-08-08 15:11 ` [PATCH RFC 08/19] drm/bridge: Introduce drm_bridge_chain_get_{first, last, next}_bridge() Boris Brezillon
2019-08-08 15:11 ` [PATCH RFC 09/19] drm/bridge: Make the bridge chain a double-linked list Boris Brezillon
2019-08-08 15:11 ` [PATCH RFC 10/19] drm/bridge: Add a drm_bridge_state object Boris Brezillon
2019-08-21 20:14   ` Laurent Pinchart
2019-08-22  9:00     ` Boris Brezillon
2019-12-02 15:52       ` Laurent Pinchart
2019-08-08 15:11 ` [PATCH RFC 11/19] drm/bridge: Patch atomic hooks to take a drm_bridge_state Boris Brezillon
2019-08-22  0:02   ` Laurent Pinchart
2019-08-22  8:25     ` Boris Brezillon
2019-08-08 15:11 ` [PATCH RFC 12/19] drm/bridge: Add an ->atomic_check() hook Boris Brezillon
2019-08-22  0:12   ` Laurent Pinchart
2019-08-22  7:58     ` Boris Brezillon
2019-08-08 15:11 ` [PATCH RFC 13/19] drm/bridge: Add the drm_bridge_chain_get_prev_bridge() helper Boris Brezillon
2019-08-22  0:17   ` Laurent Pinchart
2019-08-22  8:04     ` Boris Brezillon
2019-08-08 15:11 ` [PATCH RFC 14/19] drm/bridge: Add the necessary bits to support bus format negotiation Boris Brezillon
2019-08-14  7:51   ` Neil Armstrong
2019-08-21 18:31     ` Boris Brezillon
2019-08-22  0:55   ` Laurent Pinchart
2019-08-22  7:48     ` Boris Brezillon
2019-08-22  9:29       ` Neil Armstrong
2019-08-22 10:09         ` Boris Brezillon
2019-08-22 10:22           ` Neil Armstrong [this message]
2019-08-22 10:34             ` Boris Brezillon
2019-08-22 11:30               ` Neil Armstrong
2019-08-08 15:11 ` [PATCH RFC 15/19] drm/imx: pd: Use bus format/flags provided by the bridge when available Boris Brezillon
2019-08-08 15:11 ` [PATCH RFC 16/19] drm/bridge: lvds-encoder: Add a way to support custom ->atomic_check() implem Boris Brezillon
2019-08-08 15:11 ` [PATCH RFC 17/19] drm/bridge: lvds-encoder: Implement bus format negotiation for sn75lvds83 Boris Brezillon
2019-08-22  0:32   ` Laurent Pinchart
2019-08-22  8:12     ` Boris Brezillon
2019-08-08 15:11 ` [PATCH RFC 18/19] drm/panel: simple: Add support for Toshiba LTA089AC29000 panel Boris Brezillon
2019-08-22  0:36   ` Laurent Pinchart
2019-08-22  8:15     ` Boris Brezillon
2019-08-08 15:11 ` [PATCH RFC 19/19] ARM: dts: imx: imx51-zii-rdu1: Fix the display pipeline definition Boris Brezillon
2019-08-09  6:58 ` [PATCH RFC 00/19] drm: Add support for bus-format negotiation 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=a8e16625-cdc2-ba28-059a-0d69196d0d20@baylibre.com \
    --to=narmstrong@baylibre.com \
    --cc=Chris.Healy@zii.aero \
    --cc=boris.brezillon@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jernej.skrabec@siol.net \
    --cc=jonas@kwiboo.se \
    --cc=kernel@collabora.com \
    --cc=kyungmin.park@samsung.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=sam@ravnborg.org \
    --cc=sw0312.kim@samsung.com \
    --cc=thierry.reding@gmail.com \
    /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