From: Neil Armstrong <narmstrong@baylibre.com> To: robert.foss@linaro.org Cc: Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Neil Armstrong <narmstrong@baylibre.com> Subject: [PATCH 1/2] drm/bridge: dw-hdmi: filter safe formats when first in bridge chain Date: Wed, 19 Jan 2022 13:36:55 +0100 [thread overview] Message-ID: <20220119123656.1456355-1-narmstrong@baylibre.com> (raw) If the dw-bridge is in the first position in the bridge chain, this means there is no way to set the encoder output bus format. In this case, this makes sure we only return the default format as return of the get_input_bus_fmts() callback, limiting possible output formats of dw-hdmi to what the dw-hdmi can convert from the default RGB24 input format. Fixes: 6c3c719936da ("drm/bridge: synopsys: dw-hdmi: add bus format negociation") Signed-off-by: Neil Armstrong <narmstrong@baylibre.com> --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 97cdc61b57f6..56021f20d396 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2674,6 +2674,25 @@ static u32 *dw_hdmi_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge, if (!input_fmts) return NULL; + /* If dw-hdmi is the first bridge make sure it only takes RGB24 as input */ + if (list_is_first(&bridge->chain_node, &bridge->encoder->bridge_chain)) { + switch (output_fmt) { + case MEDIA_BUS_FMT_FIXED: + case MEDIA_BUS_FMT_RGB888_1X24: + case MEDIA_BUS_FMT_YUV8_1X24: + case MEDIA_BUS_FMT_UYVY8_1X16: + input_fmts[i++] = MEDIA_BUS_FMT_RGB888_1X24; + break; + default: + kfree(input_fmts); + input_fmts = NULL; + } + + *num_input_fmts = i; + + return input_fmts; + } + switch (output_fmt) { /* If MEDIA_BUS_FMT_FIXED is tested, return default bus format */ case MEDIA_BUS_FMT_FIXED: -- 2.25.1
WARNING: multiple messages have this Message-ID (diff)
From: Neil Armstrong <narmstrong@baylibre.com> To: robert.foss@linaro.org Cc: jernej.skrabec@gmail.com, Neil Armstrong <narmstrong@baylibre.com>, jonas@kwiboo.se, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Laurent.pinchart@ideasonboard.com Subject: [PATCH 1/2] drm/bridge: dw-hdmi: filter safe formats when first in bridge chain Date: Wed, 19 Jan 2022 13:36:55 +0100 [thread overview] Message-ID: <20220119123656.1456355-1-narmstrong@baylibre.com> (raw) If the dw-bridge is in the first position in the bridge chain, this means there is no way to set the encoder output bus format. In this case, this makes sure we only return the default format as return of the get_input_bus_fmts() callback, limiting possible output formats of dw-hdmi to what the dw-hdmi can convert from the default RGB24 input format. Fixes: 6c3c719936da ("drm/bridge: synopsys: dw-hdmi: add bus format negociation") Signed-off-by: Neil Armstrong <narmstrong@baylibre.com> --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 97cdc61b57f6..56021f20d396 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2674,6 +2674,25 @@ static u32 *dw_hdmi_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge, if (!input_fmts) return NULL; + /* If dw-hdmi is the first bridge make sure it only takes RGB24 as input */ + if (list_is_first(&bridge->chain_node, &bridge->encoder->bridge_chain)) { + switch (output_fmt) { + case MEDIA_BUS_FMT_FIXED: + case MEDIA_BUS_FMT_RGB888_1X24: + case MEDIA_BUS_FMT_YUV8_1X24: + case MEDIA_BUS_FMT_UYVY8_1X16: + input_fmts[i++] = MEDIA_BUS_FMT_RGB888_1X24; + break; + default: + kfree(input_fmts); + input_fmts = NULL; + } + + *num_input_fmts = i; + + return input_fmts; + } + switch (output_fmt) { /* If MEDIA_BUS_FMT_FIXED is tested, return default bus format */ case MEDIA_BUS_FMT_FIXED: -- 2.25.1
next reply other threads:[~2022-01-19 12:37 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-01-19 12:36 Neil Armstrong [this message] 2022-01-19 12:36 ` [PATCH 1/2] drm/bridge: dw-hdmi: filter safe formats when first in bridge chain Neil Armstrong 2022-01-19 12:36 ` [PATCH 2/2] drm/bridge: dw-hdmi: filter out YUV output formats when DVI Neil Armstrong 2022-01-19 12:36 ` 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=20220119123656.1456355-1-narmstrong@baylibre.com \ --to=narmstrong@baylibre.com \ --cc=Laurent.pinchart@ideasonboard.com \ --cc=dri-devel@lists.freedesktop.org \ --cc=jernej.skrabec@gmail.com \ --cc=jonas@kwiboo.se \ --cc=linux-kernel@vger.kernel.org \ --cc=robert.foss@linaro.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.