Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <marek.vasut+renesas@mailbox.org>
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Cc: stable@vger.kernel.org # v6.17+
Fixes: c9b1150a68d9 ("drm/atomic-helper: Re-order bridge chain pre-enable and post-disable")
Reviewed-by: Aradhya Bhatia <aradhya.bhatia@linux.dev>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Tested-by: Linus Walleij <linusw@kernel.org>
Signed-off-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20251205-drm-seq-fix-v1-3-fda68fa1b3de@ideasonboard.com

+121 -23
+99 -23
drivers/gpu/drm/drm_atomic_helper.c
··· 1162 1162 new_state->self_refresh_active; 1163 1163 } 1164 1164 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) 1167 1177 { 1168 1178 struct drm_connector *connector; 1169 1179 struct drm_connector_state *old_conn_state, *new_conn_state; ··· 1239 1229 } 1240 1230 } 1241 1231 } 1232 + EXPORT_SYMBOL(drm_atomic_helper_commit_encoder_bridge_disable); 1242 1233 1243 - static void 1244 - crtc_disable(struct drm_device *dev, struct drm_atomic_state *state) 1234 + /** 1235 + * drm_atomic_helper_commit_crtc_disable - disable CRTSs 1236 + * @dev: DRM device 1237 + * @state: the driver state object 1238 + * 1239 + * Loops over all CRTCs in the current state and if the CRTC needs 1240 + * it, disables it. 1241 + */ 1242 + void 1243 + drm_atomic_helper_commit_crtc_disable(struct drm_device *dev, struct drm_atomic_state *state) 1245 1244 { 1246 1245 struct drm_crtc *crtc; 1247 1246 struct drm_crtc_state *old_crtc_state, *new_crtc_state; ··· 1301 1282 drm_crtc_vblank_put(crtc); 1302 1283 } 1303 1284 } 1285 + EXPORT_SYMBOL(drm_atomic_helper_commit_crtc_disable); 1304 1286 1305 - static void 1306 - encoder_bridge_post_disable(struct drm_device *dev, struct drm_atomic_state *state) 1287 + /** 1288 + * drm_atomic_helper_commit_encoder_bridge_post_disable - post-disable encoder bridges 1289 + * @dev: DRM device 1290 + * @state: the driver state object 1291 + * 1292 + * Loops over all connectors in the current state and if the CRTC needs 1293 + * it, post-disables all encoder bridges. 1294 + */ 1295 + void 1296 + drm_atomic_helper_commit_encoder_bridge_post_disable(struct drm_device *dev, struct drm_atomic_state *state) 1307 1297 { 1308 1298 struct drm_connector *connector; 1309 1299 struct drm_connector_state *old_conn_state, *new_conn_state; ··· 1363 1335 drm_bridge_put(bridge); 1364 1336 } 1365 1337 } 1338 + EXPORT_SYMBOL(drm_atomic_helper_commit_encoder_bridge_post_disable); 1366 1339 1367 1340 static void 1368 1341 disable_outputs(struct drm_device *dev, struct drm_atomic_state *state) 1369 1342 { 1370 - encoder_bridge_disable(dev, state); 1343 + drm_atomic_helper_commit_encoder_bridge_disable(dev, state); 1371 1344 1372 - encoder_bridge_post_disable(dev, state); 1345 + drm_atomic_helper_commit_encoder_bridge_post_disable(dev, state); 1373 1346 1374 - crtc_disable(dev, state); 1347 + drm_atomic_helper_commit_crtc_disable(dev, state); 1375 1348 } 1376 1349 1377 1350 /** ··· 1475 1446 } 1476 1447 EXPORT_SYMBOL(drm_atomic_helper_calc_timestamping_constants); 1477 1448 1478 - static void 1479 - crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *state) 1449 + /** 1450 + * drm_atomic_helper_commit_crtc_set_mode - set the new mode 1451 + * @dev: DRM device 1452 + * @state: the driver state object 1453 + * 1454 + * Loops over all connectors in the current state and if the mode has 1455 + * changed, change the mode of the CRTC, then call down the bridge 1456 + * chain and change the mode in all bridges as well. 1457 + */ 1458 + void 1459 + drm_atomic_helper_commit_crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *state) 1480 1460 { 1481 1461 struct drm_crtc *crtc; 1482 1462 struct drm_crtc_state *new_crtc_state; ··· 1546 1508 drm_bridge_put(bridge); 1547 1509 } 1548 1510 } 1511 + EXPORT_SYMBOL(drm_atomic_helper_commit_crtc_set_mode); 1549 1512 1550 1513 /** 1551 1514 * drm_atomic_helper_commit_modeset_disables - modeset commit to disable outputs ··· 1570 1531 drm_atomic_helper_update_legacy_modeset_state(dev, state); 1571 1532 drm_atomic_helper_calc_timestamping_constants(state); 1572 1533 1573 - crtc_set_mode(dev, state); 1534 + drm_atomic_helper_commit_crtc_set_mode(dev, state); 1574 1535 } 1575 1536 EXPORT_SYMBOL(drm_atomic_helper_commit_modeset_disables); 1576 1537 1577 - static void drm_atomic_helper_commit_writebacks(struct drm_device *dev, 1578 - struct drm_atomic_state *state) 1538 + /** 1539 + * drm_atomic_helper_commit_writebacks - issue writebacks 1540 + * @dev: DRM device 1541 + * @state: atomic state object being committed 1542 + * 1543 + * This loops over the connectors, checks if the new state requires 1544 + * a writeback job to be issued and in that case issues an atomic 1545 + * commit on each connector. 1546 + */ 1547 + void drm_atomic_helper_commit_writebacks(struct drm_device *dev, 1548 + struct drm_atomic_state *state) 1579 1549 { 1580 1550 struct drm_connector *connector; 1581 1551 struct drm_connector_state *new_conn_state; ··· 1603 1555 } 1604 1556 } 1605 1557 } 1558 + EXPORT_SYMBOL(drm_atomic_helper_commit_writebacks); 1606 1559 1607 - static void 1608 - encoder_bridge_pre_enable(struct drm_device *dev, struct drm_atomic_state *state) 1560 + /** 1561 + * drm_atomic_helper_commit_encoder_bridge_pre_enable - pre-enable bridges 1562 + * @dev: DRM device 1563 + * @state: atomic state object being committed 1564 + * 1565 + * This loops over the connectors and if the CRTC needs it, pre-enables 1566 + * the entire bridge chain. 1567 + */ 1568 + void 1569 + drm_atomic_helper_commit_encoder_bridge_pre_enable(struct drm_device *dev, struct drm_atomic_state *state) 1609 1570 { 1610 1571 struct drm_connector *connector; 1611 1572 struct drm_connector_state *new_conn_state; ··· 1645 1588 drm_bridge_put(bridge); 1646 1589 } 1647 1590 } 1591 + EXPORT_SYMBOL(drm_atomic_helper_commit_encoder_bridge_pre_enable); 1648 1592 1649 - static void 1650 - crtc_enable(struct drm_device *dev, struct drm_atomic_state *state) 1593 + /** 1594 + * drm_atomic_helper_commit_crtc_enable - enables the CRTCs 1595 + * @dev: DRM device 1596 + * @state: atomic state object being committed 1597 + * 1598 + * This loops over CRTCs in the new state, and of the CRTC needs 1599 + * it, enables it. 1600 + */ 1601 + void 1602 + drm_atomic_helper_commit_crtc_enable(struct drm_device *dev, struct drm_atomic_state *state) 1651 1603 { 1652 1604 struct drm_crtc *crtc; 1653 1605 struct drm_crtc_state *old_crtc_state; ··· 1685 1619 } 1686 1620 } 1687 1621 } 1622 + EXPORT_SYMBOL(drm_atomic_helper_commit_crtc_enable); 1688 1623 1689 - static void 1690 - encoder_bridge_enable(struct drm_device *dev, struct drm_atomic_state *state) 1624 + /** 1625 + * drm_atomic_helper_commit_encoder_bridge_enable - enables the bridges 1626 + * @dev: DRM device 1627 + * @state: atomic state object being committed 1628 + * 1629 + * This loops over all connectors in the new state, and of the CRTC needs 1630 + * it, enables the entire bridge chain. 1631 + */ 1632 + void 1633 + drm_atomic_helper_commit_encoder_bridge_enable(struct drm_device *dev, struct drm_atomic_state *state) 1691 1634 { 1692 1635 struct drm_connector *connector; 1693 1636 struct drm_connector_state *new_conn_state; ··· 1739 1664 drm_bridge_put(bridge); 1740 1665 } 1741 1666 } 1667 + EXPORT_SYMBOL(drm_atomic_helper_commit_encoder_bridge_enable); 1742 1668 1743 1669 /** 1744 1670 * drm_atomic_helper_commit_modeset_enables - modeset commit to enable outputs ··· 1758 1682 void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev, 1759 1683 struct drm_atomic_state *state) 1760 1684 { 1761 - crtc_enable(dev, state); 1685 + drm_atomic_helper_commit_crtc_enable(dev, state); 1762 1686 1763 - encoder_bridge_pre_enable(dev, state); 1687 + drm_atomic_helper_commit_encoder_bridge_pre_enable(dev, state); 1764 1688 1765 - encoder_bridge_enable(dev, state); 1689 + drm_atomic_helper_commit_encoder_bridge_enable(dev, state); 1766 1690 1767 1691 drm_atomic_helper_commit_writebacks(dev, state); 1768 1692 }
+22
include/drm/drm_atomic_helper.h
··· 60 60 int drm_atomic_helper_check_planes(struct drm_device *dev, 61 61 struct drm_atomic_state *state); 62 62 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); 63 69 int drm_atomic_helper_check(struct drm_device *dev, 64 70 struct drm_atomic_state *state); 65 71 void drm_atomic_helper_commit_tail(struct drm_atomic_state *state); ··· 95 89 void 96 90 drm_atomic_helper_calc_timestamping_constants(struct drm_atomic_state *state); 97 91 92 + void drm_atomic_helper_commit_crtc_set_mode(struct drm_device *dev, 93 + struct drm_atomic_state *state); 94 + 98 95 void drm_atomic_helper_commit_modeset_disables(struct drm_device *dev, 99 96 struct drm_atomic_state *state); 97 + 98 + void drm_atomic_helper_commit_writebacks(struct drm_device *dev, 99 + struct drm_atomic_state *state); 100 + 101 + void drm_atomic_helper_commit_encoder_bridge_pre_enable(struct drm_device *dev, 102 + struct drm_atomic_state *state); 103 + 104 + void drm_atomic_helper_commit_crtc_enable(struct drm_device *dev, 105 + struct drm_atomic_state *state); 106 + 107 + void drm_atomic_helper_commit_encoder_bridge_enable(struct drm_device *dev, 108 + struct drm_atomic_state *state); 109 + 100 110 void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev, 101 111 struct drm_atomic_state *old_state); 102 112