Commit b470743b authored by Boris Brezillon's avatar Boris Brezillon

Revert "drm/bridge: Patch atomic hooks to take a drm_bridge_state"

This reverts commit f7619a58 ("drm/bridge: Patch atomic hooks to
take a drm_bridge_state"). Commit 6ed7e962 ("drm/bridge: Add a
drm_bridge_state object") introduced a circular dependency between
drm.ko and drm_kms_helper.ko which uncovered a misdesign in how the
whole thing was implemented. Let's revert all patches depending on the
bridge_state infrastructure for now.
Signed-off-by: default avatarBoris Brezillon <boris.brezillon@collabora.com>
Acked-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200107185807.606999-5-boris.brezillon@collabora.com
parent 8de679ab
...@@ -1289,21 +1289,19 @@ struct drm_crtc *analogix_dp_get_new_crtc(struct analogix_dp_device *dp, ...@@ -1289,21 +1289,19 @@ struct drm_crtc *analogix_dp_get_new_crtc(struct analogix_dp_device *dp,
return conn_state->crtc; return conn_state->crtc;
} }
static void static void analogix_dp_bridge_atomic_pre_enable(struct drm_bridge *bridge,
analogix_dp_bridge_atomic_pre_enable(struct drm_bridge *bridge, struct drm_atomic_state *state)
struct drm_bridge_state *old_bridge_state)
{ {
struct drm_atomic_state *old_state = old_bridge_state->base.state;
struct analogix_dp_device *dp = bridge->driver_private; struct analogix_dp_device *dp = bridge->driver_private;
struct drm_crtc *crtc; struct drm_crtc *crtc;
struct drm_crtc_state *old_crtc_state; struct drm_crtc_state *old_crtc_state;
int ret; int ret;
crtc = analogix_dp_get_new_crtc(dp, old_state); crtc = analogix_dp_get_new_crtc(dp, state);
if (!crtc) if (!crtc)
return; return;
old_crtc_state = drm_atomic_get_old_crtc_state(old_state, crtc); old_crtc_state = drm_atomic_get_old_crtc_state(state, crtc);
/* Don't touch the panel if we're coming back from PSR */ /* Don't touch the panel if we're coming back from PSR */
if (old_crtc_state && old_crtc_state->self_refresh_active) if (old_crtc_state && old_crtc_state->self_refresh_active)
return; return;
...@@ -1368,22 +1366,20 @@ static int analogix_dp_set_bridge(struct analogix_dp_device *dp) ...@@ -1368,22 +1366,20 @@ static int analogix_dp_set_bridge(struct analogix_dp_device *dp)
return ret; return ret;
} }
static void static void analogix_dp_bridge_atomic_enable(struct drm_bridge *bridge,
analogix_dp_bridge_atomic_enable(struct drm_bridge *bridge, struct drm_atomic_state *state)
struct drm_bridge_state *old_bridge_state)
{ {
struct drm_atomic_state *old_state = old_bridge_state->base.state;
struct analogix_dp_device *dp = bridge->driver_private; struct analogix_dp_device *dp = bridge->driver_private;
struct drm_crtc *crtc; struct drm_crtc *crtc;
struct drm_crtc_state *old_crtc_state; struct drm_crtc_state *old_crtc_state;
int timeout_loop = 0; int timeout_loop = 0;
int ret; int ret;
crtc = analogix_dp_get_new_crtc(dp, old_state); crtc = analogix_dp_get_new_crtc(dp, state);
if (!crtc) if (!crtc)
return; return;
old_crtc_state = drm_atomic_get_old_crtc_state(old_state, crtc); old_crtc_state = drm_atomic_get_old_crtc_state(state, crtc);
/* Not a full enable, just disable PSR and continue */ /* Not a full enable, just disable PSR and continue */
if (old_crtc_state && old_crtc_state->self_refresh_active) { if (old_crtc_state && old_crtc_state->self_refresh_active) {
ret = analogix_dp_disable_psr(dp); ret = analogix_dp_disable_psr(dp);
...@@ -1444,20 +1440,18 @@ static void analogix_dp_bridge_disable(struct drm_bridge *bridge) ...@@ -1444,20 +1440,18 @@ static void analogix_dp_bridge_disable(struct drm_bridge *bridge)
dp->dpms_mode = DRM_MODE_DPMS_OFF; dp->dpms_mode = DRM_MODE_DPMS_OFF;
} }
static void static void analogix_dp_bridge_atomic_disable(struct drm_bridge *bridge,
analogix_dp_bridge_atomic_disable(struct drm_bridge *bridge, struct drm_atomic_state *state)
struct drm_bridge_state *old_bridge_state)
{ {
struct drm_atomic_state *old_state = old_bridge_state->base.state;
struct analogix_dp_device *dp = bridge->driver_private; struct analogix_dp_device *dp = bridge->driver_private;
struct drm_crtc *crtc; struct drm_crtc *crtc;
struct drm_crtc_state *new_crtc_state = NULL; struct drm_crtc_state *new_crtc_state = NULL;
crtc = analogix_dp_get_new_crtc(dp, old_state); crtc = analogix_dp_get_new_crtc(dp, state);
if (!crtc) if (!crtc)
goto out; goto out;
new_crtc_state = drm_atomic_get_new_crtc_state(old_state, crtc); new_crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
if (!new_crtc_state) if (!new_crtc_state)
goto out; goto out;
...@@ -1469,21 +1463,20 @@ analogix_dp_bridge_atomic_disable(struct drm_bridge *bridge, ...@@ -1469,21 +1463,20 @@ analogix_dp_bridge_atomic_disable(struct drm_bridge *bridge,
analogix_dp_bridge_disable(bridge); analogix_dp_bridge_disable(bridge);
} }
static void static
analogix_dp_bridge_atomic_post_disable(struct drm_bridge *bridge, void analogix_dp_bridge_atomic_post_disable(struct drm_bridge *bridge,
struct drm_bridge_state *old_bridge_state) struct drm_atomic_state *state)
{ {
struct drm_atomic_state *old_state = old_bridge_state->base.state;
struct analogix_dp_device *dp = bridge->driver_private; struct analogix_dp_device *dp = bridge->driver_private;
struct drm_crtc *crtc; struct drm_crtc *crtc;
struct drm_crtc_state *new_crtc_state; struct drm_crtc_state *new_crtc_state;
int ret; int ret;
crtc = analogix_dp_get_new_crtc(dp, old_state); crtc = analogix_dp_get_new_crtc(dp, state);
if (!crtc) if (!crtc)
return; return;
new_crtc_state = drm_atomic_get_new_crtc_state(old_state, crtc); new_crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
if (!new_crtc_state || !new_crtc_state->self_refresh_active) if (!new_crtc_state || !new_crtc_state->self_refresh_active)
return; return;
......
...@@ -501,19 +501,10 @@ void drm_atomic_bridge_chain_disable(struct drm_bridge *bridge, ...@@ -501,19 +501,10 @@ void drm_atomic_bridge_chain_disable(struct drm_bridge *bridge,
encoder = bridge->encoder; encoder = bridge->encoder;
list_for_each_entry_reverse(iter, &encoder->bridge_chain, chain_node) { list_for_each_entry_reverse(iter, &encoder->bridge_chain, chain_node) {
if (iter->funcs->atomic_disable) { if (iter->funcs->atomic_disable)
struct drm_bridge_state *old_bridge_state; iter->funcs->atomic_disable(iter, old_state);
else if (iter->funcs->disable)
old_bridge_state =
drm_atomic_get_old_bridge_state(old_state,
iter);
if (WARN_ON(!old_bridge_state))
return;
iter->funcs->atomic_disable(iter, old_bridge_state);
} else if (iter->funcs->disable) {
iter->funcs->disable(iter); iter->funcs->disable(iter);
}
if (iter == bridge) if (iter == bridge)
break; break;
...@@ -544,20 +535,10 @@ void drm_atomic_bridge_chain_post_disable(struct drm_bridge *bridge, ...@@ -544,20 +535,10 @@ void drm_atomic_bridge_chain_post_disable(struct drm_bridge *bridge,
encoder = bridge->encoder; encoder = bridge->encoder;
list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) { list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) {
if (bridge->funcs->atomic_post_disable) { if (bridge->funcs->atomic_post_disable)
struct drm_bridge_state *old_bridge_state; bridge->funcs->atomic_post_disable(bridge, old_state);
else if (bridge->funcs->post_disable)
old_bridge_state =
drm_atomic_get_old_bridge_state(old_state,
bridge);
if (WARN_ON(!old_bridge_state))
return;
bridge->funcs->atomic_post_disable(bridge,
old_bridge_state);
} else if (bridge->funcs->post_disable) {
bridge->funcs->post_disable(bridge); bridge->funcs->post_disable(bridge);
}
} }
} }
EXPORT_SYMBOL(drm_atomic_bridge_chain_post_disable); EXPORT_SYMBOL(drm_atomic_bridge_chain_post_disable);
...@@ -586,19 +567,10 @@ void drm_atomic_bridge_chain_pre_enable(struct drm_bridge *bridge, ...@@ -586,19 +567,10 @@ void drm_atomic_bridge_chain_pre_enable(struct drm_bridge *bridge,
encoder = bridge->encoder; encoder = bridge->encoder;
list_for_each_entry_reverse(iter, &encoder->bridge_chain, chain_node) { list_for_each_entry_reverse(iter, &encoder->bridge_chain, chain_node) {
if (iter->funcs->atomic_pre_enable) { if (iter->funcs->atomic_pre_enable)
struct drm_bridge_state *old_bridge_state; iter->funcs->atomic_pre_enable(iter, old_state);
else if (iter->funcs->pre_enable)
old_bridge_state =
drm_atomic_get_old_bridge_state(old_state,
iter);
if (WARN_ON(!old_bridge_state))
return;
iter->funcs->atomic_pre_enable(iter, old_bridge_state);
} else if (iter->funcs->pre_enable) {
iter->funcs->pre_enable(iter); iter->funcs->pre_enable(iter);
}
if (iter == bridge) if (iter == bridge)
break; break;
...@@ -628,19 +600,10 @@ void drm_atomic_bridge_chain_enable(struct drm_bridge *bridge, ...@@ -628,19 +600,10 @@ void drm_atomic_bridge_chain_enable(struct drm_bridge *bridge,
encoder = bridge->encoder; encoder = bridge->encoder;
list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) { list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) {
if (bridge->funcs->atomic_enable) { if (bridge->funcs->atomic_enable)
struct drm_bridge_state *old_bridge_state; bridge->funcs->atomic_enable(bridge, old_state);
else if (bridge->funcs->enable)
old_bridge_state =
drm_atomic_get_old_bridge_state(old_state,
bridge);
if (WARN_ON(!old_bridge_state))
return;
bridge->funcs->atomic_enable(bridge, old_bridge_state);
} else if (bridge->funcs->enable) {
bridge->funcs->enable(bridge); bridge->funcs->enable(bridge);
}
} }
} }
EXPORT_SYMBOL(drm_atomic_bridge_chain_enable); EXPORT_SYMBOL(drm_atomic_bridge_chain_enable);
......
...@@ -590,9 +590,8 @@ static void __rcar_lvds_atomic_enable(struct drm_bridge *bridge, ...@@ -590,9 +590,8 @@ static void __rcar_lvds_atomic_enable(struct drm_bridge *bridge,
} }
static void rcar_lvds_atomic_enable(struct drm_bridge *bridge, static void rcar_lvds_atomic_enable(struct drm_bridge *bridge,
struct drm_bridge_state *old_bridge_state) struct drm_atomic_state *state)
{ {
struct drm_atomic_state *state = old_bridge_state->base.state;
struct drm_connector *connector; struct drm_connector *connector;
struct drm_crtc *crtc; struct drm_crtc *crtc;
...@@ -604,7 +603,7 @@ static void rcar_lvds_atomic_enable(struct drm_bridge *bridge, ...@@ -604,7 +603,7 @@ static void rcar_lvds_atomic_enable(struct drm_bridge *bridge,
} }
static void rcar_lvds_atomic_disable(struct drm_bridge *bridge, static void rcar_lvds_atomic_disable(struct drm_bridge *bridge,
struct drm_bridge_state *old_bridge_state) struct drm_atomic_state *state)
{ {
struct rcar_lvds *lvds = bridge_to_rcar_lvds(bridge); struct rcar_lvds *lvds = bridge_to_rcar_lvds(bridge);
...@@ -619,8 +618,7 @@ static void rcar_lvds_atomic_disable(struct drm_bridge *bridge, ...@@ -619,8 +618,7 @@ static void rcar_lvds_atomic_disable(struct drm_bridge *bridge,
/* Disable the companion LVDS encoder in dual-link mode. */ /* Disable the companion LVDS encoder in dual-link mode. */
if (lvds->link_type != RCAR_LVDS_SINGLE_LINK && lvds->companion) if (lvds->link_type != RCAR_LVDS_SINGLE_LINK && lvds->companion)
lvds->companion->funcs->atomic_disable(lvds->companion, lvds->companion->funcs->atomic_disable(lvds->companion, state);
old_bridge_state);
clk_disable_unprepare(lvds->clocks.mod); clk_disable_unprepare(lvds->clocks.mod);
} }
......
...@@ -282,7 +282,7 @@ struct drm_bridge_funcs { ...@@ -282,7 +282,7 @@ struct drm_bridge_funcs {
* The @atomic_pre_enable callback is optional. * The @atomic_pre_enable callback is optional.
*/ */
void (*atomic_pre_enable)(struct drm_bridge *bridge, void (*atomic_pre_enable)(struct drm_bridge *bridge,
struct drm_bridge_state *old_bridge_state); struct drm_atomic_state *old_state);
/** /**
* @atomic_enable: * @atomic_enable:
...@@ -307,7 +307,7 @@ struct drm_bridge_funcs { ...@@ -307,7 +307,7 @@ struct drm_bridge_funcs {
* The @atomic_enable callback is optional. * The @atomic_enable callback is optional.
*/ */
void (*atomic_enable)(struct drm_bridge *bridge, void (*atomic_enable)(struct drm_bridge *bridge,
struct drm_bridge_state *old_bridge_state); struct drm_atomic_state *old_state);
/** /**
* @atomic_disable: * @atomic_disable:
* *
...@@ -330,7 +330,7 @@ struct drm_bridge_funcs { ...@@ -330,7 +330,7 @@ struct drm_bridge_funcs {
* The @atomic_disable callback is optional. * The @atomic_disable callback is optional.
*/ */
void (*atomic_disable)(struct drm_bridge *bridge, void (*atomic_disable)(struct drm_bridge *bridge,
struct drm_bridge_state *old_bridge_state); struct drm_atomic_state *old_state);
/** /**
* @atomic_post_disable: * @atomic_post_disable:
...@@ -356,7 +356,7 @@ struct drm_bridge_funcs { ...@@ -356,7 +356,7 @@ struct drm_bridge_funcs {
* The @atomic_post_disable callback is optional. * The @atomic_post_disable callback is optional.
*/ */
void (*atomic_post_disable)(struct drm_bridge *bridge, void (*atomic_post_disable)(struct drm_bridge *bridge,
struct drm_bridge_state *old_bridge_state); struct drm_atomic_state *old_state);
/** /**
* @atomic_duplicate_state: * @atomic_duplicate_state:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment