diff options
author | Rob Clark <robdclark@gmail.com> | 2014-11-25 20:29:46 -0500 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-11-27 09:39:09 -0500 |
commit | dd275956aa176cf2ff00d5437c45f1552f1f3a11 (patch) | |
tree | 254ccf20f46968b64784cd31ea7fb4cf38f28248 | |
parent | 6ddd388ab222b66b596342becc76d5031c0e2fc8 (diff) |
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>
-rw-r--r-- | Documentation/DocBook/drm.tmpl | 1 | ||||
-rw-r--r-- | include/drm/drm_atomic_helper.h | 24 | ||||
-rw-r--r-- | include/drm/drm_crtc.h | 13 |
3 files changed, 38 insertions, 0 deletions
diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl index 8c54f9a393cf..3789f2db3c21 100644 --- a/Documentation/DocBook/drm.tmpl +++ b/Documentation/DocBook/drm.tmpl | |||
@@ -2343,6 +2343,7 @@ void intel_crt_init(struct drm_device *dev) | |||
2343 | <title>Atomic State Reset and Initialization</title> | 2343 | <title>Atomic State Reset and Initialization</title> |
2344 | !Pdrivers/gpu/drm/drm_atomic_helper.c atomic state reset and initialization | 2344 | !Pdrivers/gpu/drm/drm_atomic_helper.c atomic state reset and initialization |
2345 | </sect3> | 2345 | </sect3> |
2346 | !Iinclude/drm/drm_atomic_helper.h | ||
2346 | !Edrivers/gpu/drm/drm_atomic_helper.c | 2347 | !Edrivers/gpu/drm/drm_atomic_helper.c |
2347 | </sect2> | 2348 | </sect2> |
2348 | <sect2> | 2349 | <sect2> |
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); | |||
98 | void drm_atomic_helper_connector_destroy_state(struct drm_connector *connector, | 98 | void drm_atomic_helper_connector_destroy_state(struct drm_connector *connector, |
99 | struct drm_connector_state *state); | 99 | struct drm_connector_state *state); |
100 | 100 | ||
101 | /** | ||
102 | * drm_atomic_crtc_for_each_plane - iterate over planes currently attached to CRTC | ||
103 | * @plane: the loop cursor | ||
104 | * @crtc: the crtc whose planes are iterated | ||
105 | * | ||
106 | * This iterates over the current state, useful (for example) when applying | ||
107 | * atomic state after it has been checked and swapped. To iterate over the | ||
108 | * planes which *will* be attached (for ->atomic_check()) see | ||
109 | * drm_crtc_for_each_pending_plane() | ||
110 | */ | ||
111 | #define drm_atomic_crtc_for_each_plane(plane, crtc) \ | ||
112 | drm_for_each_plane_mask(plane, (crtc)->dev, (crtc)->state->plane_mask) | ||
113 | |||
114 | /** | ||
115 | * drm_crtc_atomic_state_for_each_plane - iterate over attached planes in new state | ||
116 | * @plane: the loop cursor | ||
117 | * @crtc_state: the incoming crtc-state | ||
118 | * | ||
119 | * Similar to drm_crtc_for_each_plane(), but iterates the planes that will be | ||
120 | * attached if the specified state is applied. Useful during (for example) | ||
121 | * ->atomic_check() operations, to validate the incoming state | ||
122 | */ | ||
123 | #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) | ||
101 | 125 | ||
102 | #endif /* DRM_ATOMIC_HELPER_H_ */ | 126 | #endif /* DRM_ATOMIC_HELPER_H_ */ |
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 4cf6905b57f5..dd2c16e43333 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h | |||
@@ -1062,6 +1062,19 @@ struct drm_mode_config { | |||
1062 | uint32_t cursor_width, cursor_height; | 1062 | uint32_t cursor_width, cursor_height; |
1063 | }; | 1063 | }; |
1064 | 1064 | ||
1065 | /** | ||
1066 | * drm_for_each_plane_mask - iterate over planes specified by bitmask | ||
1067 | * @plane: the loop cursor | ||
1068 | * @dev: the DRM device | ||
1069 | * @plane_mask: bitmask of plane indices | ||
1070 | * | ||
1071 | * Iterate over all planes specified by bitmask. | ||
1072 | */ | ||
1073 | #define drm_for_each_plane_mask(plane, dev, plane_mask) \ | ||
1074 | list_for_each_entry((plane), &(dev)->mode_config.plane_list, head) \ | ||
1075 | if ((plane_mask) & (1 << drm_plane_index(plane))) | ||
1076 | |||
1077 | |||
1065 | #define obj_to_crtc(x) container_of(x, struct drm_crtc, base) | 1078 | #define obj_to_crtc(x) container_of(x, struct drm_crtc, base) |
1066 | #define obj_to_connector(x) container_of(x, struct drm_connector, base) | 1079 | #define obj_to_connector(x) container_of(x, struct drm_connector, base) |
1067 | #define obj_to_encoder(x) container_of(x, struct drm_encoder, base) | 1080 | #define obj_to_encoder(x) container_of(x, struct drm_encoder, base) |