mirror of
https://github.com/torvalds/linux.git
synced 2024-11-07 20:51:47 +00:00
drm/atomic_helper: Add drm_atomic_helper_disable_planes_on_crtc()
Add drm_atomic_helper_disable_planes_on_crtc() for disabling all planes associated with the given CRTC. This can be used for instance in the CRTC helper disable callback to disable all planes before shutting down the display pipeline. v2: - Address Daniels review comments [1] - Do atomic_begin() and atomic_flush() always if they are defined and atomic knob is set - update kerneldoc - Put drm_atomic_helper_disable_planes_on_crtc() after drm_atomic_helper_commit_planes_on_crtc() in drm_atomic_helper.c to have functions in the same order as in drm_atomic_helper.h Signed-off-by: Jyri Sarha <jsarha@ti.com> Link: http://patchwork.freedesktop.org/patch/msgid/1448633641-6486-1-git-send-email-jsarha@ti.com Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
9b2c0b7fb4
commit
6753ba97e7
@ -1341,6 +1341,49 @@ drm_atomic_helper_commit_planes_on_crtc(struct drm_crtc_state *old_crtc_state)
|
||||
}
|
||||
EXPORT_SYMBOL(drm_atomic_helper_commit_planes_on_crtc);
|
||||
|
||||
/**
|
||||
* drm_atomic_helper_disable_planes_on_crtc - helper to disable CRTC's planes
|
||||
* @crtc: CRTC
|
||||
* @atomic: if set, synchronize with CRTC's atomic_begin/flush hooks
|
||||
*
|
||||
* Disables all planes associated with the given CRTC. This can be
|
||||
* used for instance in the CRTC helper disable callback to disable
|
||||
* all planes before shutting down the display pipeline.
|
||||
*
|
||||
* If the atomic-parameter is set the function calls the CRTC's
|
||||
* atomic_begin hook before and atomic_flush hook after disabling the
|
||||
* planes.
|
||||
*
|
||||
* It is a bug to call this function without having implemented the
|
||||
* ->atomic_disable() plane hook.
|
||||
*/
|
||||
void drm_atomic_helper_disable_planes_on_crtc(struct drm_crtc *crtc,
|
||||
bool atomic)
|
||||
{
|
||||
const struct drm_crtc_helper_funcs *crtc_funcs =
|
||||
crtc->helper_private;
|
||||
struct drm_plane *plane;
|
||||
|
||||
if (atomic && crtc_funcs && crtc_funcs->atomic_begin)
|
||||
crtc_funcs->atomic_begin(crtc, NULL);
|
||||
|
||||
drm_for_each_plane(plane, crtc->dev) {
|
||||
const struct drm_plane_helper_funcs *plane_funcs =
|
||||
plane->helper_private;
|
||||
|
||||
if (plane->state->crtc != crtc || !plane_funcs)
|
||||
continue;
|
||||
|
||||
WARN_ON(!plane_funcs->atomic_disable);
|
||||
if (plane_funcs->atomic_disable)
|
||||
plane_funcs->atomic_disable(plane, NULL);
|
||||
}
|
||||
|
||||
if (atomic && crtc_funcs && crtc_funcs->atomic_flush)
|
||||
crtc_funcs->atomic_flush(crtc, NULL);
|
||||
}
|
||||
EXPORT_SYMBOL(drm_atomic_helper_disable_planes_on_crtc);
|
||||
|
||||
/**
|
||||
* drm_atomic_helper_cleanup_planes - cleanup plane resources after commit
|
||||
* @dev: DRM device
|
||||
|
@ -62,6 +62,8 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev,
|
||||
void drm_atomic_helper_cleanup_planes(struct drm_device *dev,
|
||||
struct drm_atomic_state *old_state);
|
||||
void drm_atomic_helper_commit_planes_on_crtc(struct drm_crtc_state *old_crtc_state);
|
||||
void drm_atomic_helper_disable_planes_on_crtc(struct drm_crtc *crtc,
|
||||
bool atomic);
|
||||
|
||||
void drm_atomic_helper_swap_state(struct drm_device *dev,
|
||||
struct drm_atomic_state *state);
|
||||
|
Loading…
Reference in New Issue
Block a user