diff options
Diffstat (limited to 'drivers/gpu/drm/drm_atomic_helper.c')
-rw-r--r-- | drivers/gpu/drm/drm_atomic_helper.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 3731a26979bc..a800b2c75522 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c | |||
@@ -1342,6 +1342,49 @@ drm_atomic_helper_commit_planes_on_crtc(struct drm_crtc_state *old_crtc_state) | |||
1342 | EXPORT_SYMBOL(drm_atomic_helper_commit_planes_on_crtc); | 1342 | EXPORT_SYMBOL(drm_atomic_helper_commit_planes_on_crtc); |
1343 | 1343 | ||
1344 | /** | 1344 | /** |
1345 | * drm_atomic_helper_disable_planes_on_crtc - helper to disable CRTC's planes | ||
1346 | * @crtc: CRTC | ||
1347 | * @atomic: if set, synchronize with CRTC's atomic_begin/flush hooks | ||
1348 | * | ||
1349 | * Disables all planes associated with the given CRTC. This can be | ||
1350 | * used for instance in the CRTC helper disable callback to disable | ||
1351 | * all planes before shutting down the display pipeline. | ||
1352 | * | ||
1353 | * If the atomic-parameter is set the function calls the CRTC's | ||
1354 | * atomic_begin hook before and atomic_flush hook after disabling the | ||
1355 | * planes. | ||
1356 | * | ||
1357 | * It is a bug to call this function without having implemented the | ||
1358 | * ->atomic_disable() plane hook. | ||
1359 | */ | ||
1360 | void drm_atomic_helper_disable_planes_on_crtc(struct drm_crtc *crtc, | ||
1361 | bool atomic) | ||
1362 | { | ||
1363 | const struct drm_crtc_helper_funcs *crtc_funcs = | ||
1364 | crtc->helper_private; | ||
1365 | struct drm_plane *plane; | ||
1366 | |||
1367 | if (atomic && crtc_funcs && crtc_funcs->atomic_begin) | ||
1368 | crtc_funcs->atomic_begin(crtc, NULL); | ||
1369 | |||
1370 | drm_for_each_plane(plane, crtc->dev) { | ||
1371 | const struct drm_plane_helper_funcs *plane_funcs = | ||
1372 | plane->helper_private; | ||
1373 | |||
1374 | if (plane->state->crtc != crtc || !plane_funcs) | ||
1375 | continue; | ||
1376 | |||
1377 | WARN_ON(!plane_funcs->atomic_disable); | ||
1378 | if (plane_funcs->atomic_disable) | ||
1379 | plane_funcs->atomic_disable(plane, NULL); | ||
1380 | } | ||
1381 | |||
1382 | if (atomic && crtc_funcs && crtc_funcs->atomic_flush) | ||
1383 | crtc_funcs->atomic_flush(crtc, NULL); | ||
1384 | } | ||
1385 | EXPORT_SYMBOL(drm_atomic_helper_disable_planes_on_crtc); | ||
1386 | |||
1387 | /** | ||
1345 | * drm_atomic_helper_cleanup_planes - cleanup plane resources after commit | 1388 | * drm_atomic_helper_cleanup_planes - cleanup plane resources after commit |
1346 | * @dev: DRM device | 1389 | * @dev: DRM device |
1347 | * @old_state: atomic state object with old state structures | 1390 | * @old_state: atomic state object with old state structures |