From: Neil Armstrong <narmstrong@baylibre.com>
To: a.hajda@samsung.com, Laurent.pinchart@ideasonboard.com,
jonas@kwiboo.se, jernej.skrabec@siol.net,
boris.brezillon@collabora.com
Cc: Neil Armstrong <narmstrong@baylibre.com>,
linux-amlogic@lists.infradead.org,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: [RFC 08/11] drm/bridge: synopsys: dw-hdmi: add 420 mode format negociation
Date: Tue, 20 Aug 2019 10:41:06 +0200 [thread overview]
Message-ID: <20190820084109.24616-9-narmstrong@baylibre.com> (raw)
In-Reply-To: <20190820084109.24616-1-narmstrong@baylibre.com>
Add special negociation case for 420 HDMI2.0 format.
In this case the DW-HDMI CSC cannot handle 420 data, and must be
in passthrought, thus input_bus_cfg must be output_bus_cfg.
Add support for handling a specific 8/10/12/16 variant in the connector
bus_formats if specified.
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 45 ++++++++++++++++++-----
1 file changed, 36 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index cb560b231d74..b96119c6fad2 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -2213,23 +2213,50 @@ static int dw_hdmi_bridge_atomic_check(struct drm_bridge *bridge,
struct drm_connector_state *conn_state)
{
struct dw_hdmi *hdmi = bridge->driver_private;
+ 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 ret;
- ret = drm_atomic_bridge_choose_output_bus_cfg(bridge_state, crtc_state,
- conn_state);
- if (ret)
- return ret;
+ /*
+ * If the current mode enforces 4:2:0, force the output but format
+ * or use the connector bus formats if a non 8bit 4:2:0 format
+ * is provided.
+ */
+ if (drm_mode_is_420_only(info, mode) ||
+ (!is_hdmi2_sink && drm_mode_is_420_also(info, mode))) {
+ if (info->num_bus_formats && info->bus_formats &&
+ hdmi_bus_fmt_is_yuv420(info->bus_formats[0]))
+ bridge_state->output_bus_cfg.fmt = info->bus_formats[0];
+ else
+ bridge_state->output_bus_cfg.fmt =
+ MEDIA_BUS_FMT_UYYVYY8_0_5X24;
+ } else {
+ ret = drm_atomic_bridge_choose_output_bus_cfg(bridge_state,
+ crtc_state,
+ conn_state);
+ if (ret)
+ return ret;
+ }
+
+ if (hdmi_bus_fmt_is_yuv420(bridge_state->output_bus_cfg.fmt)) {
+ /* The DW-HDMI CSC cannot interpolate and decimate in 4:2:0 */
+ bridge_state->input_bus_cfg.fmt =
+ bridge_state->output_bus_cfg.fmt;
+ } else {
+ ret = drm_atomic_bridge_choose_input_bus_cfg(bridge_state,
+ crtc_state,
+ conn_state);
+ if (ret)
+ return ret;
+ }
dev_dbg(hdmi->dev, "selected output format %x\n",
bridge_state->output_bus_cfg.fmt);
hdmi->hdmi_data.enc_out_bus_format = bridge_state->output_bus_cfg.fmt;
- ret = drm_atomic_bridge_choose_input_bus_cfg(bridge_state, crtc_state,
- conn_state);
- if (ret)
- return ret;
-
dev_dbg(hdmi->dev, "selected input format %x\n",
bridge_state->input_bus_cfg.fmt);
--
2.22.0
next prev parent reply other threads:[~2019-08-20 8:41 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-20 8:40 [RFC 00/11] drm/bridge: dw-hdmi: implement bus-format negotiation and YUV420 support Neil Armstrong
2019-08-20 8:40 ` [RFC 01/11] fixup! drm/bridge: Add the necessary bits to support bus format negotiation Neil Armstrong
2019-08-20 8:41 ` [RFC 02/11] drm/meson: venc: make drm_display_mode const Neil Armstrong
2019-08-21 18:32 ` Boris Brezillon
2019-08-20 8:41 ` [RFC 03/11] drm/meson: meson_dw_hdmi: switch to drm_bridge_funcs Neil Armstrong
2019-08-20 8:41 ` [RFC 04/11] drm/bridge: synopsys: dw-hdmi: add basic bridge_atomic_check Neil Armstrong
2019-08-20 8:41 ` [RFC 05/11] drm/bridge: synopsys: dw-hdmi: use negociated bus formats Neil Armstrong
2019-08-20 8:41 ` [RFC 06/11] drm/meson: dw-hdmi: stop enforcing input_bus_format Neil Armstrong
2019-08-20 8:41 ` [RFC 07/11] drm/bridge: dw-hdmi: allow ycbcr420 modes for >= 0x200a Neil Armstrong
2019-08-20 8:41 ` Neil Armstrong [this message]
2019-08-20 8:41 ` [RFC 09/11] drm/meson: venc: add support for YUV420 setup Neil Armstrong
2019-08-20 8:41 ` [RFC 10/11] drm/meson: vclk: " Neil Armstrong
2019-08-20 8:41 ` [RFC 11/11] drm/meson: Add YUV420 output support Neil Armstrong
2019-08-21 18:30 ` [RFC 00/11] drm/bridge: dw-hdmi: implement bus-format negotiation and YUV420 support Boris Brezillon
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=20190820084109.24616-9-narmstrong@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).