[PATCH RFC 11/19] drm/bridge: Patch atomic hooks to take a drm_bridge_state
Boris Brezillon
boris.brezillon at collabora.com
Thu Aug 8 15:11:42 UTC 2019
Instead of a drm_atomic_state. The only driver implementing those hooks
is patched too.
Signed-off-by: Boris Brezillon <boris.brezillon at collabora.com>
---
.../drm/bridge/analogix/analogix_dp_core.c | 12 ++--
drivers/gpu/drm/drm_bridge.c | 57 +++++++++++++++----
include/drm/drm_bridge.h | 8 +--
3 files changed, 57 insertions(+), 20 deletions(-)
diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
index b096a7a75c14..02b9ee0e4f7a 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
@@ -1290,8 +1290,9 @@ struct drm_crtc *analogix_dp_get_new_crtc(struct analogix_dp_device *dp,
}
static void analogix_dp_bridge_atomic_pre_enable(struct drm_bridge *bridge,
- struct drm_atomic_state *state)
+ struct drm_bridge_state *bstate)
{
+ struct drm_atomic_state *state = bstate->base.state;
struct analogix_dp_device *dp = bridge->driver_private;
struct drm_crtc *crtc;
struct drm_crtc_state *old_crtc_state;
@@ -1367,8 +1368,9 @@ static int analogix_dp_set_bridge(struct analogix_dp_device *dp)
}
static void analogix_dp_bridge_atomic_enable(struct drm_bridge *bridge,
- struct drm_atomic_state *state)
+ struct drm_bridge_state *bstate)
{
+ struct drm_atomic_state *state = bstate->base.state;
struct analogix_dp_device *dp = bridge->driver_private;
struct drm_crtc *crtc;
struct drm_crtc_state *old_crtc_state;
@@ -1441,8 +1443,9 @@ static void analogix_dp_bridge_disable(struct drm_bridge *bridge)
}
static void analogix_dp_bridge_atomic_disable(struct drm_bridge *bridge,
- struct drm_atomic_state *state)
+ struct drm_bridge_state *bstate)
{
+ struct drm_atomic_state *state = bstate->base.state;
struct analogix_dp_device *dp = bridge->driver_private;
struct drm_crtc *crtc;
struct drm_crtc_state *new_crtc_state = NULL;
@@ -1465,8 +1468,9 @@ static void analogix_dp_bridge_atomic_disable(struct drm_bridge *bridge,
static
void analogix_dp_bridge_atomic_post_disable(struct drm_bridge *bridge,
- struct drm_atomic_state *state)
+ struct drm_bridge_state *bstate)
{
+ struct drm_atomic_state *state = bstate->base.state;
struct analogix_dp_device *dp = bridge->driver_private;
struct drm_crtc *crtc;
struct drm_crtc_state *new_crtc_state;
diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
index 0280da6be1e6..0528ca941855 100644
--- a/drivers/gpu/drm/drm_bridge.c
+++ b/drivers/gpu/drm/drm_bridge.c
@@ -467,10 +467,18 @@ void drm_atomic_bridge_chain_disable(struct drm_encoder *encoder,
list_for_each_entry_reverse(bridge, &encoder->bridge_chain,
chain_node) {
- if (bridge->funcs->atomic_disable)
- bridge->funcs->atomic_disable(bridge, state);
- else if (bridge->funcs->disable)
+ if (bridge->funcs->atomic_disable) {
+ struct drm_bridge_state *bridge_state;
+
+ bridge_state = drm_atomic_get_old_bridge_state(state,
+ bridge);
+ if (WARN_ON(!bridge_state))
+ return;
+
+ bridge->funcs->atomic_disable(bridge, bridge_state);
+ } else if (bridge->funcs->disable) {
bridge->funcs->disable(bridge);
+ }
}
}
EXPORT_SYMBOL(drm_atomic_bridge_chain_disable);
@@ -492,10 +500,19 @@ void drm_atomic_bridge_chain_post_disable(struct drm_encoder *encoder,
struct drm_bridge *bridge;
list_for_each_entry(bridge, &encoder->bridge_chain, chain_node) {
- if (bridge->funcs->atomic_post_disable)
- bridge->funcs->atomic_post_disable(bridge, state);
- else if (bridge->funcs->post_disable)
+ if (bridge->funcs->atomic_post_disable) {
+ struct drm_bridge_state *bridge_state;
+
+ bridge_state = drm_atomic_get_old_bridge_state(state,
+ bridge);
+ if (WARN_ON(!bridge_state))
+ return;
+
+ bridge->funcs->atomic_post_disable(bridge,
+ bridge_state);
+ } else if (bridge->funcs->post_disable) {
bridge->funcs->post_disable(bridge);
+ }
}
}
EXPORT_SYMBOL(drm_atomic_bridge_chain_post_disable);
@@ -518,10 +535,18 @@ void drm_atomic_bridge_chain_pre_enable(struct drm_encoder *encoder,
list_for_each_entry_reverse(bridge, &encoder->bridge_chain,
chain_node) {
- if (bridge->funcs->atomic_pre_enable)
- bridge->funcs->atomic_pre_enable(bridge, state);
- else if (bridge->funcs->pre_enable)
+ if (bridge->funcs->atomic_pre_enable) {
+ struct drm_bridge_state *bridge_state;
+
+ bridge_state = drm_atomic_get_new_bridge_state(state,
+ bridge);
+ if (WARN_ON(!bridge_state))
+ return;
+
+ bridge->funcs->atomic_pre_enable(bridge, bridge_state);
+ } else if (bridge->funcs->pre_enable) {
bridge->funcs->pre_enable(bridge);
+ }
}
}
EXPORT_SYMBOL(drm_atomic_bridge_chain_pre_enable);
@@ -542,10 +567,18 @@ void drm_atomic_bridge_chain_enable(struct drm_encoder *encoder,
struct drm_bridge *bridge;
list_for_each_entry(bridge, &encoder->bridge_chain, chain_node) {
- if (bridge->funcs->atomic_enable)
- bridge->funcs->atomic_enable(bridge, state);
- else if (bridge->funcs->enable)
+ if (bridge->funcs->atomic_enable) {
+ struct drm_bridge_state *bridge_state;
+
+ bridge_state = drm_atomic_get_new_bridge_state(state,
+ bridge);
+ if (WARN_ON(!bridge_state))
+ return;
+
+ bridge->funcs->atomic_enable(bridge, bridge_state);
+ } else if (bridge->funcs->enable) {
bridge->funcs->enable(bridge);
+ }
}
}
EXPORT_SYMBOL(drm_atomic_bridge_chain_enable);
diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
index 8ca25d266d0c..9383b4e4b853 100644
--- a/include/drm/drm_bridge.h
+++ b/include/drm/drm_bridge.h
@@ -280,7 +280,7 @@ struct drm_bridge_funcs {
* The @atomic_pre_enable callback is optional.
*/
void (*atomic_pre_enable)(struct drm_bridge *bridge,
- struct drm_atomic_state *state);
+ struct drm_bridge_state *state);
/**
* @atomic_enable:
@@ -305,7 +305,7 @@ struct drm_bridge_funcs {
* The enable callback is optional.
*/
void (*atomic_enable)(struct drm_bridge *bridge,
- struct drm_atomic_state *state);
+ struct drm_bridge_state *state);
/**
* @atomic_disable:
*
@@ -328,7 +328,7 @@ struct drm_bridge_funcs {
* The disable callback is optional.
*/
void (*atomic_disable)(struct drm_bridge *bridge,
- struct drm_atomic_state *state);
+ struct drm_bridge_state *state);
/**
* @atomic_post_disable:
@@ -354,7 +354,7 @@ struct drm_bridge_funcs {
* The post_disable callback is optional.
*/
void (*atomic_post_disable)(struct drm_bridge *bridge,
- struct drm_atomic_state *state);
+ struct drm_bridge_state *state);
/**
* @atomic_duplicate_state:
--
2.21.0
More information about the dri-devel
mailing list