aboutsummaryrefslogtreecommitdiffstats
path: root/include/drm/drm_atomic_helper.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/drm/drm_atomic_helper.h')
-rw-r--r--include/drm/drm_atomic_helper.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h
index 2095917ff8c7..a0ea4ded3cb5 100644
--- a/include/drm/drm_atomic_helper.h
+++ b/include/drm/drm_atomic_helper.h
@@ -127,4 +127,41 @@ void drm_atomic_helper_connector_destroy_state(struct drm_connector *connector,
127#define drm_atomic_crtc_state_for_each_plane(plane, crtc_state) \ 127#define drm_atomic_crtc_state_for_each_plane(plane, crtc_state) \
128 drm_for_each_plane_mask(plane, (crtc_state)->state->dev, (crtc_state)->plane_mask) 128 drm_for_each_plane_mask(plane, (crtc_state)->state->dev, (crtc_state)->plane_mask)
129 129
130/*
131 * drm_atomic_plane_disabling - check whether a plane is being disabled
132 * @plane: plane object
133 * @old_state: previous atomic state
134 *
135 * Checks the atomic state of a plane to determine whether it's being disabled
136 * or not. This also WARNs if it detects an invalid state (both CRTC and FB
137 * need to either both be NULL or both be non-NULL).
138 *
139 * RETURNS:
140 * True if the plane is being disabled, false otherwise.
141 */
142static inline bool
143drm_atomic_plane_disabling(struct drm_plane *plane,
144 struct drm_plane_state *old_state)
145{
146 /*
147 * When disabling a plane, CRTC and FB should always be NULL together.
148 * Anything else should be considered a bug in the atomic core, so we
149 * gently warn about it.
150 */
151 WARN_ON((plane->state->crtc == NULL && plane->state->fb != NULL) ||
152 (plane->state->crtc != NULL && plane->state->fb == NULL));
153
154 /*
155 * When using the transitional helpers, old_state may be NULL. If so,
156 * we know nothing about the current state and have to assume that it
157 * might be enabled.
158 *
159 * When using the atomic helpers, old_state won't be NULL. Therefore
160 * this check assumes that either the driver will have reconstructed
161 * the correct state in ->reset() or that the driver will have taken
162 * appropriate measures to disable all planes.
163 */
164 return (!old_state || old_state->crtc) && !plane->state->crtc;
165}
166
130#endif /* DRM_ATOMIC_HELPER_H_ */ 167#endif /* DRM_ATOMIC_HELPER_H_ */