linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@collabora.com>
To: Neil Armstrong <narmstrong@baylibre.com>
Cc: a.hajda@samsung.com, Laurent.pinchart@ideasonboard.com,
	jonas@kwiboo.se, jernej.skrabec@siol.net,
	linux-amlogic@lists.infradead.org,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC v2 3/8] drm/bridge: synopsys: dw-hdmi: add bus format negociation
Date: Tue, 27 Aug 2019 11:03:56 +0200	[thread overview]
Message-ID: <20190827110356.3bec488b@collabora.com> (raw)
In-Reply-To: <20190827081425.15011-4-narmstrong@baylibre.com>

On Tue, 27 Aug 2019 10:14:20 +0200
Neil Armstrong <narmstrong@baylibre.com> wrote:

> Add the atomic_get_output_bus_fmts, atomic_get_input_bus_fmts to negociate

								   ^negotiate

> the possible output and input formats for the current mode and monitor,
> and use the negociated formats in a basic atomic_check callback.

	      ^negotiated

> 
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> ---


>  
> +static void dw_hdmi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge,
> +					struct drm_bridge_state *bridge_state,
> +					struct drm_crtc_state *crtc_state,
> +					struct drm_connector_state *conn_state,
> +					unsigned int *num_output_fmts,
> +					u32 *output_fmts)
> +{
> +	struct drm_connector *conn = conn_state->connector;
> +	struct drm_display_info *info = &conn->display_info;
> +	struct drm_display_mode *mode = &crtc_state->mode;
> +	bool is_hdmi2_sink = info->hdmi.scdc.supported;	
> +	int i = 0;
> +
> +	/*
> +	 * If the current mode enforces 4:2:0, force the output but format
> +	 * to 4:2:0 and do not add the YUV422/444/RGB formats
> +	 */
> +	if (drm_mode_is_420_only(info, mode) ||
> +	    (!is_hdmi2_sink && drm_mode_is_420_also(info, mode))) {
> +
> +		/* Order bus formats from 16bit to 8bit if supported */
> +		if (info->bpc == 16 &&
> +		    (info->hdmi.y420_dc_modes & DRM_EDID_YCBCR420_DC_48)) {
> +			if (output_fmts)
> +				output_fmts[i] = MEDIA_BUS_FMT_UYYVYY16_0_5X48;
> +			++i;
> +		}

You could probably add the following helper:

static void dw_hdmi_bridge_add_fmt(unsigned int *num_fmts, u32 *fmts,
				   u32 new_fmt)
{
	if (fmts)
		fmts[*num_fmts] = new_fmt;

	(*num_fmts)++;
}

to avoid duplicating the

	if (fmts)
		...

	i++;			

logic.

  reply	other threads:[~2019-08-27  9:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-27  8:14 [PATCH RFC v2 0/8] drm/bridge: dw-hdmi: implement bus-format negotiation and YUV420 support Neil Armstrong
2019-08-27  8:14 ` [PATCH RFC v2 1/8] drm/meson: venc: make drm_display_mode const Neil Armstrong
2019-08-27  8:14 ` [PATCH RFC v2 2/8] drm/meson: meson_dw_hdmi: switch to drm_bridge_funcs Neil Armstrong
2019-08-27  8:53   ` Boris Brezillon
2019-08-27  8:14 ` [PATCH RFC v2 3/8] drm/bridge: synopsys: dw-hdmi: add bus format negociation Neil Armstrong
2019-08-27  9:03   ` Boris Brezillon [this message]
2019-08-27 10:07     ` Neil Armstrong
2019-08-27  8:14 ` [PATCH RFC v2 4/8] drm/meson: dw-hdmi: stop enforcing input_bus_format Neil Armstrong
2019-08-27  9:05   ` Boris Brezillon
2019-08-27  8:14 ` [PATCH RFC v2 5/8] drm/bridge: dw-hdmi: allow ycbcr420 modes for >= 0x200a Neil Armstrong
2019-08-27  8:14 ` [PATCH RFC v2 6/8] drm/meson: venc: add support for YUV420 setup Neil Armstrong
2019-08-27  8:14 ` [PATCH RFC v2 7/8] drm/meson: vclk: " Neil Armstrong
2019-08-27  8:14 ` [PATCH RFC v2 8/8] 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=20190827110356.3bec488b@collabora.com \
    --to=boris.brezillon@collabora.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=a.hajda@samsung.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 \
    --cc=narmstrong@baylibre.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;
as well as URLs for NNTP newsgroup(s).