Re: [PATCH 2/2] drm/omap: Normalize the zpos and use the normalized_zpos in runtime

2018-01-09 Thread Daniel Vetter
On Fri, Dec 22, 2017 at 08:38:38AM +0200, Peter Ujfalusi wrote:
> 
> 
> On 2017-12-21 15:17, Daniel Vetter wrote:
> > On Thu, Dec 21, 2017 at 02:11:01PM +0200, Peter Ujfalusi wrote:
> >> To avoid zpos collision, use the normalized_zpos when configuring the
> >> zorder of the plane.
> >>
> >> Signed-off-by: Peter Ujfalusi 
> >> ---
> >>  drivers/gpu/drm/omapdrm/omap_drv.c   | 26 +-
> >>  drivers/gpu/drm/omapdrm/omap_plane.c |  2 +-
> >>  2 files changed, 26 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c 
> >> b/drivers/gpu/drm/omapdrm/omap_drv.c
> >> index 6bfc2d9ebb46..230df6d8edd1 100644
> >> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> >> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> >> @@ -21,6 +21,7 @@
> >>  
> >>  #include 
> >>  #include 
> >> +#include 
> >>  #include 
> >>  #include 
> >>  
> >> @@ -54,6 +55,29 @@ MODULE_PARM_DESC(displays,
> >>   * devices
> >>   */
> >>  
> >> +int omap_atomic_helper_check(struct drm_device *dev,
> >> +   struct drm_atomic_state *state)
> >> +{
> >> +  int ret;
> >> +
> >> +  ret = drm_atomic_helper_check_modeset(dev, state);
> >> +  if (ret)
> >> +  return ret;
> >> +
> >> +  ret = drm_atomic_normalize_zpos(dev, state);
> >> +  if (ret)
> >> +  return ret;
> > 
> > Maybe we should call this by default from helpers instead of forcing
> > everyone to reinvent this particular wheel?
> 
> > exynos and sti have the exact same code as you do here, ans rcar could
> > also reuse it. That feels like we should just fix up
> > drm_atomic_helper_check instead of patching all the drivers. And as long
> > as you never change zpos it shouldn't ever run.
> 
> It used to be done within drm_atomic_helper_check_planes() which is
> called from the drm_atomic_helper_check(), but commit
> 38d868e41c4b9 drm: Don't force all planes to be added to the state due
> to zpos
> 
> removed it. Drivers need to do this by themselves if they want to use
> the normalized_zpos.

Oh right, I forgot about all that again.
-Daniel

> 
> > -Daniel
> > 
> >> +
> >> +  ret = drm_atomic_helper_check_planes(dev, state);
> >> +  if (ret)
> >> +  return ret;
> >> +
> >> +  if (state->legacy_cursor_update)
> >> +  state->async_update = !drm_atomic_helper_async_check(dev, 
> >> state);
> >> +
> >> +  return ret;
> >> +}
> >> +
> >>  static void omap_atomic_wait_for_completion(struct drm_device *dev,
> >>struct drm_atomic_state *old_state)
> >>  {
> >> @@ -133,7 +157,7 @@ static const struct drm_mode_config_helper_funcs 
> >> omap_mode_config_helper_funcs =
> >>  static const struct drm_mode_config_funcs omap_mode_config_funcs = {
> >>.fb_create = omap_framebuffer_create,
> >>.output_poll_changed = drm_fb_helper_output_poll_changed,
> >> -  .atomic_check = drm_atomic_helper_check,
> >> +  .atomic_check = omap_atomic_helper_check,
> >>.atomic_commit = drm_atomic_helper_commit,
> >>  };
> >>  
> >> diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c 
> >> b/drivers/gpu/drm/omapdrm/omap_plane.c
> >> index bbbdd560e503..abd78b511e6d 100644
> >> --- a/drivers/gpu/drm/omapdrm/omap_plane.c
> >> +++ b/drivers/gpu/drm/omapdrm/omap_plane.c
> >> @@ -65,7 +65,7 @@ static void omap_plane_atomic_update(struct drm_plane 
> >> *plane,
> >>info.rotation_type = OMAP_DSS_ROT_NONE;
> >>info.rotation = DRM_MODE_ROTATE_0;
> >>info.global_alpha = 0xff;
> >> -  info.zorder = state->zpos;
> >> +  info.zorder = state->normalized_zpos;
> >>  
> >>/* update scanout: */
> >>omap_framebuffer_update_scanout(state->fb, state, &info);
> >> -- 
> >> Peter
> >>
> >> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
> >> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
> >>
> > 
> 
> - Péter
> 
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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


Re: [PATCH 2/2] drm/omap: Normalize the zpos and use the normalized_zpos in runtime

2017-12-21 Thread Peter Ujfalusi


On 2017-12-21 15:17, Daniel Vetter wrote:
> On Thu, Dec 21, 2017 at 02:11:01PM +0200, Peter Ujfalusi wrote:
>> To avoid zpos collision, use the normalized_zpos when configuring the
>> zorder of the plane.
>>
>> Signed-off-by: Peter Ujfalusi 
>> ---
>>  drivers/gpu/drm/omapdrm/omap_drv.c   | 26 +-
>>  drivers/gpu/drm/omapdrm/omap_plane.c |  2 +-
>>  2 files changed, 26 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c 
>> b/drivers/gpu/drm/omapdrm/omap_drv.c
>> index 6bfc2d9ebb46..230df6d8edd1 100644
>> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
>> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
>> @@ -21,6 +21,7 @@
>>  
>>  #include 
>>  #include 
>> +#include 
>>  #include 
>>  #include 
>>  
>> @@ -54,6 +55,29 @@ MODULE_PARM_DESC(displays,
>>   * devices
>>   */
>>  
>> +int omap_atomic_helper_check(struct drm_device *dev,
>> + struct drm_atomic_state *state)
>> +{
>> +int ret;
>> +
>> +ret = drm_atomic_helper_check_modeset(dev, state);
>> +if (ret)
>> +return ret;
>> +
>> +ret = drm_atomic_normalize_zpos(dev, state);
>> +if (ret)
>> +return ret;
> 
> Maybe we should call this by default from helpers instead of forcing
> everyone to reinvent this particular wheel?

> exynos and sti have the exact same code as you do here, ans rcar could
> also reuse it. That feels like we should just fix up
> drm_atomic_helper_check instead of patching all the drivers. And as long
> as you never change zpos it shouldn't ever run.

It used to be done within drm_atomic_helper_check_planes() which is
called from the drm_atomic_helper_check(), but commit
38d868e41c4b9 drm: Don't force all planes to be added to the state due
to zpos

removed it. Drivers need to do this by themselves if they want to use
the normalized_zpos.

> -Daniel
> 
>> +
>> +ret = drm_atomic_helper_check_planes(dev, state);
>> +if (ret)
>> +return ret;
>> +
>> +if (state->legacy_cursor_update)
>> +state->async_update = !drm_atomic_helper_async_check(dev, 
>> state);
>> +
>> +return ret;
>> +}
>> +
>>  static void omap_atomic_wait_for_completion(struct drm_device *dev,
>>  struct drm_atomic_state *old_state)
>>  {
>> @@ -133,7 +157,7 @@ static const struct drm_mode_config_helper_funcs 
>> omap_mode_config_helper_funcs =
>>  static const struct drm_mode_config_funcs omap_mode_config_funcs = {
>>  .fb_create = omap_framebuffer_create,
>>  .output_poll_changed = drm_fb_helper_output_poll_changed,
>> -.atomic_check = drm_atomic_helper_check,
>> +.atomic_check = omap_atomic_helper_check,
>>  .atomic_commit = drm_atomic_helper_commit,
>>  };
>>  
>> diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c 
>> b/drivers/gpu/drm/omapdrm/omap_plane.c
>> index bbbdd560e503..abd78b511e6d 100644
>> --- a/drivers/gpu/drm/omapdrm/omap_plane.c
>> +++ b/drivers/gpu/drm/omapdrm/omap_plane.c
>> @@ -65,7 +65,7 @@ static void omap_plane_atomic_update(struct drm_plane 
>> *plane,
>>  info.rotation_type = OMAP_DSS_ROT_NONE;
>>  info.rotation = DRM_MODE_ROTATE_0;
>>  info.global_alpha = 0xff;
>> -info.zorder = state->zpos;
>> +info.zorder = state->normalized_zpos;
>>  
>>  /* update scanout: */
>>  omap_framebuffer_update_scanout(state->fb, state, &info);
>> -- 
>> Peter
>>
>> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
>> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
>>
> 

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 2/2] drm/omap: Normalize the zpos and use the normalized_zpos in runtime

2017-12-21 Thread Daniel Vetter
On Thu, Dec 21, 2017 at 02:11:01PM +0200, Peter Ujfalusi wrote:
> To avoid zpos collision, use the normalized_zpos when configuring the
> zorder of the plane.
> 
> Signed-off-by: Peter Ujfalusi 
> ---
>  drivers/gpu/drm/omapdrm/omap_drv.c   | 26 +-
>  drivers/gpu/drm/omapdrm/omap_plane.c |  2 +-
>  2 files changed, 26 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c 
> b/drivers/gpu/drm/omapdrm/omap_drv.c
> index 6bfc2d9ebb46..230df6d8edd1 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -21,6 +21,7 @@
>  
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  
> @@ -54,6 +55,29 @@ MODULE_PARM_DESC(displays,
>   * devices
>   */
>  
> +int omap_atomic_helper_check(struct drm_device *dev,
> +  struct drm_atomic_state *state)
> +{
> + int ret;
> +
> + ret = drm_atomic_helper_check_modeset(dev, state);
> + if (ret)
> + return ret;
> +
> + ret = drm_atomic_normalize_zpos(dev, state);
> + if (ret)
> + return ret;

Maybe we should call this by default from helpers instead of forcing
everyone to reinvent this particular wheel?

exynos and sti have the exact same code as you do here, ans rcar could
also reuse it. That feels like we should just fix up
drm_atomic_helper_check instead of patching all the drivers. And as long
as you never change zpos it shouldn't ever run.
-Daniel

> +
> + ret = drm_atomic_helper_check_planes(dev, state);
> + if (ret)
> + return ret;
> +
> + if (state->legacy_cursor_update)
> + state->async_update = !drm_atomic_helper_async_check(dev, 
> state);
> +
> + return ret;
> +}
> +
>  static void omap_atomic_wait_for_completion(struct drm_device *dev,
>   struct drm_atomic_state *old_state)
>  {
> @@ -133,7 +157,7 @@ static const struct drm_mode_config_helper_funcs 
> omap_mode_config_helper_funcs =
>  static const struct drm_mode_config_funcs omap_mode_config_funcs = {
>   .fb_create = omap_framebuffer_create,
>   .output_poll_changed = drm_fb_helper_output_poll_changed,
> - .atomic_check = drm_atomic_helper_check,
> + .atomic_check = omap_atomic_helper_check,
>   .atomic_commit = drm_atomic_helper_commit,
>  };
>  
> diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c 
> b/drivers/gpu/drm/omapdrm/omap_plane.c
> index bbbdd560e503..abd78b511e6d 100644
> --- a/drivers/gpu/drm/omapdrm/omap_plane.c
> +++ b/drivers/gpu/drm/omapdrm/omap_plane.c
> @@ -65,7 +65,7 @@ static void omap_plane_atomic_update(struct drm_plane 
> *plane,
>   info.rotation_type = OMAP_DSS_ROT_NONE;
>   info.rotation = DRM_MODE_ROTATE_0;
>   info.global_alpha = 0xff;
> - info.zorder = state->zpos;
> + info.zorder = state->normalized_zpos;
>  
>   /* update scanout: */
>   omap_framebuffer_update_scanout(state->fb, state, &info);
> -- 
> Peter
> 
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
> 

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


[PATCH 2/2] drm/omap: Normalize the zpos and use the normalized_zpos in runtime

2017-12-21 Thread Peter Ujfalusi
To avoid zpos collision, use the normalized_zpos when configuring the
zorder of the plane.

Signed-off-by: Peter Ujfalusi 
---
 drivers/gpu/drm/omapdrm/omap_drv.c   | 26 +-
 drivers/gpu/drm/omapdrm/omap_plane.c |  2 +-
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c 
b/drivers/gpu/drm/omapdrm/omap_drv.c
index 6bfc2d9ebb46..230df6d8edd1 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -21,6 +21,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -54,6 +55,29 @@ MODULE_PARM_DESC(displays,
  * devices
  */
 
+int omap_atomic_helper_check(struct drm_device *dev,
+struct drm_atomic_state *state)
+{
+   int ret;
+
+   ret = drm_atomic_helper_check_modeset(dev, state);
+   if (ret)
+   return ret;
+
+   ret = drm_atomic_normalize_zpos(dev, state);
+   if (ret)
+   return ret;
+
+   ret = drm_atomic_helper_check_planes(dev, state);
+   if (ret)
+   return ret;
+
+   if (state->legacy_cursor_update)
+   state->async_update = !drm_atomic_helper_async_check(dev, 
state);
+
+   return ret;
+}
+
 static void omap_atomic_wait_for_completion(struct drm_device *dev,
struct drm_atomic_state *old_state)
 {
@@ -133,7 +157,7 @@ static const struct drm_mode_config_helper_funcs 
omap_mode_config_helper_funcs =
 static const struct drm_mode_config_funcs omap_mode_config_funcs = {
.fb_create = omap_framebuffer_create,
.output_poll_changed = drm_fb_helper_output_poll_changed,
-   .atomic_check = drm_atomic_helper_check,
+   .atomic_check = omap_atomic_helper_check,
.atomic_commit = drm_atomic_helper_commit,
 };
 
diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c 
b/drivers/gpu/drm/omapdrm/omap_plane.c
index bbbdd560e503..abd78b511e6d 100644
--- a/drivers/gpu/drm/omapdrm/omap_plane.c
+++ b/drivers/gpu/drm/omapdrm/omap_plane.c
@@ -65,7 +65,7 @@ static void omap_plane_atomic_update(struct drm_plane *plane,
info.rotation_type = OMAP_DSS_ROT_NONE;
info.rotation = DRM_MODE_ROTATE_0;
info.global_alpha = 0xff;
-   info.zorder = state->zpos;
+   info.zorder = state->normalized_zpos;
 
/* update scanout: */
omap_framebuffer_update_scanout(state->fb, state, &info);
-- 
Peter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel