[Intel-gfx] [PATCH 12/15] drm: RIP mode_config->rotation_property

2016-10-18 Thread Ville Syrjälä
On Tue, Oct 18, 2016 at 11:13:53AM +0300, Laurent Pinchart wrote:
> Hi Daniel,
> 
> On Tuesday 18 Oct 2016 09:36:23 Daniel Vetter wrote:
> > On Tue, Oct 18, 2016 at 01:38:05AM +0300, Laurent Pinchart wrote:
> > > On Friday 22 Jul 2016 16:43:13 ville.syrjala at linux.intel.com wrote:
> > >> From: Ville Syrjälä 
> > >> 
> > >> Now that all drivers have been converted over to the per-plane rotation
> > >> property, we can just nuke the global rotation property.
> > >> 
> > >> Signed-off-by: Ville Syrjälä 
> > > 
> > > Stupid question, but how does this work when the hardware supports global
> > > rotation only, not per-plane rotation ?
> > 
> > Does that exist? If so I guess we get to add a rotation property to CRTCS
> > (and update docs and all that).
> 
> I have a hardware composer that performs rotation on the output side. At the 
> moment it doesn't support rotation when used with the display, but I wouldn't 
> rule that out in future SoC versions. So I'm not aware of any use case for a 
> rotation property on the CRTC at the moment, I just wanted to make sure we 
> have a path forward.

I even implemented that for i915 long ago by having it rotate all the
planes (+ adjust their coordinates appropriately). But people weren't
too keen on putting that in, so I dropped it.

https://lists.freedesktop.org/archives/intel-gfx/2014-February/040053.html

The only bigger snafu here is omap, which already has a rotation property
on the crtc, except it actually only rotates the primary plane. So
when/if someone adds a real crtc rotation property it has to be called
something else that "rotation". I think I settled on "crtc-rotation"
judging what I have in my last branch on that topic.

-- 
Ville Syrjälä
Intel OTC


[PATCH 12/15] drm: RIP mode_config->rotation_property

2016-10-18 Thread Laurent Pinchart
Hi Daniel,

On Tuesday 18 Oct 2016 09:36:23 Daniel Vetter wrote:
> On Tue, Oct 18, 2016 at 01:38:05AM +0300, Laurent Pinchart wrote:
> > On Friday 22 Jul 2016 16:43:13 ville.syrjala at linux.intel.com wrote:
> >> From: Ville Syrjälä 
> >> 
> >> Now that all drivers have been converted over to the per-plane rotation
> >> property, we can just nuke the global rotation property.
> >> 
> >> Signed-off-by: Ville Syrjälä 
> > 
> > Stupid question, but how does this work when the hardware supports global
> > rotation only, not per-plane rotation ?
> 
> Does that exist? If so I guess we get to add a rotation property to CRTCS
> (and update docs and all that).

I have a hardware composer that performs rotation on the output side. At the 
moment it doesn't support rotation when used with the display, but I wouldn't 
rule that out in future SoC versions. So I'm not aware of any use case for a 
rotation property on the CRTC at the moment, I just wanted to make sure we 
have a path forward.

-- 
Regards,

Laurent Pinchart



[PATCH 12/15] drm: RIP mode_config->rotation_property

2016-10-18 Thread Daniel Vetter
On Tue, Oct 18, 2016 at 01:38:05AM +0300, Laurent Pinchart wrote:
> Hi Ville,
> 
> On Friday 22 Jul 2016 16:43:13 ville.syrjala at linux.intel.com wrote:
> > From: Ville Syrjälä 
> > 
> > Now that all drivers have been converted over to the per-plane rotation
> > property, we can just nuke the global rotation property.
> > 
> > Signed-off-by: Ville Syrjälä 
> 
> Stupid question, but how does this work when the hardware supports global 
> rotation only, not per-plane rotation ?

Does that exist? If so I guess we get to add a rotation property to CRTCS
(and update docs and all that).
-Daniel

> 
> > ---
> >  drivers/gpu/drm/drm_atomic.c|  6 ++
> >  drivers/gpu/drm/drm_crtc.c  | 18 --
> >  drivers/gpu/drm/drm_fb_helper.c |  7 +--
> >  include/drm/drm_crtc.h  |  7 ---
> >  4 files changed, 3 insertions(+), 35 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> > index 116f940a9267..81061fcdb984 100644
> > --- a/drivers/gpu/drm/drm_atomic.c
> > +++ b/drivers/gpu/drm/drm_atomic.c
> > @@ -709,8 +709,7 @@ int drm_atomic_plane_set_property(struct drm_plane
> > *plane, state->src_w = val;
> > } else if (property == config->prop_src_h) {
> > state->src_h = val;
> > -   } else if (property == config->rotation_property ||
> > -  property == plane->rotation_property) {
> > +   } else if (property == plane->rotation_property) {
> > if (!is_power_of_2(val & DRM_ROTATE_MASK))
> > return -EINVAL;
> > state->rotation = val;
> > @@ -768,8 +767,7 @@ drm_atomic_plane_get_property(struct drm_plane *plane,
> > *val = state->src_w;
> > } else if (property == config->prop_src_h) {
> > *val = state->src_h;
> > -   } else if (property == config->rotation_property ||
> > -  property == plane->rotation_property) {
> > +   } else if (property == plane->rotation_property) {
> > *val = state->rotation;
> > } else if (plane->funcs->atomic_get_property) {
> > return plane->funcs->atomic_get_property(plane, state, 
> property, val);
> > diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> > index 9e20a52ece7c..c1df75caf72f 100644
> > --- a/drivers/gpu/drm/drm_crtc.c
> > +++ b/drivers/gpu/drm/drm_crtc.c
> > @@ -5783,24 +5783,6 @@ void drm_mode_config_cleanup(struct drm_device *dev)
> >  }
> >  EXPORT_SYMBOL(drm_mode_config_cleanup);
> > 
> > -struct drm_property *drm_mode_create_rotation_property(struct drm_device
> > *dev, -unsigned int 
> supported_rotations)
> > -{
> > -   static const struct drm_prop_enum_list props[] = {
> > -   { DRM_ROTATE_0,   "rotate-0" },
> > -   { DRM_ROTATE_90,  "rotate-90" },
> > -   { DRM_ROTATE_180, "rotate-180" },
> > -   { DRM_ROTATE_270, "rotate-270" },
> > -   { DRM_REFLECT_X,  "reflect-x" },
> > -   { DRM_REFLECT_Y,  "reflect-y" },
> > -   };
> > -
> > -   return drm_property_create_bitmask(dev, 0, "rotation",
> > -  props, ARRAY_SIZE(props),
> > -  supported_rotations);
> > -}
> > -EXPORT_SYMBOL(drm_mode_create_rotation_property);
> > -
> >  int drm_plane_create_rotation_property(struct drm_plane *plane,
> >unsigned int rotation,
> >unsigned int supported_rotations)
> > diff --git a/drivers/gpu/drm/drm_fb_helper.c
> > b/drivers/gpu/drm/drm_fb_helper.c index ce536c0553e5..cf5f071ffae1 100644
> > --- a/drivers/gpu/drm/drm_fb_helper.c
> > +++ b/drivers/gpu/drm/drm_fb_helper.c
> > @@ -392,15 +392,10 @@ static int restore_fbdev_mode(struct drm_fb_helper
> > *fb_helper) if (plane->type != DRM_PLANE_TYPE_PRIMARY)
> > drm_plane_force_disable(plane);
> > 
> > -   if (plane->rotation_property) {
> > +   if (plane->rotation_property)
> > drm_mode_plane_set_obj_prop(plane,
> > plane->rotation_property,
> > BIT(DRM_ROTATE_0));
> > -   } else if (dev->mode_config.rotation_property) {
> > -   drm_mode_plane_set_obj_prop(plane,
> > -   dev-
> >mode_config.rotation_property,
> > -   BIT(DRM_ROTATE_0));
> > -   }
> > }
> > 
> > for (i = 0; i < fb_helper->crtc_count; i++) {
> > diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> > index 01cf0673f6c8..00a93e44f854 100644
> > --- a/include/drm/drm_crtc.h
> > +++ b/include/drm/drm_crtc.h
> > @@ -2480,11 +2480,6 @@ struct drm_mode_config {
> >  */
> > struct drm_property *plane_type_property;
> > /**
> > -* @rotation_property: Optional property for planes or CRTCs to 
> specify
> > -* 

[PATCH 12/15] drm: RIP mode_config->rotation_property

2016-10-18 Thread Laurent Pinchart
Hi Ville,

On Friday 22 Jul 2016 16:43:13 ville.syrjala at linux.intel.com wrote:
> From: Ville Syrjälä 
> 
> Now that all drivers have been converted over to the per-plane rotation
> property, we can just nuke the global rotation property.
> 
> Signed-off-by: Ville Syrjälä 

Stupid question, but how does this work when the hardware supports global 
rotation only, not per-plane rotation ?

> ---
>  drivers/gpu/drm/drm_atomic.c|  6 ++
>  drivers/gpu/drm/drm_crtc.c  | 18 --
>  drivers/gpu/drm/drm_fb_helper.c |  7 +--
>  include/drm/drm_crtc.h  |  7 ---
>  4 files changed, 3 insertions(+), 35 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 116f940a9267..81061fcdb984 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -709,8 +709,7 @@ int drm_atomic_plane_set_property(struct drm_plane
> *plane, state->src_w = val;
>   } else if (property == config->prop_src_h) {
>   state->src_h = val;
> - } else if (property == config->rotation_property ||
> -property == plane->rotation_property) {
> + } else if (property == plane->rotation_property) {
>   if (!is_power_of_2(val & DRM_ROTATE_MASK))
>   return -EINVAL;
>   state->rotation = val;
> @@ -768,8 +767,7 @@ drm_atomic_plane_get_property(struct drm_plane *plane,
>   *val = state->src_w;
>   } else if (property == config->prop_src_h) {
>   *val = state->src_h;
> - } else if (property == config->rotation_property ||
> -property == plane->rotation_property) {
> + } else if (property == plane->rotation_property) {
>   *val = state->rotation;
>   } else if (plane->funcs->atomic_get_property) {
>   return plane->funcs->atomic_get_property(plane, state, 
property, val);
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 9e20a52ece7c..c1df75caf72f 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -5783,24 +5783,6 @@ void drm_mode_config_cleanup(struct drm_device *dev)
>  }
>  EXPORT_SYMBOL(drm_mode_config_cleanup);
> 
> -struct drm_property *drm_mode_create_rotation_property(struct drm_device
> *dev, -  unsigned int 
supported_rotations)
> -{
> - static const struct drm_prop_enum_list props[] = {
> - { DRM_ROTATE_0,   "rotate-0" },
> - { DRM_ROTATE_90,  "rotate-90" },
> - { DRM_ROTATE_180, "rotate-180" },
> - { DRM_ROTATE_270, "rotate-270" },
> - { DRM_REFLECT_X,  "reflect-x" },
> - { DRM_REFLECT_Y,  "reflect-y" },
> - };
> -
> - return drm_property_create_bitmask(dev, 0, "rotation",
> -props, ARRAY_SIZE(props),
> -supported_rotations);
> -}
> -EXPORT_SYMBOL(drm_mode_create_rotation_property);
> -
>  int drm_plane_create_rotation_property(struct drm_plane *plane,
>  unsigned int rotation,
>  unsigned int supported_rotations)
> diff --git a/drivers/gpu/drm/drm_fb_helper.c
> b/drivers/gpu/drm/drm_fb_helper.c index ce536c0553e5..cf5f071ffae1 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -392,15 +392,10 @@ static int restore_fbdev_mode(struct drm_fb_helper
> *fb_helper) if (plane->type != DRM_PLANE_TYPE_PRIMARY)
>   drm_plane_force_disable(plane);
> 
> - if (plane->rotation_property) {
> + if (plane->rotation_property)
>   drm_mode_plane_set_obj_prop(plane,
>   plane->rotation_property,
>   BIT(DRM_ROTATE_0));
> - } else if (dev->mode_config.rotation_property) {
> - drm_mode_plane_set_obj_prop(plane,
> - dev-
>mode_config.rotation_property,
> - BIT(DRM_ROTATE_0));
> - }
>   }
> 
>   for (i = 0; i < fb_helper->crtc_count; i++) {
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index 01cf0673f6c8..00a93e44f854 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -2480,11 +2480,6 @@ struct drm_mode_config {
>*/
>   struct drm_property *plane_type_property;
>   /**
> -  * @rotation_property: Optional property for planes or CRTCs to 
specify
> -  * rotation.
> -  */
> - struct drm_property *rotation_property;
> - /**
>* @prop_src_x: Default atomic plane property for the plane source
>* position in the connected _framebuffer.
>*/
> @@ -2960,8 +2955,6 @@ extern int drm_mode_plane_set_obj_prop(struct
> drm_plane 

[Intel-gfx] [PATCH 12/15] drm: RIP mode_config->rotation_property

2016-07-25 Thread Joonas Lahtinen
On pe, 2016-07-22 at 16:43 +0300, ville.syrjala at linux.intel.com wrote:
> From: Ville Syrjälä 
> 
> Now that all drivers have been converted over to the per-plane rotation
> property, we can just nuke the global rotation property.
> 
> Signed-off-by: Ville Syrjälä 

Reviewed-by: Joonas Lahtinen 

> ---
>  drivers/gpu/drm/drm_atomic.c    |  6 ++
>  drivers/gpu/drm/drm_crtc.c      | 18 --
>  drivers/gpu/drm/drm_fb_helper.c |  7 +--
>  include/drm/drm_crtc.h          |  7 ---
>  4 files changed, 3 insertions(+), 35 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 116f940a9267..81061fcdb984 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -709,8 +709,7 @@ int drm_atomic_plane_set_property(struct drm_plane *plane,
>  state->src_w = val;
>  } else if (property == config->prop_src_h) {
>  state->src_h = val;
> - } else if (property == config->rotation_property ||
> -    property == plane->rotation_property) {
> + } else if (property == plane->rotation_property) {
>  if (!is_power_of_2(val & DRM_ROTATE_MASK))
>  return -EINVAL;
>  state->rotation = val;
> @@ -768,8 +767,7 @@ drm_atomic_plane_get_property(struct drm_plane *plane,
>  *val = state->src_w;
>  } else if (property == config->prop_src_h) {
>  *val = state->src_h;
> - } else if (property == config->rotation_property ||
> -    property == plane->rotation_property) {
> + } else if (property == plane->rotation_property) {
>  *val = state->rotation;
>  } else if (plane->funcs->atomic_get_property) {
>  return plane->funcs->atomic_get_property(plane, state, 
> property, val);
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 9e20a52ece7c..c1df75caf72f 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -5783,24 +5783,6 @@ void drm_mode_config_cleanup(struct drm_device *dev)
>  }
>  EXPORT_SYMBOL(drm_mode_config_cleanup);
>  
> -struct drm_property *drm_mode_create_rotation_property(struct drm_device 
> *dev,
> -        unsigned int 
> supported_rotations)
> -{
> - static const struct drm_prop_enum_list props[] = {
> - { DRM_ROTATE_0,   "rotate-0" },
> - { DRM_ROTATE_90,  "rotate-90" },
> - { DRM_ROTATE_180, "rotate-180" },
> - { DRM_ROTATE_270, "rotate-270" },
> - { DRM_REFLECT_X,  "reflect-x" },
> - { DRM_REFLECT_Y,  "reflect-y" },
> - };
> -
> - return drm_property_create_bitmask(dev, 0, "rotation",
> -    props, ARRAY_SIZE(props),
> -    supported_rotations);
> -}
> -EXPORT_SYMBOL(drm_mode_create_rotation_property);
> -
>  int drm_plane_create_rotation_property(struct drm_plane *plane,
>         unsigned int rotation,
>         unsigned int supported_rotations)
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index ce536c0553e5..cf5f071ffae1 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -392,15 +392,10 @@ static int restore_fbdev_mode(struct drm_fb_helper 
> *fb_helper)
>  if (plane->type != DRM_PLANE_TYPE_PRIMARY)
>  drm_plane_force_disable(plane);
>  
> - if (plane->rotation_property) {
> + if (plane->rotation_property)
>  drm_mode_plane_set_obj_prop(plane,
>      
> plane->rotation_property,
>      BIT(DRM_ROTATE_0));
> - } else if (dev->mode_config.rotation_property) {
> - drm_mode_plane_set_obj_prop(plane,
> -     
> dev->mode_config.rotation_property,
> -     BIT(DRM_ROTATE_0));
> - }
>  }
>  
>  for (i = 0; i < fb_helper->crtc_count; i++) {
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index 01cf0673f6c8..00a93e44f854 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -2480,11 +2480,6 @@ struct drm_mode_config {
>   */
>  struct drm_property *plane_type_property;
>  /**
> -  * @rotation_property: Optional property for planes or CRTCs to specify
> -  * rotation.
> -  */
> - struct drm_property *rotation_property;
> - /**
>   * @prop_src_x: Default atomic plane property for the plane source
>   * position in the connected _framebuffer.
>   */
> @@ -2960,8 +2955,6 @@ 

[PATCH 12/15] drm: RIP mode_config->rotation_property

2016-07-22 Thread ville.syrj...@linux.intel.com
From: Ville Syrjälä 

Now that all drivers have been converted over to the per-plane rotation
property, we can just nuke the global rotation property.

Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/drm_atomic.c|  6 ++
 drivers/gpu/drm/drm_crtc.c  | 18 --
 drivers/gpu/drm/drm_fb_helper.c |  7 +--
 include/drm/drm_crtc.h  |  7 ---
 4 files changed, 3 insertions(+), 35 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 116f940a9267..81061fcdb984 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -709,8 +709,7 @@ int drm_atomic_plane_set_property(struct drm_plane *plane,
state->src_w = val;
} else if (property == config->prop_src_h) {
state->src_h = val;
-   } else if (property == config->rotation_property ||
-  property == plane->rotation_property) {
+   } else if (property == plane->rotation_property) {
if (!is_power_of_2(val & DRM_ROTATE_MASK))
return -EINVAL;
state->rotation = val;
@@ -768,8 +767,7 @@ drm_atomic_plane_get_property(struct drm_plane *plane,
*val = state->src_w;
} else if (property == config->prop_src_h) {
*val = state->src_h;
-   } else if (property == config->rotation_property ||
-  property == plane->rotation_property) {
+   } else if (property == plane->rotation_property) {
*val = state->rotation;
} else if (plane->funcs->atomic_get_property) {
return plane->funcs->atomic_get_property(plane, state, 
property, val);
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 9e20a52ece7c..c1df75caf72f 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -5783,24 +5783,6 @@ void drm_mode_config_cleanup(struct drm_device *dev)
 }
 EXPORT_SYMBOL(drm_mode_config_cleanup);

-struct drm_property *drm_mode_create_rotation_property(struct drm_device *dev,
-  unsigned int 
supported_rotations)
-{
-   static const struct drm_prop_enum_list props[] = {
-   { DRM_ROTATE_0,   "rotate-0" },
-   { DRM_ROTATE_90,  "rotate-90" },
-   { DRM_ROTATE_180, "rotate-180" },
-   { DRM_ROTATE_270, "rotate-270" },
-   { DRM_REFLECT_X,  "reflect-x" },
-   { DRM_REFLECT_Y,  "reflect-y" },
-   };
-
-   return drm_property_create_bitmask(dev, 0, "rotation",
-  props, ARRAY_SIZE(props),
-  supported_rotations);
-}
-EXPORT_SYMBOL(drm_mode_create_rotation_property);
-
 int drm_plane_create_rotation_property(struct drm_plane *plane,
   unsigned int rotation,
   unsigned int supported_rotations)
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index ce536c0553e5..cf5f071ffae1 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -392,15 +392,10 @@ static int restore_fbdev_mode(struct drm_fb_helper 
*fb_helper)
if (plane->type != DRM_PLANE_TYPE_PRIMARY)
drm_plane_force_disable(plane);

-   if (plane->rotation_property) {
+   if (plane->rotation_property)
drm_mode_plane_set_obj_prop(plane,
plane->rotation_property,
BIT(DRM_ROTATE_0));
-   } else if (dev->mode_config.rotation_property) {
-   drm_mode_plane_set_obj_prop(plane,
-   
dev->mode_config.rotation_property,
-   BIT(DRM_ROTATE_0));
-   }
}

for (i = 0; i < fb_helper->crtc_count; i++) {
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 01cf0673f6c8..00a93e44f854 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -2480,11 +2480,6 @@ struct drm_mode_config {
 */
struct drm_property *plane_type_property;
/**
-* @rotation_property: Optional property for planes or CRTCs to specify
-* rotation.
-*/
-   struct drm_property *rotation_property;
-   /**
 * @prop_src_x: Default atomic plane property for the plane source
 * position in the connected _framebuffer.
 */
@@ -2960,8 +2955,6 @@ extern int drm_mode_plane_set_obj_prop(struct drm_plane 
*plane,
   struct drm_property *property,
   uint64_t value);

-extern struct drm_property *drm_mode_create_rotation_property(struct 
drm_device *dev,
-