diff options
author | Francesco Dolcini <francesco.dolcini@toradex.com> | 2023-03-30 18:30:09 +0200 |
---|---|---|
committer | Francesco Dolcini <francesco.dolcini@toradex.com> | 2023-04-28 14:14:10 +0200 |
commit | 76643b59c17f7d26924f518699f10c8130547929 (patch) | |
tree | 54eac0e57a28b33ca7b8dc6d5059dc4e5c1fd72c | |
parent | 3fd4c5f80236d70c761426c63b924165163a9b18 (diff) |
drm/tidss: Use bus format from the first bridge if present
In case there is a bridge connected to the TIDSS, use bus format
from the bridge, otherwise behave as before and use the format
from the connector display info.
This way is possible to use a bridge that convert between different
media format.
Similar changes were rejected in mainline, there is a request to convert
tidss to expose a drm_bridge interface.
Upstream-Status: Denied
A similar patch was rejected upstream, the request is to implement
the DRM bridge interface [1]. TI is going to take care of it [2], we will
integrate the solution from upstream as soon as it is available.
[1] https://lore.kernel.org/all/20201204121235.4bbbe2eb@collabora.com/
[2] https://lore.kernel.org/all/655cfc4b-a414-47e1-f676-b11e410da32f@ti.com/
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
-rw-r--r-- | drivers/gpu/drm/tidss/tidss_encoder.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/drivers/gpu/drm/tidss/tidss_encoder.c b/drivers/gpu/drm/tidss/tidss_encoder.c index e278a9c89476..c93228cc4dbe 100644 --- a/drivers/gpu/drm/tidss/tidss_encoder.c +++ b/drivers/gpu/drm/tidss/tidss_encoder.c @@ -22,12 +22,31 @@ 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 *br_state = NULL; struct drm_bridge *bridge; bool bus_flags_set = false; dev_dbg(ddev->dev, "%s\n", __func__); /* + * Take bus format from the first bridge, if not present get it from + * the connector display_info + */ + bridge = drm_bridge_chain_get_first_bridge(encoder); + if (bridge) + br_state = drm_atomic_get_new_bridge_state(crtc_state->state, + bridge); + if (br_state) { + tcrtc_state->bus_format = br_state->input_bus_cfg.format; + } else if (di->bus_formats && di->num_bus_formats > 0) { + tcrtc_state->bus_format = di->bus_formats[0]; + } else { + dev_err(ddev->dev, "%s: No bus_formats in connected display\n", + __func__); + return -EINVAL; + } + + /* * Take the bus_flags from the first bridge that defines * bridge timings, or from the connector's display_info if no * bridge defines the timings. @@ -41,14 +60,7 @@ 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; |