Re: [PATCH] drm/atomic: Add new reverse iterator over all plane state (V2)

2018-03-07 Thread Harry Wentland
On 2018-03-06 10:10 PM, Shirish S wrote:
> Add reverse iterator for_each_oldnew_plane_in_state_reverse to
> compliment the for_each_oldnew_plane_in_state way or reading plane
> states.
> 
> The plane states are required to be read in reverse order for
> amd drivers, cause 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.
> 
> V2: fix compile time errors due to -Werror flag.
> 
> Signed-off-by: Shirish S 
> Signed-off-by: Pratik Vishwakarma 
> Reviewed-by: Daniel Vetter 

Merged to drm-misc-next.

Harry

> ---
>  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..3fe8dde 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
> + * @__state:  drm_atomic_state pointer
> + * @plane:  drm_plane iteration cursor
> + * @old_plane_state:  drm_plane_state iteration cursor for the old 
> state
> + * @new_plane_state:  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:  drm_atomic_state pointer
>   * @plane:  drm_plane iteration cursor
> 
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


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

2018-03-06 Thread S, Shirish
Hi Alex,

Have resent the V2 with R-B of Daniel.

Regards,
Shirish S


-Original Message-
From: Alex Deucher [mailto:alexdeuc...@gmail.com] 
Sent: Tuesday, March 6, 2018 11:01 PM
To: Vishwakarma, Pratik <pratik.vishwaka...@amd.com>
Cc: Daniel Vetter <dan...@ffwll.ch>; Deucher, Alexander 
<alexander.deuc...@amd.com>; amd-gfx@lists.freedesktop.org; Maling list - DRI 
developers <dri-de...@lists.freedesktop.org>; S, Shirish <shiris...@amd.com>
Subject: Re: [PATCH] drm/atomic: Add new reverse iterator over all plane state

On Tue, Mar 6, 2018 at 5:52 AM, Vishwakarma, Pratik 
<pratik.vishwaka...@amd.com> wrote:
> Hi Daniel,
>
> I have checked make htmldocs on v2 of this patch. I have attached output 
> drm-kms.html on that thread.
> No indentation issue is observed. Attached again for reference.
> Can you please provide RB on that?

How did you send the patch?  I can't get V2 to apply.  The patch is mangled.  
Please use git-send-email if you didn't before.

Alex

>
> Regards
> Pratik
>
> -Original Message-
> From: amd-gfx [mailto:amd-gfx-boun...@lists.freedesktop.org] On Behalf 
> Of Daniel Vetter
> Sent: Tuesday, March 6, 2018 3:36 PM
> To: Alex Deucher <alexdeuc...@gmail.com>
> Cc: Deucher, Alexander <alexander.deuc...@amd.com>; 
> amd-gfx@lists.freedesktop.org; Maling list - DRI developers 
> <dri-de...@lists.freedesktop.org>; S, Shirish <shiris...@amd.com>
> Subject: Re: [PATCH] drm/atomic: Add new reverse iterator over all 
> plane state
>
> 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 <shiris...@amd.com> wrote:
>> > From: Shirish S <shiris...@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 <shiris...@amd.com>
>> > Signed-off-by: Pratik Vishwakarma <pratik.vishwaka...@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.vet...@ffwll.ch>
>
>> > + * @__state:  drm_atomic_state pointer
>> > + * @plane:  drm_plane iteration cursor
>> > + * @old_plane_state:  drm_plane_state iteration cursor for 
>> > +the old state
>> > + * @new_plane_state:  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) = 
>>

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

2018-03-06 Thread Alex Deucher
On Tue, Mar 6, 2018 at 5:52 AM, Vishwakarma, Pratik
<pratik.vishwaka...@amd.com> wrote:
> Hi Daniel,
>
> I have checked make htmldocs on v2 of this patch. I have attached output 
> drm-kms.html on that thread.
> No indentation issue is observed. Attached again for reference.
> Can you please provide RB on that?

How did you send the patch?  I can't get V2 to apply.  The patch is
mangled.  Please use git-send-email if you didn't before.

Alex

>
> Regards
> Pratik
>
> -Original Message-
> From: amd-gfx [mailto:amd-gfx-boun...@lists.freedesktop.org] On Behalf Of 
> Daniel Vetter
> Sent: Tuesday, March 6, 2018 3:36 PM
> To: Alex Deucher <alexdeuc...@gmail.com>
> Cc: Deucher, Alexander <alexander.deuc...@amd.com>; 
> amd-gfx@lists.freedesktop.org; Maling list - DRI developers 
> <dri-de...@lists.freedesktop.org>; S, Shirish <shiris...@amd.com>
> Subject: Re: [PATCH] drm/atomic: Add new reverse iterator over all plane state
>
> 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 <shiris...@amd.com> wrote:
>> > From: Shirish S <shiris...@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 <shiris...@amd.com>
>> > Signed-off-by: Pratik Vishwakarma <pratik.vishwaka...@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.vet...@ffwll.ch>
>
>> > + * @__state:  drm_atomic_state pointer
>> > + * @plane:  drm_plane iteration cursor
>> > + * @old_plane_state:  drm_plane_state iteration cursor for
>> > +the old state
>> > + * @new_plane_state:  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:  drm_atomic_state pointer
>> >   * @plane:  drm_plane iteration cursor
>> > --
>> > 2.7.4
>> >
>> > ___
>> > amd-gfx mailing list
>> > amd-gfx@lists.freedesktop.org
>> > https://lists.freedesktop.org/mailman/listinfo/amd-gfx
>> ___
>> dri-devel mailing list
>> dri-de...@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
> ___
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


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

2018-03-06 Thread Vishwakarma, Pratik
Below mail was rejected, maybe due to attachment. Sending again without 
attachment.

Regards
Pratik

-Original Message-
From: Vishwakarma, Pratik 
Sent: Tuesday, March 6, 2018 4:22 PM
To: 'Daniel Vetter' <dan...@ffwll.ch>; Alex Deucher <alexdeuc...@gmail.com>
Cc: Deucher, Alexander <alexander.deuc...@amd.com>; 
amd-gfx@lists.freedesktop.org; Maling list - DRI developers 
<dri-de...@lists.freedesktop.org>; S, Shirish <shiris...@amd.com>
Subject: RE: [PATCH] drm/atomic: Add new reverse iterator over all plane state

Hi Daniel,

I have checked make htmldocs on v2 of this patch. I have attached output 
drm-kms.html on that thread.
No indentation issue is observed. Attached again for reference.
Can you please provide RB on that?

Regards
Pratik

-Original Message-
From: amd-gfx [mailto:amd-gfx-boun...@lists.freedesktop.org] On Behalf Of 
Daniel Vetter
Sent: Tuesday, March 6, 2018 3:36 PM
To: Alex Deucher <alexdeuc...@gmail.com>
Cc: Deucher, Alexander <alexander.deuc...@amd.com>; 
amd-gfx@lists.freedesktop.org; Maling list - DRI developers 
<dri-de...@lists.freedesktop.org>; S, Shirish <shiris...@amd.com>
Subject: Re: [PATCH] drm/atomic: Add new reverse iterator over all plane state

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 <shiris...@amd.com> wrote:
> > From: Shirish S <shiris...@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 <shiris...@amd.com>
> > Signed-off-by: Pratik Vishwakarma <pratik.vishwaka...@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.vet...@ffwll.ch>

> > + * @__state:  drm_atomic_state pointer
> > + * @plane:  drm_plane iteration cursor
> > + * @old_plane_state:  drm_plane_state iteration cursor for 
> > +the old state
> > + * @new_plane_state:  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:  drm_atomic_state pointer
> >   * @plane:  drm_plane iteration cursor
> > --
> > 2.7.4
> >
> > ___
> > amd-gfx mailing list
> > amd-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/amd-gfx
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


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

2018-03-06 Thread Daniel Vetter
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  wrote:
> > From: Shirish S 
> >
> > 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 
> > Signed-off-by: Pratik Vishwakarma 

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 

> > + * @__state:  drm_atomic_state pointer
> > + * @plane:  drm_plane iteration cursor
> > + * @old_plane_state:  drm_plane_state iteration cursor for the old 
> > state
> > + * @new_plane_state:  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:  drm_atomic_state pointer
> >   * @plane:  drm_plane iteration cursor
> > --
> > 2.7.4
> >
> > ___
> > amd-gfx mailing list
> > amd-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/amd-gfx
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH] drm/atomic: Add new reverse iterator over all plane state (V2)

2018-03-06 Thread Jani Nikula
On Mon, 05 Mar 2018, Harry Wentland  wrote:
>   make DOCBOOKS="" htmldocs

DOCBOOKS is no more. Simply 'make htmldocs' will do the same.

BR,
Jani.

-- 
Jani Nikula, Intel Open Source Technology Center
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH] drm/atomic: Add new reverse iterator over all plane state (V2)

2018-03-05 Thread Harry Wentland
On 2018-03-01 02:56 AM, S, Shirish wrote:
> From: Shirish S 
> 
> Add reverse iterator for_each_oldnew_plane_in_state_reverse to compliment the 
> for_each_oldnew_plane_in_state way or reading plane states.
> 
> The plane states are required to be read in reverse order for amd drivers, 
> cause 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.
> 
> V2: fix compile time errors due to -Werror flag.
> 
> Signed-off-by: Shirish S 
> Signed-off-by: Pratik Vishwakarma 
> ---
>  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..3fe8dde 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

Looks good but can you check if docs build and render well with the newline in 
here? To build the docs run
make DOCBOOKS="" htmldocs
and then check that it renders correctly in 
Documentation/output/gpu/drm_kms.html

Harry

> + * @__state:  drm_atomic_state pointer
> + * @plane:  drm_plane iteration cursor
> + * @old_plane_state:  drm_plane_state iteration cursor for the 
> +old state
> + * @new_plane_state:  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:  drm_atomic_state pointer
>   * @plane:  drm_plane iteration cursor
> --
> 2.7.4
> 
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


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

2018-02-28 Thread Alex Deucher
+ dri-devel


On Wed, Feb 28, 2018 at 4:33 AM, S, Shirish  wrote:
> From: Shirish S 
>
> 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 
> Signed-off-by: Pratik Vishwakarma 
> ---
>  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
> + * @__state:  drm_atomic_state pointer
> + * @plane:  drm_plane iteration cursor
> + * @old_plane_state:  drm_plane_state iteration cursor for the old 
> state
> + * @new_plane_state:  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:  drm_atomic_state pointer
>   * @plane:  drm_plane iteration cursor
> --
> 2.7.4
>
> ___
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


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

2018-02-28 Thread Andrey Grodzovsky

Any DRM related changes needs to be sent to dri-de...@lists.freedesktop.org

Andrey


On 02/28/2018 04:33 AM, S, Shirish wrote:

From: Shirish S 

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 
Signed-off-by: Pratik Vishwakarma 
---
  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
+ * @__state:  drm_atomic_state pointer
+ * @plane:  drm_plane iteration cursor
+ * @old_plane_state:  drm_plane_state iteration cursor for the old state
+ * @new_plane_state:  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:  drm_atomic_state pointer
   * @plane:  drm_plane iteration cursor


___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx