Skip to content

Commit 2f1495f

Browse files
committed
drm/bridge: nwl-dsi: Add atomic_get_input_bus_fmts
Components further up in the chain might ask us for supported formats. Without this MEDIA_BUS_FMT_FIXED is assumed which then breaks display output with mxsfb since it can't determine a proper bus format. We handle the bus formats that correspond to the DSI formats the bridge can potentially output (see chapter 13.6 of the i.MX 8MQ reference manual) - which matches what xsfb can input. Fixes: b776b0f ("drm: mxsfb: Use bus_format from the nearest bridge if present") Signed-off-by: Guido Günther <[email protected]> Reviewed-by: Lucas Stach <[email protected]> Reviewed-by: Sam Ravnborg <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/1712f2b952694fd4484dfd8576fbc5b4d7adf042.1633959458.git.agx@sigxcpu.org
1 parent ee30840 commit 2f1495f

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

drivers/gpu/drm/bridge/nwl-dsi.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -939,13 +939,48 @@ static void nwl_dsi_bridge_detach(struct drm_bridge *bridge)
939939
drm_of_panel_bridge_remove(dsi->dev->of_node, 1, 0);
940940
}
941941

942+
static u32 *nwl_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
943+
struct drm_bridge_state *bridge_state,
944+
struct drm_crtc_state *crtc_state,
945+
struct drm_connector_state *conn_state,
946+
u32 output_fmt,
947+
unsigned int *num_input_fmts)
948+
{
949+
u32 *input_fmts, input_fmt;
950+
951+
*num_input_fmts = 0;
952+
953+
switch (output_fmt) {
954+
/* If MEDIA_BUS_FMT_FIXED is tested, return default bus format */
955+
case MEDIA_BUS_FMT_FIXED:
956+
input_fmt = MEDIA_BUS_FMT_RGB888_1X24;
957+
break;
958+
case MEDIA_BUS_FMT_RGB888_1X24:
959+
case MEDIA_BUS_FMT_RGB666_1X18:
960+
case MEDIA_BUS_FMT_RGB565_1X16:
961+
input_fmt = output_fmt;
962+
break;
963+
default:
964+
return NULL;
965+
}
966+
967+
input_fmts = kcalloc(1, sizeof(*input_fmts), GFP_KERNEL);
968+
if (!input_fmts)
969+
return NULL;
970+
input_fmts[0] = input_fmt;
971+
*num_input_fmts = 1;
972+
973+
return input_fmts;
974+
}
975+
942976
static const struct drm_bridge_funcs nwl_dsi_bridge_funcs = {
943977
.atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
944978
.atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
945979
.atomic_reset = drm_atomic_helper_bridge_reset,
946980
.atomic_check = nwl_dsi_bridge_atomic_check,
947981
.atomic_enable = nwl_dsi_bridge_atomic_enable,
948982
.atomic_disable = nwl_dsi_bridge_atomic_disable,
983+
.atomic_get_input_bus_fmts = nwl_bridge_atomic_get_input_bus_fmts,
949984
.mode_set = nwl_dsi_bridge_mode_set,
950985
.mode_valid = nwl_dsi_bridge_mode_valid,
951986
.attach = nwl_dsi_bridge_attach,

0 commit comments

Comments
 (0)