[PATCH v5 1/5] drm: add generic zpos property

2016-05-09 Thread Tobias Jakobi
Hello,

just voicing my interest in having this feature in DRM core.

- Tobias


Daniel Vetter wrote:
> On Mon, May 09, 2016 at 10:42:45AM +0200, Benjamin Gaignard wrote:
>> Hello,
>>
>> I little up in this topic.
>> If generic z-order patches can't land into drm core,
>> I wille have to resend the patch to enable it within STI driver:
>> https://lists.freedesktop.org/archives/dri-devel/2016-January/098140.html
> 
> It's the patch author's duty to ping folks for reviews to move a patch
> forward. That doesn't happen automatically.
> 
> It helps though if you cc everyone who commented on earlier iterations (I
> prefer Cc: lines in the commit message). Ville seems to have not been
> added for this one here.
> 
> Also there's a metric pile of driver patches that floated around to
> convert them over to core zpos. Can you pls pick those up too?
> 
> I definitely want to land this in drm core, so not going to take a
> ragequite-I'll-do-it-in-my-driver for an answer ;-)
> 
> Thanks, Daniel
> 
>>
>> Regards,
>> Benjamin
>>
>> 2016-04-01 14:48 GMT+02:00 Benjamin Gaignard > linaro.org>:
>>> This patch adds support for generic plane's zpos property property with
>>> well-defined semantics:
>>> - added zpos properties to plane and plane state structures
>>> - added helpers for normalizing zpos properties of given set of planes
>>> - well defined semantics: planes are sorted by zpos values and then plane
>>>   id value if zpos equals
>>>
>>> Normalized zpos values are calculated automatically when generic
>>> muttable zpos property has been initialized. Drivers can simply use
>>> plane_state->normalized_zpos in their atomic_check and/or plane_update
>>> callbacks without any additional calls to DRM core.
>>>
>>> Signed-off-by: Marek Szyprowski 
>>>
>>> Compare to Marek's original patch zpos property is now specific to each
>>> plane and no more to the core.
>>> Normalize function take care of the range of per plane defined range
>>> before set normalized_zpos.
>>>
>>> Signed-off-by: Benjamin Gaignard 
>>> ---
>>>  Documentation/DocBook/gpu.tmpl  |  10 ++
>>>  drivers/gpu/drm/Makefile|   2 +-
>>>  drivers/gpu/drm/drm_atomic_helper.c |   6 +
>>>  drivers/gpu/drm/drm_blend.c | 283 
>>> 
>>>  drivers/gpu/drm/drm_crtc_internal.h |   3 +
>>>  include/drm/drm_crtc.h  |  25 
>>>  6 files changed, 328 insertions(+), 1 deletion(-)
>>>  create mode 100644 drivers/gpu/drm/drm_blend.c
>>>
>>> diff --git a/Documentation/DocBook/gpu.tmpl b/Documentation/DocBook/gpu.tmpl
>>> index 1692c4d..b7a5161 100644
>>> --- a/Documentation/DocBook/gpu.tmpl
>>> +++ b/Documentation/DocBook/gpu.tmpl
>>> @@ -2147,6 +2147,16 @@ void intel_crt_init(struct drm_device *dev)
>>>   the underlying hardware).
>>>   
>>>   
>>> +  "zpos" 
>>> + RANGE
>>> + Min= driver dependent, Max= driver dependent
>>> + Plane
>>> + Plane's 'z' position during blending operation (0
>>> for background, highest for frontmost).
>>> + If two planes assigned to same CRTC have equal zpos values, the
>>> plane with higher plane
>>> + id is treated as closer to front. Can be IMMUTABLE if driver doesn't
>>> support changing
>>> + planes' order. Exact value range is driver dependent.
>>> + 
>>> + 
>>>   i915
>>>   Generic
>>>   "Broadcast RGB"
>>> diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
>>> index 6eb94fc..18dc563 100644
>>> --- a/drivers/gpu/drm/Makefile
>>> +++ b/drivers/gpu/drm/Makefile
>>> @@ -2,7 +2,7 @@
>>>  # Makefile for the drm device driver.  This driver provides support for the
>>
>>
>>
>> -- 
>> Benjamin Gaignard
>>
>> Graphic Working Group
>>
>> Linaro.org │ Open source software for ARM SoCs
>>
>> Follow Linaro: Facebook | Twitter | Blog
> 



[PATCH v5 1/5] drm: add generic zpos property

2016-05-09 Thread Daniel Vetter
On Mon, May 09, 2016 at 10:42:45AM +0200, Benjamin Gaignard wrote:
> Hello,
> 
> I little up in this topic.
> If generic z-order patches can't land into drm core,
> I wille have to resend the patch to enable it within STI driver:
> https://lists.freedesktop.org/archives/dri-devel/2016-January/098140.html

It's the patch author's duty to ping folks for reviews to move a patch
forward. That doesn't happen automatically.

It helps though if you cc everyone who commented on earlier iterations (I
prefer Cc: lines in the commit message). Ville seems to have not been
added for this one here.

Also there's a metric pile of driver patches that floated around to
convert them over to core zpos. Can you pls pick those up too?

I definitely want to land this in drm core, so not going to take a
ragequite-I'll-do-it-in-my-driver for an answer ;-)

Thanks, Daniel

> 
> Regards,
> Benjamin
> 
> 2016-04-01 14:48 GMT+02:00 Benjamin Gaignard  linaro.org>:
> > This patch adds support for generic plane's zpos property property with
> > well-defined semantics:
> > - added zpos properties to plane and plane state structures
> > - added helpers for normalizing zpos properties of given set of planes
> > - well defined semantics: planes are sorted by zpos values and then plane
> >   id value if zpos equals
> >
> > Normalized zpos values are calculated automatically when generic
> > muttable zpos property has been initialized. Drivers can simply use
> > plane_state->normalized_zpos in their atomic_check and/or plane_update
> > callbacks without any additional calls to DRM core.
> >
> > Signed-off-by: Marek Szyprowski 
> >
> > Compare to Marek's original patch zpos property is now specific to each
> > plane and no more to the core.
> > Normalize function take care of the range of per plane defined range
> > before set normalized_zpos.
> >
> > Signed-off-by: Benjamin Gaignard 
> > ---
> >  Documentation/DocBook/gpu.tmpl  |  10 ++
> >  drivers/gpu/drm/Makefile|   2 +-
> >  drivers/gpu/drm/drm_atomic_helper.c |   6 +
> >  drivers/gpu/drm/drm_blend.c | 283 
> > 
> >  drivers/gpu/drm/drm_crtc_internal.h |   3 +
> >  include/drm/drm_crtc.h  |  25 
> >  6 files changed, 328 insertions(+), 1 deletion(-)
> >  create mode 100644 drivers/gpu/drm/drm_blend.c
> >
> > diff --git a/Documentation/DocBook/gpu.tmpl b/Documentation/DocBook/gpu.tmpl
> > index 1692c4d..b7a5161 100644
> > --- a/Documentation/DocBook/gpu.tmpl
> > +++ b/Documentation/DocBook/gpu.tmpl
> > @@ -2147,6 +2147,16 @@ void intel_crt_init(struct drm_device *dev)
> >   the underlying hardware).
> >   
> >   
> > +  "zpos" 
> > + RANGE
> > + Min= driver dependent, Max= driver dependent
> > + Plane
> > + Plane's 'z' position during blending operation (0
> > for background, highest for frontmost).
> > + If two planes assigned to same CRTC have equal zpos values, the
> > plane with higher plane
> > + id is treated as closer to front. Can be IMMUTABLE if driver doesn't
> > support changing
> > + planes' order. Exact value range is driver dependent.
> > + 
> > + 
> >   i915
> >   Generic
> >   "Broadcast RGB"
> > diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> > index 6eb94fc..18dc563 100644
> > --- a/drivers/gpu/drm/Makefile
> > +++ b/drivers/gpu/drm/Makefile
> > @@ -2,7 +2,7 @@
> >  # Makefile for the drm device driver.  This driver provides support for the
> 
> 
> 
> -- 
> Benjamin Gaignard
> 
> Graphic Working Group
> 
> Linaro.org │ Open source software for ARM SoCs
> 
> Follow Linaro: Facebook | Twitter | Blog

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


[PATCH v5 1/5] drm: add generic zpos property

2016-05-09 Thread Benjamin Gaignard
Hello,

I little up in this topic.
If generic z-order patches can't land into drm core,
I wille have to resend the patch to enable it within STI driver:
https://lists.freedesktop.org/archives/dri-devel/2016-January/098140.html

Regards,
Benjamin

2016-04-01 14:48 GMT+02:00 Benjamin Gaignard :
> This patch adds support for generic plane's zpos property property with
> well-defined semantics:
> - added zpos properties to plane and plane state structures
> - added helpers for normalizing zpos properties of given set of planes
> - well defined semantics: planes are sorted by zpos values and then plane
>   id value if zpos equals
>
> Normalized zpos values are calculated automatically when generic
> muttable zpos property has been initialized. Drivers can simply use
> plane_state->normalized_zpos in their atomic_check and/or plane_update
> callbacks without any additional calls to DRM core.
>
> Signed-off-by: Marek Szyprowski 
>
> Compare to Marek's original patch zpos property is now specific to each
> plane and no more to the core.
> Normalize function take care of the range of per plane defined range
> before set normalized_zpos.
>
> Signed-off-by: Benjamin Gaignard 
> ---
>  Documentation/DocBook/gpu.tmpl  |  10 ++
>  drivers/gpu/drm/Makefile|   2 +-
>  drivers/gpu/drm/drm_atomic_helper.c |   6 +
>  drivers/gpu/drm/drm_blend.c | 283 
> 
>  drivers/gpu/drm/drm_crtc_internal.h |   3 +
>  include/drm/drm_crtc.h  |  25 
>  6 files changed, 328 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/gpu/drm/drm_blend.c
>
> diff --git a/Documentation/DocBook/gpu.tmpl b/Documentation/DocBook/gpu.tmpl
> index 1692c4d..b7a5161 100644
> --- a/Documentation/DocBook/gpu.tmpl
> +++ b/Documentation/DocBook/gpu.tmpl
> @@ -2147,6 +2147,16 @@ void intel_crt_init(struct drm_device *dev)
>   the underlying hardware).
>   
>   
> +  "zpos" 
> + RANGE
> + Min= driver dependent, Max= driver dependent
> + Plane
> + Plane's 'z' position during blending operation (0
> for background, highest for frontmost).
> + If two planes assigned to same CRTC have equal zpos values, the
> plane with higher plane
> + id is treated as closer to front. Can be IMMUTABLE if driver doesn't
> support changing
> + planes' order. Exact value range is driver dependent.
> + 
> + 
>   i915
>   Generic
>   "Broadcast RGB"
> diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> index 6eb94fc..18dc563 100644
> --- a/drivers/gpu/drm/Makefile
> +++ b/drivers/gpu/drm/Makefile
> @@ -2,7 +2,7 @@
>  # Makefile for the drm device driver.  This driver provides support for the



-- 
Benjamin Gaignard

Graphic Working Group

Linaro.org │ Open source software for ARM SoCs

Follow Linaro: Facebook | Twitter | Blog


[PATCH v5 1/5] drm: add generic zpos property

2016-04-01 Thread Benjamin Gaignard
This patch adds support for generic plane's zpos property property with
well-defined semantics:
- added zpos properties to plane and plane state structures
- added helpers for normalizing zpos properties of given set of planes
- well defined semantics: planes are sorted by zpos values and then plane
  id value if zpos equals

Normalized zpos values are calculated automatically when generic
muttable zpos property has been initialized. Drivers can simply use
plane_state->normalized_zpos in their atomic_check and/or plane_update
callbacks without any additional calls to DRM core.

Signed-off-by: Marek Szyprowski 

Compare to Marek's original patch zpos property is now specific to each
plane and no more to the core.
Normalize function take care of the range of per plane defined range
before set normalized_zpos.

Signed-off-by: Benjamin Gaignard 
---
 Documentation/DocBook/gpu.tmpl  |  10 ++
 drivers/gpu/drm/Makefile|   2 +-
 drivers/gpu/drm/drm_atomic_helper.c |   6 +
 drivers/gpu/drm/drm_blend.c | 283 
 drivers/gpu/drm/drm_crtc_internal.h |   3 +
 include/drm/drm_crtc.h  |  25 
 6 files changed, 328 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/drm_blend.c

diff --git a/Documentation/DocBook/gpu.tmpl b/Documentation/DocBook/gpu.tmpl
index 1692c4d..b7a5161 100644
--- a/Documentation/DocBook/gpu.tmpl
+++ b/Documentation/DocBook/gpu.tmpl
@@ -2147,6 +2147,16 @@ void intel_crt_init(struct drm_device *dev)
  the underlying hardware).
  
  
+  "zpos" 
+ RANGE
+ Min= driver dependent, Max= driver dependent
+ Plane
+ Plane's 'z' position during blending operation (0
for background, highest for frontmost).
+ If two planes assigned to same CRTC have equal zpos values, the
plane with higher plane
+ id is treated as closer to front. Can be IMMUTABLE if driver doesn't
support changing
+ planes' order. Exact value range is driver dependent.
+ 
+ 
  i915
  Generic
  "Broadcast RGB"
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 6eb94fc..18dc563 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -2,7 +2,7 @@
 # Makefile for the drm device driver.  This driver provides support for the


[PATCH v5 1/5] drm: add generic zpos property

2016-03-23 Thread Benjamin Gaignard
Hello Marek, Ville,

How can we progress in this ? and how can I help you to get this
generic zpos property merge into drm ?

Regards,
Benjamin

2016-02-29 16:12 GMT+01:00 Ville Syrjälä :
> On Wed, Jan 27, 2016 at 03:44:39PM +0100, Marek Szyprowski wrote:
>> This patch adds support for generic plane's zpos property property with
>> well-defined semantics:
>> - added zpos properties to drm core and plane state structures
>> - added helpers for normalizing zpos properties of given set of planes
>> - well defined semantics: planes are sorted by zpos values and then plane
>>   id value if zpos equals
>>
>> Normalized zpos values are calculated automatically when generic
>> muttable zpos property has been initialized. Drivers can simply use
>> plane_state->normalized_zpos in their atomic_check and/or plane_update
>> callbacks without any additional calls to DRM core.
>>
>> Signed-off-by: Marek Szyprowski 
>> Tested-by: Benjamin Gaignard 
>> ---
>>  Documentation/DocBook/gpu.tmpl  |  14 ++-
>>  drivers/gpu/drm/Makefile|   2 +-
>>  drivers/gpu/drm/drm_atomic.c|   4 +
>>  drivers/gpu/drm/drm_atomic_helper.c |   6 +
>>  drivers/gpu/drm/drm_blend.c | 227 
>> 
>>  drivers/gpu/drm/drm_crtc_internal.h |   3 +
>>  include/drm/drm_crtc.h  |  17 +++
>>  7 files changed, 270 insertions(+), 3 deletions(-)
>>  create mode 100644 drivers/gpu/drm/drm_blend.c
>>
>> diff --git a/Documentation/DocBook/gpu.tmpl b/Documentation/DocBook/gpu.tmpl
>> index a8669330b456..ae7d913adf60 100644
>> --- a/Documentation/DocBook/gpu.tmpl
>> +++ b/Documentation/DocBook/gpu.tmpl
>> @@ -1816,7 +1816,7 @@ void intel_crt_init(struct drm_device *dev)
>>   Description/Restrictions
>>   
>>   
>> - DRM
>> + DRM
>>   Generic
>>   “rotation”
>>   BITMASK
>> @@ -2068,7 +2068,7 @@ void intel_crt_init(struct drm_device *dev)
>>   property to suggest an Y offset for a connector
>>   
>>   
>> - Optional
>> + Optional
>>   “scaling mode”
>>   ENUM
>>   { "None", "Full", "Center", "Full aspect" }
>> @@ -2092,6 +2092,16 @@ void intel_crt_init(struct drm_device *dev)
>>   TBD
>>   
>>   
>> +  "zpos" 
>> + RANGE
>> + Min=0, Max= driver dependent
>> + Plane
>> + Plane's 'z' position during blending operation (0 
>> for background, highest for frontmost).
>> + If two planes assigned to same CRTC have equal zpos values, 
>> the plane with higher plane
>> + id is treated as closer to front. Can be IMMUTABLE if driver 
>> doesn't support changing
>> + planes' order. Exact value range is driver dependent.
>> + 
>> + 
>>   i915
>>   Generic
>>   "Broadcast RGB"
>> diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
>> index 61766dec6a8d..eeefaba1c092 100644
>> --- a/drivers/gpu/drm/Makefile
>> +++ b/drivers/gpu/drm/Makefile
>> @@ -2,7 +2,7 @@
>>  # Makefile for the drm device driver.  This driver provides support for the
>>  # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
>>
>> -drm-y   :=   drm_auth.o drm_bufs.o drm_cache.o \
>> +drm-y   :=   drm_auth.o drm_bufs.o drm_blend.o drm_cache.o \
>>   drm_context.o drm_dma.o \
>>   drm_fops.o drm_gem.o drm_ioctl.o drm_irq.o \
>>   drm_lock.o drm_memory.o drm_drv.o drm_vm.o \
>> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
>> index 3f74193885f1..a19201efb7d1 100644
>> --- a/drivers/gpu/drm/drm_atomic.c
>> +++ b/drivers/gpu/drm/drm_atomic.c
>> @@ -630,6 +630,8 @@ int drm_atomic_plane_set_property(struct drm_plane 
>> *plane,
>>   state->src_h = val;
>>   } else if (property == config->rotation_property) {
>>   state->rotation = val;
>> + } else if (property == config->zpos_property) {
>> + state->zpos = val;
>>   } else if (plane->funcs->atomic_set_property) {
>>   return plane->funcs->atomic_set_property(plane, state,
>>   property, val);
>> @@ -686,6 +688,8 @@ drm_atomic_plane_get_property(struct drm_plane *plane,
>>   *val = state->src_h;
>>   } else if (property == config->rotation_property) {
>>   *val = state->rotation;
>> + } else if (property == config->zpos_property) {
>> + *val = state->zpos;
>>   } else if (plane->funcs->atomic_get_property) {
>>   return plane->funcs->atomic_get_property(plane, state, 
>> property, val);
>>   } else {
>> diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
>> b/drivers/gpu/drm/drm_atomic_helper.c
>> index 53db2d9120be..9fbfb672b317 100644
>> --- a/drivers/gpu/drm/drm_atomic_helper.c
>> +++ b/drivers/gpu/drm/drm_atomic_helper.c
>> @@ -32,6 +32,8 @@
>>  #include 
>>  #include 
>>
>> +#include "drm_crtc_internal.h"
>> +
>>  /**
>>   * DOC: overview
>>   *
>> @@ -530,6 +532,10 @@ drm_atomi

[PATCH v5 1/5] drm: add generic zpos property

2016-02-29 Thread Ville Syrjälä
On Wed, Jan 27, 2016 at 03:44:39PM +0100, Marek Szyprowski wrote:
> This patch adds support for generic plane's zpos property property with
> well-defined semantics:
> - added zpos properties to drm core and plane state structures
> - added helpers for normalizing zpos properties of given set of planes
> - well defined semantics: planes are sorted by zpos values and then plane
>   id value if zpos equals
> 
> Normalized zpos values are calculated automatically when generic
> muttable zpos property has been initialized. Drivers can simply use
> plane_state->normalized_zpos in their atomic_check and/or plane_update
> callbacks without any additional calls to DRM core.
> 
> Signed-off-by: Marek Szyprowski 
> Tested-by: Benjamin Gaignard 
> ---
>  Documentation/DocBook/gpu.tmpl  |  14 ++-
>  drivers/gpu/drm/Makefile|   2 +-
>  drivers/gpu/drm/drm_atomic.c|   4 +
>  drivers/gpu/drm/drm_atomic_helper.c |   6 +
>  drivers/gpu/drm/drm_blend.c | 227 
> 
>  drivers/gpu/drm/drm_crtc_internal.h |   3 +
>  include/drm/drm_crtc.h  |  17 +++
>  7 files changed, 270 insertions(+), 3 deletions(-)
>  create mode 100644 drivers/gpu/drm/drm_blend.c
> 
> diff --git a/Documentation/DocBook/gpu.tmpl b/Documentation/DocBook/gpu.tmpl
> index a8669330b456..ae7d913adf60 100644
> --- a/Documentation/DocBook/gpu.tmpl
> +++ b/Documentation/DocBook/gpu.tmpl
> @@ -1816,7 +1816,7 @@ void intel_crt_init(struct drm_device *dev)
>   Description/Restrictions
>   
>   
> - DRM
> + DRM
>   Generic
>   “rotation”
>   BITMASK
> @@ -2068,7 +2068,7 @@ void intel_crt_init(struct drm_device *dev)
>   property to suggest an Y offset for a connector
>   
>   
> - Optional
> + Optional
>   “scaling mode”
>   ENUM
>   { "None", "Full", "Center", "Full aspect" }
> @@ -2092,6 +2092,16 @@ void intel_crt_init(struct drm_device *dev)
>   TBD
>   
>   
> +  "zpos" 
> + RANGE
> + Min=0, Max= driver dependent
> + Plane
> + Plane's 'z' position during blending operation (0 for 
> background, highest for frontmost).
> + If two planes assigned to same CRTC have equal zpos values, the 
> plane with higher plane
> + id is treated as closer to front. Can be IMMUTABLE if driver 
> doesn't support changing
> + planes' order. Exact value range is driver dependent.
> + 
> + 
>   i915
>   Generic
>   "Broadcast RGB"
> diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> index 61766dec6a8d..eeefaba1c092 100644
> --- a/drivers/gpu/drm/Makefile
> +++ b/drivers/gpu/drm/Makefile
> @@ -2,7 +2,7 @@
>  # Makefile for the drm device driver.  This driver provides support for the
>  # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
>  
> -drm-y   :=   drm_auth.o drm_bufs.o drm_cache.o \
> +drm-y   :=   drm_auth.o drm_bufs.o drm_blend.o drm_cache.o \
>   drm_context.o drm_dma.o \
>   drm_fops.o drm_gem.o drm_ioctl.o drm_irq.o \
>   drm_lock.o drm_memory.o drm_drv.o drm_vm.o \
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 3f74193885f1..a19201efb7d1 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -630,6 +630,8 @@ int drm_atomic_plane_set_property(struct drm_plane *plane,
>   state->src_h = val;
>   } else if (property == config->rotation_property) {
>   state->rotation = val;
> + } else if (property == config->zpos_property) {
> + state->zpos = val;
>   } else if (plane->funcs->atomic_set_property) {
>   return plane->funcs->atomic_set_property(plane, state,
>   property, val);
> @@ -686,6 +688,8 @@ drm_atomic_plane_get_property(struct drm_plane *plane,
>   *val = state->src_h;
>   } else if (property == config->rotation_property) {
>   *val = state->rotation;
> + } else if (property == config->zpos_property) {
> + *val = state->zpos;
>   } else if (plane->funcs->atomic_get_property) {
>   return plane->funcs->atomic_get_property(plane, state, 
> property, val);
>   } else {
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
> b/drivers/gpu/drm/drm_atomic_helper.c
> index 53db2d9120be..9fbfb672b317 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -32,6 +32,8 @@
>  #include 
>  #include 
>  
> +#include "drm_crtc_internal.h"
> +
>  /**
>   * DOC: overview
>   *
> @@ -530,6 +532,10 @@ drm_atomic_helper_check_planes(struct drm_device *dev,
>   struct drm_plane_state *plane_state;
>   int i, ret = 0;
>  
> + ret = drm_atomic_helper_normalize_zpos(dev, state);
> + if (ret)
> + return ret;
> +
>   for_each_plane_in_state(state, plane, plane_state, i) {
>   

[PATCH v5 1/5] drm: add generic zpos property

2016-01-27 Thread Marek Szyprowski
This patch adds support for generic plane's zpos property property with
well-defined semantics:
- added zpos properties to drm core and plane state structures
- added helpers for normalizing zpos properties of given set of planes
- well defined semantics: planes are sorted by zpos values and then plane
  id value if zpos equals

Normalized zpos values are calculated automatically when generic
muttable zpos property has been initialized. Drivers can simply use
plane_state->normalized_zpos in their atomic_check and/or plane_update
callbacks without any additional calls to DRM core.

Signed-off-by: Marek Szyprowski 
Tested-by: Benjamin Gaignard 
---
 Documentation/DocBook/gpu.tmpl  |  14 ++-
 drivers/gpu/drm/Makefile|   2 +-
 drivers/gpu/drm/drm_atomic.c|   4 +
 drivers/gpu/drm/drm_atomic_helper.c |   6 +
 drivers/gpu/drm/drm_blend.c | 227 
 drivers/gpu/drm/drm_crtc_internal.h |   3 +
 include/drm/drm_crtc.h  |  17 +++
 7 files changed, 270 insertions(+), 3 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_blend.c

diff --git a/Documentation/DocBook/gpu.tmpl b/Documentation/DocBook/gpu.tmpl
index a8669330b456..ae7d913adf60 100644
--- a/Documentation/DocBook/gpu.tmpl
+++ b/Documentation/DocBook/gpu.tmpl
@@ -1816,7 +1816,7 @@ void intel_crt_init(struct drm_device *dev)
Description/Restrictions


-   DRM
+   DRM
Generic
“rotation”
BITMASK
@@ -2068,7 +2068,7 @@ void intel_crt_init(struct drm_device *dev)
property to suggest an Y offset for a connector


-   Optional
+   Optional
“scaling mode”
ENUM
{ "None", "Full", "Center", "Full aspect" }
@@ -2092,6 +2092,16 @@ void intel_crt_init(struct drm_device *dev)
TBD


+"zpos" 
+   RANGE
+   Min=0, Max= driver dependent
+   Plane
+   Plane's 'z' position during blending operation (0 for 
background, highest for frontmost).
+   If two planes assigned to same CRTC have equal zpos values, the 
plane with higher plane
+   id is treated as closer to front. Can be IMMUTABLE if driver 
doesn't support changing
+   planes' order. Exact value range is driver dependent.
+   
+   
i915
Generic
"Broadcast RGB"
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 61766dec6a8d..eeefaba1c092 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -2,7 +2,7 @@
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.

-drm-y   := drm_auth.o drm_bufs.o drm_cache.o \
+drm-y   := drm_auth.o drm_bufs.o drm_blend.o drm_cache.o \
drm_context.o drm_dma.o \
drm_fops.o drm_gem.o drm_ioctl.o drm_irq.o \
drm_lock.o drm_memory.o drm_drv.o drm_vm.o \
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 3f74193885f1..a19201efb7d1 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -630,6 +630,8 @@ int drm_atomic_plane_set_property(struct drm_plane *plane,
state->src_h = val;
} else if (property == config->rotation_property) {
state->rotation = val;
+   } else if (property == config->zpos_property) {
+   state->zpos = val;
} else if (plane->funcs->atomic_set_property) {
return plane->funcs->atomic_set_property(plane, state,
property, val);
@@ -686,6 +688,8 @@ drm_atomic_plane_get_property(struct drm_plane *plane,
*val = state->src_h;
} else if (property == config->rotation_property) {
*val = state->rotation;
+   } else if (property == config->zpos_property) {
+   *val = state->zpos;
} else if (plane->funcs->atomic_get_property) {
return plane->funcs->atomic_get_property(plane, state, 
property, val);
} else {
diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index 53db2d9120be..9fbfb672b317 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -32,6 +32,8 @@
 #include 
 #include 

+#include "drm_crtc_internal.h"
+
 /**
  * DOC: overview
  *
@@ -530,6 +532,10 @@ drm_atomic_helper_check_planes(struct drm_device *dev,
struct drm_plane_state *plane_state;
int i, ret = 0;

+   ret = drm_atomic_helper_normalize_zpos(dev, state);
+   if (ret)
+   return ret;
+
for_each_plane_in_state(state, plane, plane_state, i) {
const struct drm_plane_helper_funcs *funcs;

diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c
new file mode 100644
index ..cdcb647c8ed9
--- /dev/null
+++ b/drivers/gpu/drm/drm_blend.c
@@ -