From: Tomi Valkeinen <tomi.valkeinen@ti.com>
To: Nikhil Devshatwar <nikhil.nd@ti.com>, <dri-devel@lists.freedesktop.org>
Cc: Sekhar Nori <nsekhar@ti.com>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Yuti Amonkar <yamonkar@cadence.com>,
Swapnil Jakhade <sjakhade@cadence.com>
Subject: Re: [PATCH v2 4/6] drm/tidss: Set bus_format correctly from bridge/connector
Date: Wed, 11 Nov 2020 13:52:45 +0200 [thread overview]
Message-ID: <c331b05c-156d-e821-c7b7-c05db0466d74@ti.com> (raw)
In-Reply-To: <20201109170601.21557-5-nikhil.nd@ti.com>
On 09/11/2020 19:05, Nikhil Devshatwar wrote:
> When there is a chain of bridges attached to the encoder,
> the bus_format should be ideally set from the input format of the
> first bridge in the chain.
>
> Use the bridge state to get the negotiated bus_format.
> If the bridge does not support format negotiation, error out
> and fail.
>
> Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
> ---
> drivers/gpu/drm/tidss/tidss_encoder.c | 22 ++++++++++++++--------
> 1 file changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/tidss/tidss_encoder.c b/drivers/gpu/drm/tidss/tidss_encoder.c
> index e278a9c89476..ba5b6fccabe7 100644
> --- a/drivers/gpu/drm/tidss/tidss_encoder.c
> +++ b/drivers/gpu/drm/tidss/tidss_encoder.c
> @@ -22,6 +22,7 @@ static int tidss_encoder_atomic_check(struct drm_encoder *encoder,
> struct drm_device *ddev = encoder->dev;
> struct tidss_crtc_state *tcrtc_state = to_tidss_crtc_state(crtc_state);
> struct drm_display_info *di = &conn_state->connector->display_info;
> + struct drm_bridge_state *bstate;
> struct drm_bridge *bridge;
> bool bus_flags_set = false;
>
> @@ -41,17 +42,22 @@ static int tidss_encoder_atomic_check(struct drm_encoder *encoder,
> break;
> }
>
> - if (!di->bus_formats || di->num_bus_formats == 0) {
> - dev_err(ddev->dev, "%s: No bus_formats in connected display\n",
> - __func__);
> - return -EINVAL;
> - }
> -
> - // XXX any cleaner way to set bus format and flags?
> - tcrtc_state->bus_format = di->bus_formats[0];
> if (!bus_flags_set)
> tcrtc_state->bus_flags = di->bus_flags;
>
> + /* Copy the bus_format from the input_bus_format of first bridge */
> + bridge = drm_bridge_chain_get_first_bridge(encoder);
> + bstate = drm_atomic_get_new_bridge_state(crtc_state->state, bridge);
> + if (bstate)
> + tcrtc_state->bus_format = bstate->input_bus_cfg.format;
> +
> + if (tcrtc_state->bus_format == 0 ||
> + tcrtc_state->bus_format == MEDIA_BUS_FMT_FIXED) {
> +
> + dev_err(ddev->dev, "Bridge connected to the encoder did not specify media bus format\n");
> + return -EINVAL;
> + }
> +
> return 0;
We should also take the bus flags from the bridge state (next bridge's input_bus_cfg.flags).
And... If I read this right, we always fail if there's no bstate. So we could just do "if (!bstate)
fail;"
And if we always expect to have bstate, and get bus flags and formats from there, we don't need the
current drm_for_each_bridge_in_chain() loop or taking bus_flags from display info.
Tomi
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2020-11-11 11:52 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-09 17:05 [PATCH v2 0/6] drm/tidss: Use new connector model for tidss Nikhil Devshatwar
2020-11-09 17:05 ` [PATCH v2 1/6] drm: bridge: Propagate the bus flags from bridge->timings Nikhil Devshatwar
2020-11-11 11:38 ` Tomi Valkeinen
2020-11-09 17:05 ` [PATCH v2 2/6] drm/bridge: tfp410: Support format negotiation hooks Nikhil Devshatwar
2020-11-11 11:41 ` Tomi Valkeinen
2020-11-09 17:05 ` [PATCH v2 3/6] drm/bridge: mhdp8546: Add minimal format negotiation Nikhil Devshatwar
2020-11-11 11:42 ` Tomi Valkeinen
2020-11-09 17:05 ` [PATCH v2 4/6] drm/tidss: Set bus_format correctly from bridge/connector Nikhil Devshatwar
2020-11-11 11:52 ` Tomi Valkeinen [this message]
2020-11-09 17:06 ` [PATCH v2 5/6] drm/tidss: Move to newer connector model Nikhil Devshatwar
2020-11-11 11:55 ` Tomi Valkeinen
2020-11-09 17:06 ` [PATCH v2 6/6] drm/bridge: cdns-mhdp8546: Fix the interrupt enable/disable Nikhil Devshatwar
2020-11-10 9:21 ` Tomi Valkeinen
2020-11-10 10:27 ` Nikhil Devshatwar
2020-11-10 12:27 ` Tomi Valkeinen
2020-11-10 13:53 ` Nikhil Devshatwar
2020-11-10 14:32 ` Swapnil Kashinath Jakhade
2020-11-10 14:50 ` Nikhil Devshatwar
2020-11-11 17:05 ` Swapnil Kashinath Jakhade
2020-11-10 9:02 ` [PATCH v2 0/6] drm/tidss: Use new connector model for tidss Tomi Valkeinen
2020-11-10 10:30 ` Nikhil Devshatwar
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=c331b05c-156d-e821-c7b7-c05db0466d74@ti.com \
--to=tomi.valkeinen@ti.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=nikhil.nd@ti.com \
--cc=nsekhar@ti.com \
--cc=sjakhade@cadence.com \
--cc=yamonkar@cadence.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