Bridge drivers can subclass drm_bridge_state, but the state is printed by the bridge core, which only knows about the bus configuration. The driver-specific part of the state is thus missing from the state dumps, making it hard to debug such drivers.
Add an optional atomic_print_state callback letting bridge drivers print the rest of their state. Assisted-by: LLM Signed-off-by: Dmitry Baryshkov <[email protected]> --- drivers/gpu/drm/drm_bridge.c | 3 +++ include/drm/drm_bridge.h | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index 0f37e3ade016..2b06171b122a 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -571,6 +571,9 @@ drm_bridge_atomic_print_priv_state(struct drm_printer *p, drm_printf_indent(p, 1, "output bus configuration:\n"); drm_printf_indent(p, 2, "code: %04x\n", state->output_bus_cfg.format); drm_printf_indent(p, 2, "flags: %08x\n", state->output_bus_cfg.flags); + + if (bridge->funcs->atomic_print_state) + bridge->funcs->atomic_print_state(p, state); } static const struct drm_private_state_funcs drm_bridge_priv_state_funcs = { diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index 1981d24a700d..8b0c72d93d9b 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -312,6 +312,15 @@ struct drm_bridge_funcs { void (*atomic_destroy_state)(struct drm_bridge *bridge, struct drm_bridge_state *state); + /** + * @atomic_print_state: + * + * If driver subclasses &struct drm_bridge_state, it should implement + * this optional hook for printing additional driver specific state. + */ + void (*atomic_print_state)(struct drm_printer *p, + const struct drm_bridge_state *state); + /** * @atomic_get_output_bus_fmts: * -- 2.47.3
