[PATCH] drm/atomic: Add new reverse iterator over all plane state

Daniel Vetter daniel at ffwll.ch
Tue Mar 6 10:06:29 UTC 2018


On Wed, Feb 28, 2018 at 09:26:26AM -0500, Alex Deucher wrote:
> + dri-devel
> 
> 
> On Wed, Feb 28, 2018 at 4:33 AM, S, Shirish <Shirish.S at amd.com> wrote:
> > From: Shirish S <shirish.s at amd.com>
> >
> > Add reverse iterator "for_each_oldnew_plane_in_state_reverse" to
> > complement "for_each_oldnew_plane_in_state" way of reading plane
> > states.
> >
> > The plane states are required to be read in reverse order for
> > amdgpu, as the z order convention followed in linux is
> > opposite to how the planes are supposed to be presented to DC
> > engine, which is in common to both windows and linux.
> >
> > Signed-off-by: Shirish S <shirish.s at amd.com>
> > Signed-off-by: Pratik Vishwakarma <Pratik.Vishwakarma at amd.com>

Makes sense.
> > ---
> >  include/drm/drm_atomic.h | 22 ++++++++++++++++++++++
> >  1 file changed, 22 insertions(+)
> >
> > diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
> > index cf13842..b947930 100644
> > --- a/include/drm/drm_atomic.h
> > +++ b/include/drm/drm_atomic.h
> > @@ -754,6 +754,28 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p);
> >                               (new_plane_state) = (__state)->planes[__i].new_state, 1))
> >
> >  /**
> > + * for_each_oldnew_plane_in_state_reverse - iterate over all planes in an atomic
> > + * update in reverse order

Are you sure this renders correctly in kernel-doc? Iirc you have to indent
the continuation line.

Assuming this is fixed:

Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch>

> > + * @__state: &struct drm_atomic_state pointer
> > + * @plane: &struct drm_plane iteration cursor
> > + * @old_plane_state: &struct drm_plane_state iteration cursor for the old state
> > + * @new_plane_state: &struct drm_plane_state iteration cursor for the new state
> > + * @__i: int iteration cursor, for macro-internal use
> > + *
> > + * This iterates over all planes in an atomic update in reverse order,
> > + * tracking both old and  new state. This is useful in places where the
> > + * state delta needs to be considered, for example in atomic check functions.
> > + */
> > +#define for_each_oldnew_plane_in_state_reverse(__state, plane, old_plane_state, new_plane_state, __i) \
> > +       (for ((__i) = ((__state)->dev->mode_config.num_total_plane - 1);        \
> > +            (__i) >= 0;                                                \
> > +            (__i)--)                                                   \
> > +               for_each_if ((__state)->planes[__i].ptr &&              \
> > +                            ((plane) = (__state)->planes[__i].ptr,     \
> > +                             (old_plane_state) = (__state)->planes[__i].old_state,\
> > +                             (new_plane_state) = (__state)->planes[__i].new_state, 1)))
> > +
> > +/**
> >   * for_each_old_plane_in_state - iterate over all planes in an atomic update
> >   * @__state: &struct drm_atomic_state pointer
> >   * @plane: &struct drm_plane iteration cursor
> > --
> > 2.7.4
> >
> > _______________________________________________
> > amd-gfx mailing list
> > amd-gfx at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/amd-gfx
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the dri-devel mailing list