Skip to content

Commit e341cc6

Browse files
Alex Hungemersion
authored andcommitted
drm/colorop: define a new macro for_each_new_colorop_in_state
Create a new macro for_each_new_colorop_in_state to access new drm_colorop_state updated from uapi. Reviewed-by: Simon Ser <contact@emersion.fr> Signed-off-by: Alex Hung <alex.hung@amd.com> Reviewed-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Melissa Wen <mwen@igalia.com> Reviewed-by: Sebastian Wick <sebastian.wick@redhat.com> Signed-off-by: Simon Ser <contact@emersion.fr> Link: https://patch.msgid.link/20251115000237.3561250-25-alex.hung@amd.com
1 parent dabeeba commit e341cc6

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

include/drm/drm_atomic.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,6 +1089,26 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p);
10891089
(old_colorop_state) = (__state)->colorops[__i].old_state,\
10901090
(new_colorop_state) = (__state)->colorops[__i].new_state, 1))
10911091

1092+
/**
1093+
* for_each_new_colorop_in_state - iterate over all colorops in an atomic update
1094+
* @__state: &struct drm_atomic_state pointer
1095+
* @colorop: &struct drm_colorop iteration cursor
1096+
* @new_colorop_state: &struct drm_colorop_state iteration cursor for the new state
1097+
* @__i: int iteration cursor, for macro-internal use
1098+
*
1099+
* This iterates over all colorops in an atomic update, tracking new state. This is
1100+
* useful in places where the state delta needs to be considered, for example in
1101+
* atomic check functions.
1102+
*/
1103+
#define for_each_new_colorop_in_state(__state, colorop, new_colorop_state, __i) \
1104+
for ((__i) = 0; \
1105+
(__i) < (__state)->dev->mode_config.num_colorop; \
1106+
(__i)++) \
1107+
for_each_if ((__state)->colorops[__i].ptr && \
1108+
((colorop) = (__state)->colorops[__i].ptr, \
1109+
(void)(colorop) /* Only to avoid unused-but-set-variable warning */, \
1110+
(new_colorop_state) = (__state)->colorops[__i].new_state, 1))
1111+
10921112
/**
10931113
* for_each_oldnew_plane_in_state - iterate over all planes in an atomic update
10941114
* @__state: &struct drm_atomic_state pointer

0 commit comments

Comments
 (0)