Skip to content

Commit

Permalink
drm/tidss: Use bus format from the first bridge if present
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
  • Loading branch information
dolcini committed Apr 12, 2023
1 parent 09ba75a commit 150b139
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions drivers/gpu/drm/tidss/tidss_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,30 @@ 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
Expand All @@ -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;

Expand Down

0 comments on commit 150b139

Please sign in to comment.