drm/rockchip: logo: check whether the bridge supports atomic mode before mode fixup

According to the include/drm/drm_bridge.h, the following functions
are mandatory in atomic mode:
&drm_bridge_funcs.atomic_reset()
&drm_bridge_funcs.atomic_duplicate_state()
&drm_bridge_funcs.atomic_destroy_state()

For some bridge drivers that have not supported atomic mode yet:
drivers/gpu/drm/bridge/sii902x.c
drivers/gpu/drm/bridge/rk630-tve.c
......

The drm_atomic_get_bridge_state() should not be called to get the
bridge state by the global atomic state. Without this patch, the null
pointer exception will occur.

Fixes: 3558926745 ("drm/rockchip: logo: call drm_atomic_bridge_chain_check() bridge in mode fixup")
Change-Id: I68c953db21a95bf5454fc47c65958dee9d13a8ce
Signed-off-by: Damon Ding <damon.ding@rock-chips.com>
This commit is contained in:
Damon Ding
2025-02-24 20:16:31 +08:00
parent 2f6100f677
commit de85a5fecf

View File

@@ -739,7 +739,19 @@ static void rockchip_drm_mode_fixup(struct drm_crtc_state *crtc_state,
return;
bridge = drm_bridge_chain_get_first_bridge(encoder);
if (bridge) {
/*
* Check whether the bridge supports atomic mode or not.
* According to the include/drm/drm_bridge.h, the following functions
* are mandatory in atomic mode:
* &drm_bridge_funcs.atomic_reset()
* &drm_bridge_funcs.atomic_duplicate_state()
* &drm_bridge_funcs.atomic_destroy_state()
*
* For some bridge drivers that have not supported atomic mode yet:
* drivers/gpu/drm/bridge/sii902x.c
* drivers/gpu/drm/bridge/rk630-tve.c
*/
if (bridge && bridge->funcs->atomic_duplicate_state) {
bridge_state = drm_atomic_get_bridge_state(crtc_state->state, bridge);
if (IS_ERR(bridge_state))
return;