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.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h
index f956b413311e..8039d54a7441 100644
--- a/include/drm/drm_atomic_helper.h
+++ b/include/drm/drm_atomic_helper.h
@@ -30,6 +30,10 @@
30 30
31#include <drm/drm_crtc.h> 31#include <drm/drm_crtc.h>
32 32
33int drm_atomic_helper_check_modeset(struct drm_device *dev,
34 struct drm_atomic_state *state);
35int drm_atomic_helper_check_planes(struct drm_device *dev,
36 struct drm_atomic_state *state);
33int drm_atomic_helper_check(struct drm_device *dev, 37int drm_atomic_helper_check(struct drm_device *dev,
34 struct drm_atomic_state *state); 38 struct drm_atomic_state *state);
35int drm_atomic_helper_commit(struct drm_device *dev, 39int drm_atomic_helper_commit(struct drm_device *dev,
@@ -78,6 +82,8 @@ int drm_atomic_helper_page_flip(struct drm_crtc *crtc,
78 struct drm_framebuffer *fb, 82 struct drm_framebuffer *fb,
79 struct drm_pending_vblank_event *event, 83 struct drm_pending_vblank_event *event,
80 uint32_t flags); 84 uint32_t flags);
85void drm_atomic_helper_connector_dpms(struct drm_connector *connector,
86 int mode);
81 87
82/* default implementations for state handling */ 88/* default implementations for state handling */
83void drm_atomic_helper_crtc_reset(struct drm_crtc *crtc); 89void drm_atomic_helper_crtc_reset(struct drm_crtc *crtc);
@@ -123,4 +129,41 @@ void drm_atomic_helper_connector_destroy_state(struct drm_connector *connector,
123#define drm_atomic_crtc_state_for_each_plane(plane, crtc_state) \ 129#define drm_atomic_crtc_state_for_each_plane(plane, crtc_state) \
124 drm_for_each_plane_mask(plane, (crtc_state)->state->dev, (crtc_state)->plane_mask) 130 drm_for_each_plane_mask(plane, (crtc_state)->state->dev, (crtc_state)->plane_mask)
125 131
132/*
133 * drm_atomic_plane_disabling - check whether a plane is being disabled
134 * @plane: plane object
135 * @old_state: previous atomic state
136 *
137 * Checks the atomic state of a plane to determine whether it's being disabled
138 * or not. This also WARNs if it detects an invalid state (both CRTC and FB
139 * need to either both be NULL or both be non-NULL).
140 *
141 * RETURNS:
142 * True if the plane is being disabled, false otherwise.
143 */
144static inline bool
145drm_atomic_plane_disabling(struct drm_plane *plane,
146 struct drm_plane_state *old_state)
147{
148 /*
149 * When disabling a plane, CRTC and FB should always be NULL together.
150 * Anything else should be considered a bug in the atomic core, so we
151 * gently warn about it.
152 */
153 WARN_ON((plane->state->crtc == NULL && plane->state->fb != NULL) ||
154 (plane->state->crtc != NULL && plane->state->fb == NULL));
155
156 /*
157 * When using the transitional helpers, old_state may be NULL. If so,
158 * we know nothing about the current state and have to assume that it
159 * might be enabled.
160 *
161 * When using the atomic helpers, old_state won't be NULL. Therefore
162 * this check assumes that either the driver will have reconstructed
163 * the correct state in ->reset() or that the driver will have taken
164 * appropriate measures to disable all planes.
165 */
166 return (!old_state || old_state->crtc) && !plane->state->crtc;
167}
168
126#endif /* DRM_ATOMIC_HELPER_H_ */ 169#endif /* DRM_ATOMIC_HELPER_H_ */