linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 01/11] fixup! drm/bridge: Add the necessary bits to support bus format negotiation
Date: Tue, 20 Aug 2019 10:40:59 +0200	[thread overview]
Message-ID: <20190820084109.24616-2-narmstrong@baylibre.com> (raw)
In-Reply-To: <20190820084109.24616-1-narmstrong@baylibre.com>

> +	} else if (b->num_supported_fmts > 1 && b->supported_fmts) {
> +		*selected_bus_fmt = b->supported_fmts[0];
> +		return 0;

Here, `!a->num_supported_fmts &&` is missing otherwise this code will
select b->supported_fmts[0] whatever the supported formats of a.

> +	} else if (a->num_supported_fmts > 1 && a->supported_fmts) {
> +		*selected_bus_fmt = a->supported_fmts[0];
> +		return 0;

Here, `!b->num_supported_fmts &&` is missing otherwise this code will
select a->supported_fmts[0] whatever the supported formats of b.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 drivers/gpu/drm/drm_bridge.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
index 5f0925467292..82fe7728fcd1 100644
--- a/drivers/gpu/drm/drm_bridge.c
+++ b/drivers/gpu/drm/drm_bridge.c
@@ -615,10 +615,12 @@ int drm_find_best_bus_format(const struct drm_bus_caps *a,
 	if (!a->num_supported_fmts && !b->num_supported_fmts) {
 		*selected_bus_fmt = 0;
 		return 0;
-	} else if (b->num_supported_fmts > 1 && b->supported_fmts) {
+	} else if (!a->num_supported_fmts &&
+		   b->num_supported_fmts > 1 && b->supported_fmts) {
 		*selected_bus_fmt = b->supported_fmts[0];
 		return 0;
-	} else if (a->num_supported_fmts > 1 && a->supported_fmts) {
+	} else if (!b->num_supported_fmts &&
+		   a->num_supported_fmts > 1 && a->supported_fmts) {
 		*selected_bus_fmt = a->supported_fmts[0];
 		return 0;
 	} else if (!a->num_supported_fmts || !a->supported_fmts ||
-- 
2.22.0


  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 ` Neil Armstrong [this message]
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 ` [RFC 08/11] drm/bridge: synopsys: dw-hdmi: add 420 mode format negociation Neil Armstrong
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-2-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).