summaryrefslogtreecommitdiffstats
path: root/include/drm/drm_atomic_helper.h
diff options
context:
space:
mode:
authorRob Clark <robdclark@gmail.com>2014-11-25 20:29:46 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-11-27 15:39:09 +0100
commitdd275956aa176cf2ff00d5437c45f1552f1f3a11 (patch)
tree254ccf20f46968b64784cd31ea7fb4cf38f28248 /include/drm/drm_atomic_helper.h
parent6ddd388ab222b66b596342becc76d5031c0e2fc8 (diff)
downloadlinux-dd275956aa176cf2ff00d5437c45f1552f1f3a11.tar.gz
linux-dd275956aa176cf2ff00d5437c45f1552f1f3a11.tar.bz2
linux-dd275956aa176cf2ff00d5437c45f1552f1f3a11.zip
drm/atomic: add plane iterator macros
Add helper macros to iterate the current, or incoming set of planes attached to a crtc. These helpers are only available for drivers converted to use atomic-helpers. Signed-off-by: Rob Clark <robdclark@gmail.com> [danvet: Squash in fixup from Rob to move the planemask iterator to drm_crtc.h and document it. That one is needed by the atomic ioctl so can't be in a helper library.] Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'include/drm/drm_atomic_helper.h')
-rw-r--r--include/drm/drm_atomic_helper.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h
index 70a83197ef66..f956b413311e 100644
--- a/include/drm/drm_atomic_helper.h
+++ b/include/drm/drm_atomic_helper.h
@@ -98,5 +98,29 @@ drm_atomic_helper_connector_duplicate_state(struct drm_connector *connector);
void drm_atomic_helper_connector_destroy_state(struct drm_connector *connector,
struct drm_connector_state *state);
+/**
+ * drm_atomic_crtc_for_each_plane - iterate over planes currently attached to CRTC
+ * @plane: the loop cursor
+ * @crtc: the crtc whose planes are iterated
+ *
+ * This iterates over the current state, useful (for example) when applying
+ * atomic state after it has been checked and swapped. To iterate over the
+ * planes which *will* be attached (for ->atomic_check()) see
+ * drm_crtc_for_each_pending_plane()
+ */
+#define drm_atomic_crtc_for_each_plane(plane, crtc) \
+ drm_for_each_plane_mask(plane, (crtc)->dev, (crtc)->state->plane_mask)
+
+/**
+ * drm_crtc_atomic_state_for_each_plane - iterate over attached planes in new state
+ * @plane: the loop cursor
+ * @crtc_state: the incoming crtc-state
+ *
+ * Similar to drm_crtc_for_each_plane(), but iterates the planes that will be
+ * attached if the specified state is applied. Useful during (for example)
+ * ->atomic_check() operations, to validate the incoming state
+ */
+#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)
#endif /* DRM_ATOMIC_HELPER_H_ */