Skip to content

Commit d1c7dc5

Browse files
committed
drm/atomic-helper: Export and namespace some functions
Export and namespace those not prefixed with drm_* so it becomes possible to write custom commit tail functions in individual drivers using the helper infrastructure. Tested-by: Marek Vasut <[email protected]> Reviewed-by: Maxime Ripard <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]> Cc: [email protected] # v6.17+ Fixes: c9b1150 ("drm/atomic-helper: Re-order bridge chain pre-enable and post-disable") Reviewed-by: Aradhya Bhatia <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Tested-by: Linus Walleij <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 33e8150 commit d1c7dc5

2 files changed

Lines changed: 121 additions & 23 deletions

File tree

drivers/gpu/drm/drm_atomic_helper.c

Lines changed: 99 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,8 +1162,18 @@ crtc_needs_disable(struct drm_crtc_state *old_state,
11621162
new_state->self_refresh_active;
11631163
}
11641164

1165-
static void
1166-
encoder_bridge_disable(struct drm_device *dev, struct drm_atomic_state *state)
1165+
/**
1166+
* drm_atomic_helper_commit_encoder_bridge_disable - disable bridges and encoder
1167+
* @dev: DRM device
1168+
* @state: the driver state object
1169+
*
1170+
* Loops over all connectors in the current state and if the CRTC needs
1171+
* it, disables the bridge chain all the way, then disables the encoder
1172+
* afterwards.
1173+
*/
1174+
void
1175+
drm_atomic_helper_commit_encoder_bridge_disable(struct drm_device *dev,
1176+
struct drm_atomic_state *state)
11671177
{
11681178
struct drm_connector *connector;
11691179
struct drm_connector_state *old_conn_state, *new_conn_state;
@@ -1229,9 +1239,18 @@ encoder_bridge_disable(struct drm_device *dev, struct drm_atomic_state *state)
12291239
}
12301240
}
12311241
}
1242+
EXPORT_SYMBOL(drm_atomic_helper_commit_encoder_bridge_disable);
12321243

1233-
static void
1234-
crtc_disable(struct drm_device *dev, struct drm_atomic_state *state)
1244+
/**
1245+
* drm_atomic_helper_commit_crtc_disable - disable CRTSs
1246+
* @dev: DRM device
1247+
* @state: the driver state object
1248+
*
1249+
* Loops over all CRTCs in the current state and if the CRTC needs
1250+
* it, disables it.
1251+
*/
1252+
void
1253+
drm_atomic_helper_commit_crtc_disable(struct drm_device *dev, struct drm_atomic_state *state)
12351254
{
12361255
struct drm_crtc *crtc;
12371256
struct drm_crtc_state *old_crtc_state, *new_crtc_state;
@@ -1282,9 +1301,18 @@ crtc_disable(struct drm_device *dev, struct drm_atomic_state *state)
12821301
drm_crtc_vblank_put(crtc);
12831302
}
12841303
}
1304+
EXPORT_SYMBOL(drm_atomic_helper_commit_crtc_disable);
12851305

1286-
static void
1287-
encoder_bridge_post_disable(struct drm_device *dev, struct drm_atomic_state *state)
1306+
/**
1307+
* drm_atomic_helper_commit_encoder_bridge_post_disable - post-disable encoder bridges
1308+
* @dev: DRM device
1309+
* @state: the driver state object
1310+
*
1311+
* Loops over all connectors in the current state and if the CRTC needs
1312+
* it, post-disables all encoder bridges.
1313+
*/
1314+
void
1315+
drm_atomic_helper_commit_encoder_bridge_post_disable(struct drm_device *dev, struct drm_atomic_state *state)
12881316
{
12891317
struct drm_connector *connector;
12901318
struct drm_connector_state *old_conn_state, *new_conn_state;
@@ -1335,15 +1363,16 @@ encoder_bridge_post_disable(struct drm_device *dev, struct drm_atomic_state *sta
13351363
drm_bridge_put(bridge);
13361364
}
13371365
}
1366+
EXPORT_SYMBOL(drm_atomic_helper_commit_encoder_bridge_post_disable);
13381367

13391368
static void
13401369
disable_outputs(struct drm_device *dev, struct drm_atomic_state *state)
13411370
{
1342-
encoder_bridge_disable(dev, state);
1371+
drm_atomic_helper_commit_encoder_bridge_disable(dev, state);
13431372

1344-
encoder_bridge_post_disable(dev, state);
1373+
drm_atomic_helper_commit_encoder_bridge_post_disable(dev, state);
13451374

1346-
crtc_disable(dev, state);
1375+
drm_atomic_helper_commit_crtc_disable(dev, state);
13471376
}
13481377

13491378
/**
@@ -1446,8 +1475,17 @@ void drm_atomic_helper_calc_timestamping_constants(struct drm_atomic_state *stat
14461475
}
14471476
EXPORT_SYMBOL(drm_atomic_helper_calc_timestamping_constants);
14481477

1449-
static void
1450-
crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *state)
1478+
/**
1479+
* drm_atomic_helper_commit_crtc_set_mode - set the new mode
1480+
* @dev: DRM device
1481+
* @state: the driver state object
1482+
*
1483+
* Loops over all connectors in the current state and if the mode has
1484+
* changed, change the mode of the CRTC, then call down the bridge
1485+
* chain and change the mode in all bridges as well.
1486+
*/
1487+
void
1488+
drm_atomic_helper_commit_crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *state)
14511489
{
14521490
struct drm_crtc *crtc;
14531491
struct drm_crtc_state *new_crtc_state;
@@ -1508,6 +1546,7 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *state)
15081546
drm_bridge_put(bridge);
15091547
}
15101548
}
1549+
EXPORT_SYMBOL(drm_atomic_helper_commit_crtc_set_mode);
15111550

15121551
/**
15131552
* drm_atomic_helper_commit_modeset_disables - modeset commit to disable outputs
@@ -1531,12 +1570,21 @@ void drm_atomic_helper_commit_modeset_disables(struct drm_device *dev,
15311570
drm_atomic_helper_update_legacy_modeset_state(dev, state);
15321571
drm_atomic_helper_calc_timestamping_constants(state);
15331572

1534-
crtc_set_mode(dev, state);
1573+
drm_atomic_helper_commit_crtc_set_mode(dev, state);
15351574
}
15361575
EXPORT_SYMBOL(drm_atomic_helper_commit_modeset_disables);
15371576

1538-
static void drm_atomic_helper_commit_writebacks(struct drm_device *dev,
1539-
struct drm_atomic_state *state)
1577+
/**
1578+
* drm_atomic_helper_commit_writebacks - issue writebacks
1579+
* @dev: DRM device
1580+
* @state: atomic state object being committed
1581+
*
1582+
* This loops over the connectors, checks if the new state requires
1583+
* a writeback job to be issued and in that case issues an atomic
1584+
* commit on each connector.
1585+
*/
1586+
void drm_atomic_helper_commit_writebacks(struct drm_device *dev,
1587+
struct drm_atomic_state *state)
15401588
{
15411589
struct drm_connector *connector;
15421590
struct drm_connector_state *new_conn_state;
@@ -1555,9 +1603,18 @@ static void drm_atomic_helper_commit_writebacks(struct drm_device *dev,
15551603
}
15561604
}
15571605
}
1606+
EXPORT_SYMBOL(drm_atomic_helper_commit_writebacks);
15581607

1559-
static void
1560-
encoder_bridge_pre_enable(struct drm_device *dev, struct drm_atomic_state *state)
1608+
/**
1609+
* drm_atomic_helper_commit_encoder_bridge_pre_enable - pre-enable bridges
1610+
* @dev: DRM device
1611+
* @state: atomic state object being committed
1612+
*
1613+
* This loops over the connectors and if the CRTC needs it, pre-enables
1614+
* the entire bridge chain.
1615+
*/
1616+
void
1617+
drm_atomic_helper_commit_encoder_bridge_pre_enable(struct drm_device *dev, struct drm_atomic_state *state)
15611618
{
15621619
struct drm_connector *connector;
15631620
struct drm_connector_state *new_conn_state;
@@ -1588,9 +1645,18 @@ encoder_bridge_pre_enable(struct drm_device *dev, struct drm_atomic_state *state
15881645
drm_bridge_put(bridge);
15891646
}
15901647
}
1648+
EXPORT_SYMBOL(drm_atomic_helper_commit_encoder_bridge_pre_enable);
15911649

1592-
static void
1593-
crtc_enable(struct drm_device *dev, struct drm_atomic_state *state)
1650+
/**
1651+
* drm_atomic_helper_commit_crtc_enable - enables the CRTCs
1652+
* @dev: DRM device
1653+
* @state: atomic state object being committed
1654+
*
1655+
* This loops over CRTCs in the new state, and of the CRTC needs
1656+
* it, enables it.
1657+
*/
1658+
void
1659+
drm_atomic_helper_commit_crtc_enable(struct drm_device *dev, struct drm_atomic_state *state)
15941660
{
15951661
struct drm_crtc *crtc;
15961662
struct drm_crtc_state *old_crtc_state;
@@ -1619,9 +1685,18 @@ crtc_enable(struct drm_device *dev, struct drm_atomic_state *state)
16191685
}
16201686
}
16211687
}
1688+
EXPORT_SYMBOL(drm_atomic_helper_commit_crtc_enable);
16221689

1623-
static void
1624-
encoder_bridge_enable(struct drm_device *dev, struct drm_atomic_state *state)
1690+
/**
1691+
* drm_atomic_helper_commit_encoder_bridge_enable - enables the bridges
1692+
* @dev: DRM device
1693+
* @state: atomic state object being committed
1694+
*
1695+
* This loops over all connectors in the new state, and of the CRTC needs
1696+
* it, enables the entire bridge chain.
1697+
*/
1698+
void
1699+
drm_atomic_helper_commit_encoder_bridge_enable(struct drm_device *dev, struct drm_atomic_state *state)
16251700
{
16261701
struct drm_connector *connector;
16271702
struct drm_connector_state *new_conn_state;
@@ -1664,6 +1739,7 @@ encoder_bridge_enable(struct drm_device *dev, struct drm_atomic_state *state)
16641739
drm_bridge_put(bridge);
16651740
}
16661741
}
1742+
EXPORT_SYMBOL(drm_atomic_helper_commit_encoder_bridge_enable);
16671743

16681744
/**
16691745
* drm_atomic_helper_commit_modeset_enables - modeset commit to enable outputs
@@ -1682,11 +1758,11 @@ encoder_bridge_enable(struct drm_device *dev, struct drm_atomic_state *state)
16821758
void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,
16831759
struct drm_atomic_state *state)
16841760
{
1685-
crtc_enable(dev, state);
1761+
drm_atomic_helper_commit_crtc_enable(dev, state);
16861762

1687-
encoder_bridge_pre_enable(dev, state);
1763+
drm_atomic_helper_commit_encoder_bridge_pre_enable(dev, state);
16881764

1689-
encoder_bridge_enable(dev, state);
1765+
drm_atomic_helper_commit_encoder_bridge_enable(dev, state);
16901766

16911767
drm_atomic_helper_commit_writebacks(dev, state);
16921768
}

include/drm/drm_atomic_helper.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state,
6060
int drm_atomic_helper_check_planes(struct drm_device *dev,
6161
struct drm_atomic_state *state);
6262
int drm_atomic_helper_check_crtc_primary_plane(struct drm_crtc_state *crtc_state);
63+
void drm_atomic_helper_commit_encoder_bridge_disable(struct drm_device *dev,
64+
struct drm_atomic_state *state);
65+
void drm_atomic_helper_commit_crtc_disable(struct drm_device *dev,
66+
struct drm_atomic_state *state);
67+
void drm_atomic_helper_commit_encoder_bridge_post_disable(struct drm_device *dev,
68+
struct drm_atomic_state *state);
6369
int drm_atomic_helper_check(struct drm_device *dev,
6470
struct drm_atomic_state *state);
6571
void drm_atomic_helper_commit_tail(struct drm_atomic_state *state);
@@ -89,8 +95,24 @@ drm_atomic_helper_update_legacy_modeset_state(struct drm_device *dev,
8995
void
9096
drm_atomic_helper_calc_timestamping_constants(struct drm_atomic_state *state);
9197

98+
void drm_atomic_helper_commit_crtc_set_mode(struct drm_device *dev,
99+
struct drm_atomic_state *state);
100+
92101
void drm_atomic_helper_commit_modeset_disables(struct drm_device *dev,
93102
struct drm_atomic_state *state);
103+
104+
void drm_atomic_helper_commit_writebacks(struct drm_device *dev,
105+
struct drm_atomic_state *state);
106+
107+
void drm_atomic_helper_commit_encoder_bridge_pre_enable(struct drm_device *dev,
108+
struct drm_atomic_state *state);
109+
110+
void drm_atomic_helper_commit_crtc_enable(struct drm_device *dev,
111+
struct drm_atomic_state *state);
112+
113+
void drm_atomic_helper_commit_encoder_bridge_enable(struct drm_device *dev,
114+
struct drm_atomic_state *state);
115+
94116
void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,
95117
struct drm_atomic_state *old_state);
96118

0 commit comments

Comments
 (0)