|
@@ -127,4 +127,41 @@ void drm_atomic_helper_connector_destroy_state(struct drm_connector *connector,
|
|
|
#define drm_atomic_crtc_state_for_each_plane(plane, crtc_state) \
|
|
|
drm_for_each_plane_mask(plane, (crtc_state)->state->dev, (crtc_state)->plane_mask)
|
|
|
|
|
|
+/*
|
|
|
+ * drm_atomic_plane_disabling - check whether a plane is being disabled
|
|
|
+ * @plane: plane object
|
|
|
+ * @old_state: previous atomic state
|
|
|
+ *
|
|
|
+ * Checks the atomic state of a plane to determine whether it's being disabled
|
|
|
+ * or not. This also WARNs if it detects an invalid state (both CRTC and FB
|
|
|
+ * need to either both be NULL or both be non-NULL).
|
|
|
+ *
|
|
|
+ * RETURNS:
|
|
|
+ * True if the plane is being disabled, false otherwise.
|
|
|
+ */
|
|
|
+static inline bool
|
|
|
+drm_atomic_plane_disabling(struct drm_plane *plane,
|
|
|
+ struct drm_plane_state *old_state)
|
|
|
+{
|
|
|
+ /*
|
|
|
+ * When disabling a plane, CRTC and FB should always be NULL together.
|
|
|
+ * Anything else should be considered a bug in the atomic core, so we
|
|
|
+ * gently warn about it.
|
|
|
+ */
|
|
|
+ WARN_ON((plane->state->crtc == NULL && plane->state->fb != NULL) ||
|
|
|
+ (plane->state->crtc != NULL && plane->state->fb == NULL));
|
|
|
+
|
|
|
+ /*
|
|
|
+ * When using the transitional helpers, old_state may be NULL. If so,
|
|
|
+ * we know nothing about the current state and have to assume that it
|
|
|
+ * might be enabled.
|
|
|
+ *
|
|
|
+ * When using the atomic helpers, old_state won't be NULL. Therefore
|
|
|
+ * this check assumes that either the driver will have reconstructed
|
|
|
+ * the correct state in ->reset() or that the driver will have taken
|
|
|
+ * appropriate measures to disable all planes.
|
|
|
+ */
|
|
|
+ return (!old_state || old_state->crtc) && !plane->state->crtc;
|
|
|
+}
|
|
|
+
|
|
|
#endif /* DRM_ATOMIC_HELPER_H_ */
|