Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Rob Clark and committed by
Daniel Vetter
dd275956 6ddd388a

+38
+1
Documentation/DocBook/drm.tmpl
··· 2343 2343 <title>Atomic State Reset and Initialization</title> 2344 2344 !Pdrivers/gpu/drm/drm_atomic_helper.c atomic state reset and initialization 2345 2345 </sect3> 2346 + !Iinclude/drm/drm_atomic_helper.h 2346 2347 !Edrivers/gpu/drm/drm_atomic_helper.c 2347 2348 </sect2> 2348 2349 <sect2>
+24
include/drm/drm_atomic_helper.h
··· 98 98 void drm_atomic_helper_connector_destroy_state(struct drm_connector *connector, 99 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 126 #endif /* DRM_ATOMIC_HELPER_H_ */
+13
include/drm/drm_crtc.h
··· 1062 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 1078 #define obj_to_crtc(x) container_of(x, struct drm_crtc, base) 1066 1079 #define obj_to_connector(x) container_of(x, struct drm_connector, base) 1067 1080 #define obj_to_encoder(x) container_of(x, struct drm_encoder, base)