All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [linux-sunxi] Re: [PATCH v3 04/11] drm/sun4i: abstract the layer type
@ 2017-04-05  5:23 Icenowy Zheng
  2017-04-05  8:09   ` Maxime Ripard
  0 siblings, 1 reply; 9+ messages in thread
From: Icenowy Zheng @ 2017-04-05  5:23 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: devicetree, Jernej Skrabec, linux-kernel, dri-devel, linux-sunxi,
	Rob Herring, Maxime Ripard, linux-clk, linux-arm-kernel


2017年4月5日 10:27于 Chen-Yu Tsai <wens@csie.org>写道:
>
> On Wed, Apr 5, 2017 at 3:53 AM, Icenowy Zheng <icenowy@aosc.io> wrote: 
> > 
> > 
> > 在 2017年04月05日 03:28, Sean Paul 写道: 
> >> 
> >> On Thu, Mar 30, 2017 at 03:46:06AM +0800, Icenowy Zheng wrote: 
> >>> 
> >>> As we are going to add support for the Allwinner DE2 Mixer in sun4i-drm 
> >>> driver, we will finally have two types of layer. 
> >>> 
> >>> Abstract the layer type to void * and a ops struct, which contains the 
> >>> only function used by crtc -- get the drm_plane struct of the layer. 
> >>> 
> >>> Signed-off-by: Icenowy Zheng <icenowy@aosc.io> 
> >>> --- 
> >>> Refactored patch in v3. 
> >>> 
> >>>  drivers/gpu/drm/sun4i/sun4i_crtc.c  | 19 +++++++++++-------- 
> >>>  drivers/gpu/drm/sun4i/sun4i_crtc.h  |  3 ++- 
> >>>  drivers/gpu/drm/sun4i/sun4i_layer.c | 19 ++++++++++++++++++- 
> >>>  drivers/gpu/drm/sun4i/sun4i_layer.h |  2 +- 
> >>>  drivers/gpu/drm/sun4i/sunxi_layer.h | 17 +++++++++++++++++ 
> >>>  5 files changed, 49 insertions(+), 11 deletions(-) 
> >>>  create mode 100644 drivers/gpu/drm/sun4i/sunxi_layer.h 
> >>> 
> >>> diff --git a/drivers/gpu/drm/sun4i/sun4i_crtc.c 
> >>> b/drivers/gpu/drm/sun4i/sun4i_crtc.c 
> >>> index 3c876c3a356a..33854ee7f636 100644 
> >>> --- a/drivers/gpu/drm/sun4i/sun4i_crtc.c 
> >>> +++ b/drivers/gpu/drm/sun4i/sun4i_crtc.c 
> >>> @@ -29,6 +29,7 @@ 
> >>>  #include "sun4i_crtc.h" 
> >>>  #include "sun4i_drv.h" 
> >>>  #include "sun4i_layer.h" 
> >>> +#include "sunxi_layer.h" 
> >>>  #include "sun4i_tcon.h" 
> >>> 
> >>>  static void sun4i_crtc_atomic_begin(struct drm_crtc *crtc, 
> >>> @@ -149,7 +150,7 @@ struct sun4i_crtc *sun4i_crtc_init(struct drm_device 
> >>> *drm, 
> >>>         scrtc->tcon = tcon; 
> >>> 
> >>>         /* Create our layers */ 
> >>> -       scrtc->layers = sun4i_layers_init(drm, scrtc->backend); 
> >>> +       scrtc->layers = (void **)sun4i_layers_init(drm, scrtc); 
> >>>         if (IS_ERR(scrtc->layers)) { 
> >>>                 dev_err(drm->dev, "Couldn't create the planes\n"); 
> >>>                 return NULL; 
> >>> @@ -157,14 +158,15 @@ struct sun4i_crtc *sun4i_crtc_init(struct 
> >>> drm_device *drm, 
> >>> 
> >>>         /* find primary and cursor planes for drm_crtc_init_with_planes 
> >>> */ 
> >>>         for (i = 0; scrtc->layers[i]; i++) { 
> >>> -               struct sun4i_layer *layer = scrtc->layers[i]; 
> >>> +               void *layer = scrtc->layers[i]; 
> >>> +               struct drm_plane *plane = 
> >>> scrtc->layer_ops->get_plane(layer); 
> >>> 
> >>> -               switch (layer->plane.type) { 
> >>> +               switch (plane->type) { 
> >>>                 case DRM_PLANE_TYPE_PRIMARY: 
> >>> -                       primary = &layer->plane; 
> >>> +                       primary = plane; 
> >>>                         break; 
> >>>                 case DRM_PLANE_TYPE_CURSOR: 
> >>> -                       cursor = &layer->plane; 
> >>> +                       cursor = plane; 
> >>>                         break; 
> >>>                 default: 
> >>>                         break; 
> >>> @@ -190,10 +192,11 @@ struct sun4i_crtc *sun4i_crtc_init(struct 
> >>> drm_device *drm, 
> >>>         /* Set possible_crtcs to this crtc for overlay planes */ 
> >>>         for (i = 0; scrtc->layers[i]; i++) { 
> >>>                 uint32_t possible_crtcs = 
> >>> BIT(drm_crtc_index(&scrtc->crtc)); 
> >>> -               struct sun4i_layer *layer = scrtc->layers[i]; 
> >>> +               void *layer = scrtc->layers[i]; 
> >>> +               struct drm_plane *plane = 
> >>> scrtc->layer_ops->get_plane(layer); 
> >>> 
> >>> -               if (layer->plane.type == DRM_PLANE_TYPE_OVERLAY) 
> >>> -                       layer->plane.possible_crtcs = possible_crtcs; 
> >>> +               if (plane->type == DRM_PLANE_TYPE_OVERLAY) 
> >>> +                       plane->possible_crtcs = possible_crtcs; 
> >>>         } 
> >>> 
> >>>         return scrtc; 
> >>> diff --git a/drivers/gpu/drm/sun4i/sun4i_crtc.h 
> >>> b/drivers/gpu/drm/sun4i/sun4i_crtc.h 
> >>> index 230cb8f0d601..a4036ee44cf8 100644 
> >>> --- a/drivers/gpu/drm/sun4i/sun4i_crtc.h 
> >>> +++ b/drivers/gpu/drm/sun4i/sun4i_crtc.h 
> >>> @@ -19,7 +19,8 @@ struct sun4i_crtc { 
> >>> 
> >>>         struct sun4i_backend            *backend; 
> >>>         struct sun4i_tcon               *tcon; 
> >>> -       struct sun4i_layer              **layers; 
> >>> +       void                            **layers; 
> >>> +       const struct sunxi_layer_ops    *layer_ops; 
> >> 
> >> 
> >> I think you should probably take a different approach to abstract the 
> >> layer 
> >> type. How about creating 
> >> 
> >> struct sunxi_layer { 
> >>         struct drm_plane plane; 
> >> } 
> >> 
> >> base and then subclassing that for sun4i and sun8i? By doing this you can 
> >> avoid 
> >> the nasty casting and you can also get rid of the get_plane() hook and 
> >> layer_ops. 
> > 
> > 
> > For the situation that using ** things are easily to get weird. 
>
> That code could be reworked, by initializing the layers directly within 
> the crtc init code. If you look at rockchip's drm driver, you'll see 
> they do this. There is a good reason to do it this way, as you need 
> to first create the primary and cursor layers, pass them in when you 
> create the crtc, then initialize any additional layers with the 
> possible_crtcs bitmap. 

But furthurly maybe more layers will be created for DE2 mixer, and may even depends on mixer type (On A83T/H3/A64/H5 mixer1 has fewer channel than mixer0).

>
> In our driver we are currently initializing all layers, then going 
> back and filling in possible_crtcs for the extra layers. 
>
> And as Maxime and I mentioned in the other thread, we don't really 
> need to keep a reference to **layers. 
>
> Regards 
> ChenYu 
>
> > 
> >> 
> >> Sean 
> >> 
> >> 
> >> 
> >>>  }; 
> >>> 
> >>>  static inline struct sun4i_crtc *drm_crtc_to_sun4i_crtc(struct drm_crtc 
> >>> *crtc) 
> >>> diff --git a/drivers/gpu/drm/sun4i/sun4i_layer.c 
> >>> b/drivers/gpu/drm/sun4i/sun4i_layer.c 
> >>> index f26bde5b9117..bc4a70d6968b 100644 
> >>> --- a/drivers/gpu/drm/sun4i/sun4i_layer.c 
> >>> +++ b/drivers/gpu/drm/sun4i/sun4i_layer.c 
> >>> @@ -16,7 +16,9 @@ 
> >>>  #include <drm/drmP.h> 
> >>> 
> >>>  #include "sun4i_backend.h" 
> >>> +#include "sun4i_crtc.h" 
> >>>  #include "sun4i_layer.h" 
> >>> +#include "sunxi_layer.h" 
> >>> 
> >>>  struct sun4i_plane_desc { 
> >>>                enum drm_plane_type     type; 
> >>> @@ -100,6 +102,17 @@ static const struct sun4i_plane_desc 
> >>> sun4i_backend_planes[] = { 
> >>>         }, 
> >>>  }; 
> >>> 
> >>> +static struct drm_plane *sun4i_layer_get_plane(void *layer) 
> >>> +{ 
> >>> +       struct sun4i_layer *sun4i_layer = layer; 
> >>> + 
> >>> +       return &sun4i_layer->plane; 
> >>> +} 
> >>> + 
> >>> +static const struct sunxi_layer_ops layer_ops = { 
> >>> +       .get_plane = sun4i_layer_get_plane, 
> >>> +}; 
> >>> + 
> >>>  static struct sun4i_layer *sun4i_layer_init_one(struct drm_device *drm, 
> >>>                                                 struct sun4i_backend 
> >>> *backend, 
> >>>                                                 const struct 
> >>> sun4i_plane_desc *plane) 
> >>> @@ -129,9 +142,10 @@ static struct sun4i_layer 
> >>> *sun4i_layer_init_one(struct drm_device *drm, 
> >>>  } 
> >>> 
> >>>  struct sun4i_layer **sun4i_layers_init(struct drm_device *drm, 
> >>> -                                      struct sun4i_backend *backend) 
> >>> +                                      struct sun4i_crtc *crtc) 
> >>>  { 
> >>>         struct sun4i_layer **layers; 
> >>> +       struct sun4i_backend *backend = crtc->backend; 
> >>>         int i; 
> >>> 
> >>>         layers = devm_kcalloc(drm->dev, ARRAY_SIZE(sun4i_backend_planes) 
> >>> + 1, 
> >>> @@ -181,5 +195,8 @@ struct sun4i_layer **sun4i_layers_init(struct 
> >>> drm_device *drm, 
> >>>                 layers[i] = layer; 
> >>>         }; 
> >>> 
> >>> +       /* Assign layer ops to the CRTC */ 
> >>> +       crtc->layer_ops = &layer_ops; 
> >>> + 
> >>>         return layers; 
> >>>  } 
> >>> diff --git a/drivers/gpu/drm/sun4i/sun4i_layer.h 
> >>> b/drivers/gpu/drm/sun4i/sun4i_layer.h 
> >>> index 4be1f0919df2..425eea7b9e3b 100644 
> >>> --- a/drivers/gpu/drm/sun4i/sun4i_layer.h 
> >>> +++ b/drivers/gpu/drm/sun4i/sun4i_layer.h 
> >>> @@ -27,6 +27,6 @@ plane_to_sun4i_layer(struct drm_plane *plane) 
> >>>  } 
> >>> 
> >>>  struct sun4i_layer **sun4i_layers_init(struct drm_device *drm, 
> >>> -                                      struct sun4i_backend *backend); 
> >>> +                                      struct sun4i_crtc *crtc); 
> >>> 
> >>>  #endif /* _SUN4I_LAYER_H_ */ 
> >>> diff --git a/drivers/gpu/drm/sun4i/sunxi_layer.h 
> >>> b/drivers/gpu/drm/sun4i/sunxi_layer.h 
> >>> new file mode 100644 
> >>> index 000000000000..d8838ec39299 
> >>> --- /dev/null 
> >>> +++ b/drivers/gpu/drm/sun4i/sunxi_layer.h 
> >>> @@ -0,0 +1,17 @@ 
> >>> +/* 
> >>> + * Copyright (C) 2017 Icenowy Zheng <icenowy@aosc.xyz> 
> >>> + * 
> >>> + * This program is free software; you can redistribute it and/or 
> >>> + * modify it under the terms of the GNU General Public License as 
> >>> + * published by the Free Software Foundation; either version 2 of 
> >>> + * the License, or (at your option) any later version. 
> >>> + */ 
> >>> + 
> >>> +#ifndef _SUNXI_LAYER_H_ 
> >>> +#define _SUNXI_LAYER_H_ 
> >>> + 
> >>> +struct sunxi_layer_ops { 
> >>> +       struct drm_plane *(*get_plane)(void *layer); 
> >>> +}; 
> >>> + 
> >>> +#endif /* _SUNXI_LAYER_H_ */ 
> >>> -- 
> >>> 2.12.0 
> >>> 
> >>> 
> >>> _______________________________________________ 
> >>> linux-arm-kernel mailing list 
> >>> linux-arm-kernel@lists.infradead.org 
> >>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 
> >> 
> >> 
> > 
> > -- 
> > You received this message because you are subscribed to the Google Groups 
> > "linux-sunxi" group. 
> > To unsubscribe from this group and stop receiving emails from it, send an 
> > email to linux-sunxi+unsubscribe@googlegroups.com. 
> > For more options, visit https://groups.google.com/d/optout. 
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [linux-sunxi] Re: [PATCH v3 04/11] drm/sun4i: abstract the layer type
@ 2017-04-05  8:09   ` Maxime Ripard
  0 siblings, 0 replies; 9+ messages in thread
From: Maxime Ripard @ 2017-04-05  8:09 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Chen-Yu Tsai, linux-arm-kernel, Sean Paul, linux-sunxi,
	Rob Herring, linux-kernel, devicetree, Jernej Skrabec, linux-clk,
	dri-devel

[-- Attachment #1: Type: text/plain, Size: 6913 bytes --]

On Wed, Apr 05, 2017 at 01:23:15PM +0800, Icenowy Zheng wrote:
> 
> 2017年4月5日 10:27于 Chen-Yu Tsai <wens@csie.org>写道:
> >
> > On Wed, Apr 5, 2017 at 3:53 AM, Icenowy Zheng <icenowy@aosc.io> wrote: 
> > > 
> > > 
> > > 在 2017年04月05日 03:28, Sean Paul 写道: 
> > >> 
> > >> On Thu, Mar 30, 2017 at 03:46:06AM +0800, Icenowy Zheng wrote: 
> > >>> 
> > >>> As we are going to add support for the Allwinner DE2 Mixer in sun4i-drm 
> > >>> driver, we will finally have two types of layer. 
> > >>> 
> > >>> Abstract the layer type to void * and a ops struct, which contains the 
> > >>> only function used by crtc -- get the drm_plane struct of the layer. 
> > >>> 
> > >>> Signed-off-by: Icenowy Zheng <icenowy@aosc.io> 
> > >>> --- 
> > >>> Refactored patch in v3. 
> > >>> 
> > >>>  drivers/gpu/drm/sun4i/sun4i_crtc.c  | 19 +++++++++++-------- 
> > >>>  drivers/gpu/drm/sun4i/sun4i_crtc.h  |  3 ++- 
> > >>>  drivers/gpu/drm/sun4i/sun4i_layer.c | 19 ++++++++++++++++++- 
> > >>>  drivers/gpu/drm/sun4i/sun4i_layer.h |  2 +- 
> > >>>  drivers/gpu/drm/sun4i/sunxi_layer.h | 17 +++++++++++++++++ 
> > >>>  5 files changed, 49 insertions(+), 11 deletions(-) 
> > >>>  create mode 100644 drivers/gpu/drm/sun4i/sunxi_layer.h 
> > >>> 
> > >>> diff --git a/drivers/gpu/drm/sun4i/sun4i_crtc.c 
> > >>> b/drivers/gpu/drm/sun4i/sun4i_crtc.c 
> > >>> index 3c876c3a356a..33854ee7f636 100644 
> > >>> --- a/drivers/gpu/drm/sun4i/sun4i_crtc.c 
> > >>> +++ b/drivers/gpu/drm/sun4i/sun4i_crtc.c 
> > >>> @@ -29,6 +29,7 @@ 
> > >>>  #include "sun4i_crtc.h" 
> > >>>  #include "sun4i_drv.h" 
> > >>>  #include "sun4i_layer.h" 
> > >>> +#include "sunxi_layer.h" 
> > >>>  #include "sun4i_tcon.h" 
> > >>> 
> > >>>  static void sun4i_crtc_atomic_begin(struct drm_crtc *crtc, 
> > >>> @@ -149,7 +150,7 @@ struct sun4i_crtc *sun4i_crtc_init(struct drm_device 
> > >>> *drm, 
> > >>>         scrtc->tcon = tcon; 
> > >>> 
> > >>>         /* Create our layers */ 
> > >>> -       scrtc->layers = sun4i_layers_init(drm, scrtc->backend); 
> > >>> +       scrtc->layers = (void **)sun4i_layers_init(drm, scrtc); 
> > >>>         if (IS_ERR(scrtc->layers)) { 
> > >>>                 dev_err(drm->dev, "Couldn't create the planes\n"); 
> > >>>                 return NULL; 
> > >>> @@ -157,14 +158,15 @@ struct sun4i_crtc *sun4i_crtc_init(struct 
> > >>> drm_device *drm, 
> > >>> 
> > >>>         /* find primary and cursor planes for drm_crtc_init_with_planes 
> > >>> */ 
> > >>>         for (i = 0; scrtc->layers[i]; i++) { 
> > >>> -               struct sun4i_layer *layer = scrtc->layers[i]; 
> > >>> +               void *layer = scrtc->layers[i]; 
> > >>> +               struct drm_plane *plane = 
> > >>> scrtc->layer_ops->get_plane(layer); 
> > >>> 
> > >>> -               switch (layer->plane.type) { 
> > >>> +               switch (plane->type) { 
> > >>>                 case DRM_PLANE_TYPE_PRIMARY: 
> > >>> -                       primary = &layer->plane; 
> > >>> +                       primary = plane; 
> > >>>                         break; 
> > >>>                 case DRM_PLANE_TYPE_CURSOR: 
> > >>> -                       cursor = &layer->plane; 
> > >>> +                       cursor = plane; 
> > >>>                         break; 
> > >>>                 default: 
> > >>>                         break; 
> > >>> @@ -190,10 +192,11 @@ struct sun4i_crtc *sun4i_crtc_init(struct 
> > >>> drm_device *drm, 
> > >>>         /* Set possible_crtcs to this crtc for overlay planes */ 
> > >>>         for (i = 0; scrtc->layers[i]; i++) { 
> > >>>                 uint32_t possible_crtcs = 
> > >>> BIT(drm_crtc_index(&scrtc->crtc)); 
> > >>> -               struct sun4i_layer *layer = scrtc->layers[i]; 
> > >>> +               void *layer = scrtc->layers[i]; 
> > >>> +               struct drm_plane *plane = 
> > >>> scrtc->layer_ops->get_plane(layer); 
> > >>> 
> > >>> -               if (layer->plane.type == DRM_PLANE_TYPE_OVERLAY) 
> > >>> -                       layer->plane.possible_crtcs = possible_crtcs; 
> > >>> +               if (plane->type == DRM_PLANE_TYPE_OVERLAY) 
> > >>> +                       plane->possible_crtcs = possible_crtcs; 
> > >>>         } 
> > >>> 
> > >>>         return scrtc; 
> > >>> diff --git a/drivers/gpu/drm/sun4i/sun4i_crtc.h 
> > >>> b/drivers/gpu/drm/sun4i/sun4i_crtc.h 
> > >>> index 230cb8f0d601..a4036ee44cf8 100644 
> > >>> --- a/drivers/gpu/drm/sun4i/sun4i_crtc.h 
> > >>> +++ b/drivers/gpu/drm/sun4i/sun4i_crtc.h 
> > >>> @@ -19,7 +19,8 @@ struct sun4i_crtc { 
> > >>> 
> > >>>         struct sun4i_backend            *backend; 
> > >>>         struct sun4i_tcon               *tcon; 
> > >>> -       struct sun4i_layer              **layers; 
> > >>> +       void                            **layers; 
> > >>> +       const struct sunxi_layer_ops    *layer_ops; 
> > >> 
> > >> 
> > >> I think you should probably take a different approach to abstract the 
> > >> layer 
> > >> type. How about creating 
> > >> 
> > >> struct sunxi_layer { 
> > >>         struct drm_plane plane; 
> > >> } 
> > >> 
> > >> base and then subclassing that for sun4i and sun8i? By doing this you can 
> > >> avoid 
> > >> the nasty casting and you can also get rid of the get_plane() hook and 
> > >> layer_ops. 
> > > 
> > > 
> > > For the situation that using ** things are easily to get weird. 
> >
> > That code could be reworked, by initializing the layers directly within 
> > the crtc init code. If you look at rockchip's drm driver, you'll see 
> > they do this. There is a good reason to do it this way, as you need 
> > to first create the primary and cursor layers, pass them in when you 
> > create the crtc, then initialize any additional layers with the 
> > possible_crtcs bitmap. 
> 
> But furthurly maybe more layers will be created for DE2 mixer, and
> may even depends on mixer type (On A83T/H3/A64/H5 mixer1 has fewer
> channel than mixer0).

You'll always have one primary and one cursor plane, no matter how
much planes you support.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Re: [PATCH v3 04/11] drm/sun4i: abstract the layer type
@ 2017-04-05  8:09   ` Maxime Ripard
  0 siblings, 0 replies; 9+ messages in thread
From: Maxime Ripard @ 2017-04-05  8:09 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Chen-Yu Tsai, linux-arm-kernel, Sean Paul, linux-sunxi,
	Rob Herring, linux-kernel, devicetree, Jernej Skrabec, linux-clk,
	dri-devel

[-- Attachment #1: Type: text/plain, Size: 7199 bytes --]

On Wed, Apr 05, 2017 at 01:23:15PM +0800, Icenowy Zheng wrote:
> 
> 2017年4月5日 10:27于 Chen-Yu Tsai <wens@csie.org>写道:
> >
> > On Wed, Apr 5, 2017 at 3:53 AM, Icenowy Zheng <icenowy@aosc.io> wrote: 
> > > 
> > > 
> > > 在 2017年04月05日 03:28, Sean Paul 写道: 
> > >> 
> > >> On Thu, Mar 30, 2017 at 03:46:06AM +0800, Icenowy Zheng wrote: 
> > >>> 
> > >>> As we are going to add support for the Allwinner DE2 Mixer in sun4i-drm 
> > >>> driver, we will finally have two types of layer. 
> > >>> 
> > >>> Abstract the layer type to void * and a ops struct, which contains the 
> > >>> only function used by crtc -- get the drm_plane struct of the layer. 
> > >>> 
> > >>> Signed-off-by: Icenowy Zheng <icenowy@aosc.io> 
> > >>> --- 
> > >>> Refactored patch in v3. 
> > >>> 
> > >>>  drivers/gpu/drm/sun4i/sun4i_crtc.c  | 19 +++++++++++-------- 
> > >>>  drivers/gpu/drm/sun4i/sun4i_crtc.h  |  3 ++- 
> > >>>  drivers/gpu/drm/sun4i/sun4i_layer.c | 19 ++++++++++++++++++- 
> > >>>  drivers/gpu/drm/sun4i/sun4i_layer.h |  2 +- 
> > >>>  drivers/gpu/drm/sun4i/sunxi_layer.h | 17 +++++++++++++++++ 
> > >>>  5 files changed, 49 insertions(+), 11 deletions(-) 
> > >>>  create mode 100644 drivers/gpu/drm/sun4i/sunxi_layer.h 
> > >>> 
> > >>> diff --git a/drivers/gpu/drm/sun4i/sun4i_crtc.c 
> > >>> b/drivers/gpu/drm/sun4i/sun4i_crtc.c 
> > >>> index 3c876c3a356a..33854ee7f636 100644 
> > >>> --- a/drivers/gpu/drm/sun4i/sun4i_crtc.c 
> > >>> +++ b/drivers/gpu/drm/sun4i/sun4i_crtc.c 
> > >>> @@ -29,6 +29,7 @@ 
> > >>>  #include "sun4i_crtc.h" 
> > >>>  #include "sun4i_drv.h" 
> > >>>  #include "sun4i_layer.h" 
> > >>> +#include "sunxi_layer.h" 
> > >>>  #include "sun4i_tcon.h" 
> > >>> 
> > >>>  static void sun4i_crtc_atomic_begin(struct drm_crtc *crtc, 
> > >>> @@ -149,7 +150,7 @@ struct sun4i_crtc *sun4i_crtc_init(struct drm_device 
> > >>> *drm, 
> > >>>         scrtc->tcon = tcon; 
> > >>> 
> > >>>         /* Create our layers */ 
> > >>> -       scrtc->layers = sun4i_layers_init(drm, scrtc->backend); 
> > >>> +       scrtc->layers = (void **)sun4i_layers_init(drm, scrtc); 
> > >>>         if (IS_ERR(scrtc->layers)) { 
> > >>>                 dev_err(drm->dev, "Couldn't create the planes\n"); 
> > >>>                 return NULL; 
> > >>> @@ -157,14 +158,15 @@ struct sun4i_crtc *sun4i_crtc_init(struct 
> > >>> drm_device *drm, 
> > >>> 
> > >>>         /* find primary and cursor planes for drm_crtc_init_with_planes 
> > >>> */ 
> > >>>         for (i = 0; scrtc->layers[i]; i++) { 
> > >>> -               struct sun4i_layer *layer = scrtc->layers[i]; 
> > >>> +               void *layer = scrtc->layers[i]; 
> > >>> +               struct drm_plane *plane = 
> > >>> scrtc->layer_ops->get_plane(layer); 
> > >>> 
> > >>> -               switch (layer->plane.type) { 
> > >>> +               switch (plane->type) { 
> > >>>                 case DRM_PLANE_TYPE_PRIMARY: 
> > >>> -                       primary = &layer->plane; 
> > >>> +                       primary = plane; 
> > >>>                         break; 
> > >>>                 case DRM_PLANE_TYPE_CURSOR: 
> > >>> -                       cursor = &layer->plane; 
> > >>> +                       cursor = plane; 
> > >>>                         break; 
> > >>>                 default: 
> > >>>                         break; 
> > >>> @@ -190,10 +192,11 @@ struct sun4i_crtc *sun4i_crtc_init(struct 
> > >>> drm_device *drm, 
> > >>>         /* Set possible_crtcs to this crtc for overlay planes */ 
> > >>>         for (i = 0; scrtc->layers[i]; i++) { 
> > >>>                 uint32_t possible_crtcs = 
> > >>> BIT(drm_crtc_index(&scrtc->crtc)); 
> > >>> -               struct sun4i_layer *layer = scrtc->layers[i]; 
> > >>> +               void *layer = scrtc->layers[i]; 
> > >>> +               struct drm_plane *plane = 
> > >>> scrtc->layer_ops->get_plane(layer); 
> > >>> 
> > >>> -               if (layer->plane.type == DRM_PLANE_TYPE_OVERLAY) 
> > >>> -                       layer->plane.possible_crtcs = possible_crtcs; 
> > >>> +               if (plane->type == DRM_PLANE_TYPE_OVERLAY) 
> > >>> +                       plane->possible_crtcs = possible_crtcs; 
> > >>>         } 
> > >>> 
> > >>>         return scrtc; 
> > >>> diff --git a/drivers/gpu/drm/sun4i/sun4i_crtc.h 
> > >>> b/drivers/gpu/drm/sun4i/sun4i_crtc.h 
> > >>> index 230cb8f0d601..a4036ee44cf8 100644 
> > >>> --- a/drivers/gpu/drm/sun4i/sun4i_crtc.h 
> > >>> +++ b/drivers/gpu/drm/sun4i/sun4i_crtc.h 
> > >>> @@ -19,7 +19,8 @@ struct sun4i_crtc { 
> > >>> 
> > >>>         struct sun4i_backend            *backend; 
> > >>>         struct sun4i_tcon               *tcon; 
> > >>> -       struct sun4i_layer              **layers; 
> > >>> +       void                            **layers; 
> > >>> +       const struct sunxi_layer_ops    *layer_ops; 
> > >> 
> > >> 
> > >> I think you should probably take a different approach to abstract the 
> > >> layer 
> > >> type. How about creating 
> > >> 
> > >> struct sunxi_layer { 
> > >>         struct drm_plane plane; 
> > >> } 
> > >> 
> > >> base and then subclassing that for sun4i and sun8i? By doing this you can 
> > >> avoid 
> > >> the nasty casting and you can also get rid of the get_plane() hook and 
> > >> layer_ops. 
> > > 
> > > 
> > > For the situation that using ** things are easily to get weird. 
> >
> > That code could be reworked, by initializing the layers directly within 
> > the crtc init code. If you look at rockchip's drm driver, you'll see 
> > they do this. There is a good reason to do it this way, as you need 
> > to first create the primary and cursor layers, pass them in when you 
> > create the crtc, then initialize any additional layers with the 
> > possible_crtcs bitmap. 
> 
> But furthurly maybe more layers will be created for DE2 mixer, and
> may even depends on mixer type (On A83T/H3/A64/H5 mixer1 has fewer
> channel than mixer0).

You'll always have one primary and one cursor plane, no matter how
much planes you support.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

-- 
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [linux-sunxi] Re: [PATCH v3 04/11] drm/sun4i: abstract the layer type
@ 2017-04-05  8:09   ` Maxime Ripard
  0 siblings, 0 replies; 9+ messages in thread
From: Maxime Ripard @ 2017-04-05  8:09 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Apr 05, 2017 at 01:23:15PM +0800, Icenowy Zheng wrote:
> 
> 2017?4?5? 10:27? Chen-Yu Tsai <wens@csie.org>???
> >
> > On Wed, Apr 5, 2017 at 3:53 AM, Icenowy Zheng <icenowy@aosc.io> wrote: 
> > > 
> > > 
> > > ? 2017?04?05? 03:28, Sean Paul ??: 
> > >> 
> > >> On Thu, Mar 30, 2017 at 03:46:06AM +0800, Icenowy Zheng wrote: 
> > >>> 
> > >>> As we are going to add support for the Allwinner DE2 Mixer in sun4i-drm 
> > >>> driver, we will finally have two types of layer. 
> > >>> 
> > >>> Abstract the layer type to void * and a ops struct, which contains the 
> > >>> only function used by crtc -- get the drm_plane struct of the layer. 
> > >>> 
> > >>> Signed-off-by: Icenowy Zheng <icenowy@aosc.io> 
> > >>> --- 
> > >>> Refactored patch in v3. 
> > >>> 
> > >>>? drivers/gpu/drm/sun4i/sun4i_crtc.c? | 19 +++++++++++-------- 
> > >>>? drivers/gpu/drm/sun4i/sun4i_crtc.h? |? 3 ++- 
> > >>>? drivers/gpu/drm/sun4i/sun4i_layer.c | 19 ++++++++++++++++++- 
> > >>>? drivers/gpu/drm/sun4i/sun4i_layer.h |? 2 +- 
> > >>>? drivers/gpu/drm/sun4i/sunxi_layer.h | 17 +++++++++++++++++ 
> > >>>? 5 files changed, 49 insertions(+), 11 deletions(-) 
> > >>>? create mode 100644 drivers/gpu/drm/sun4i/sunxi_layer.h 
> > >>> 
> > >>> diff --git a/drivers/gpu/drm/sun4i/sun4i_crtc.c 
> > >>> b/drivers/gpu/drm/sun4i/sun4i_crtc.c 
> > >>> index 3c876c3a356a..33854ee7f636 100644 
> > >>> --- a/drivers/gpu/drm/sun4i/sun4i_crtc.c 
> > >>> +++ b/drivers/gpu/drm/sun4i/sun4i_crtc.c 
> > >>> @@ -29,6 +29,7 @@ 
> > >>>? #include "sun4i_crtc.h" 
> > >>>? #include "sun4i_drv.h" 
> > >>>? #include "sun4i_layer.h" 
> > >>> +#include "sunxi_layer.h" 
> > >>>? #include "sun4i_tcon.h" 
> > >>> 
> > >>>? static void sun4i_crtc_atomic_begin(struct drm_crtc *crtc, 
> > >>> @@ -149,7 +150,7 @@ struct sun4i_crtc *sun4i_crtc_init(struct drm_device 
> > >>> *drm, 
> > >>>???????? scrtc->tcon = tcon; 
> > >>> 
> > >>>???????? /* Create our layers */ 
> > >>> -?????? scrtc->layers = sun4i_layers_init(drm, scrtc->backend); 
> > >>> +?????? scrtc->layers = (void **)sun4i_layers_init(drm, scrtc); 
> > >>>???????? if (IS_ERR(scrtc->layers)) { 
> > >>>???????????????? dev_err(drm->dev, "Couldn't create the planes\n"); 
> > >>>???????????????? return NULL; 
> > >>> @@ -157,14 +158,15 @@ struct sun4i_crtc *sun4i_crtc_init(struct 
> > >>> drm_device *drm, 
> > >>> 
> > >>>???????? /* find primary and cursor planes for drm_crtc_init_with_planes 
> > >>> */ 
> > >>>???????? for (i = 0; scrtc->layers[i]; i++) { 
> > >>> -?????????????? struct sun4i_layer *layer = scrtc->layers[i]; 
> > >>> +?????????????? void *layer = scrtc->layers[i]; 
> > >>> +?????????????? struct drm_plane *plane = 
> > >>> scrtc->layer_ops->get_plane(layer); 
> > >>> 
> > >>> -?????????????? switch (layer->plane.type) { 
> > >>> +?????????????? switch (plane->type) { 
> > >>>???????????????? case DRM_PLANE_TYPE_PRIMARY: 
> > >>> -?????????????????????? primary = &layer->plane; 
> > >>> +?????????????????????? primary = plane; 
> > >>>???????????????????????? break; 
> > >>>???????????????? case DRM_PLANE_TYPE_CURSOR: 
> > >>> -?????????????????????? cursor = &layer->plane; 
> > >>> +?????????????????????? cursor = plane; 
> > >>>???????????????????????? break; 
> > >>>???????????????? default: 
> > >>>???????????????????????? break; 
> > >>> @@ -190,10 +192,11 @@ struct sun4i_crtc *sun4i_crtc_init(struct 
> > >>> drm_device *drm, 
> > >>>???????? /* Set possible_crtcs to this crtc for overlay planes */ 
> > >>>???????? for (i = 0; scrtc->layers[i]; i++) { 
> > >>>???????????????? uint32_t possible_crtcs = 
> > >>> BIT(drm_crtc_index(&scrtc->crtc)); 
> > >>> -?????????????? struct sun4i_layer *layer = scrtc->layers[i]; 
> > >>> +?????????????? void *layer = scrtc->layers[i]; 
> > >>> +?????????????? struct drm_plane *plane = 
> > >>> scrtc->layer_ops->get_plane(layer); 
> > >>> 
> > >>> -?????????????? if (layer->plane.type == DRM_PLANE_TYPE_OVERLAY) 
> > >>> -?????????????????????? layer->plane.possible_crtcs = possible_crtcs; 
> > >>> +?????????????? if (plane->type == DRM_PLANE_TYPE_OVERLAY) 
> > >>> +?????????????????????? plane->possible_crtcs = possible_crtcs; 
> > >>>???????? } 
> > >>> 
> > >>>???????? return scrtc; 
> > >>> diff --git a/drivers/gpu/drm/sun4i/sun4i_crtc.h 
> > >>> b/drivers/gpu/drm/sun4i/sun4i_crtc.h 
> > >>> index 230cb8f0d601..a4036ee44cf8 100644 
> > >>> --- a/drivers/gpu/drm/sun4i/sun4i_crtc.h 
> > >>> +++ b/drivers/gpu/drm/sun4i/sun4i_crtc.h 
> > >>> @@ -19,7 +19,8 @@ struct sun4i_crtc { 
> > >>> 
> > >>>???????? struct sun4i_backend??????????? *backend; 
> > >>>???????? struct sun4i_tcon?????????????? *tcon; 
> > >>> -?????? struct sun4i_layer????????????? **layers; 
> > >>> +?????? void??????????????????????????? **layers; 
> > >>> +?????? const struct sunxi_layer_ops??? *layer_ops; 
> > >> 
> > >> 
> > >> I think you should probably take a different approach to abstract the 
> > >> layer 
> > >> type. How about creating 
> > >> 
> > >> struct sunxi_layer { 
> > >>???????? struct drm_plane plane; 
> > >> } 
> > >> 
> > >> base and then subclassing that for sun4i and sun8i? By doing this you can 
> > >> avoid 
> > >> the nasty casting and you can also get rid of the get_plane() hook and 
> > >> layer_ops. 
> > > 
> > > 
> > > For the situation that using ** things are easily to get weird. 
> >
> > That code could be reworked, by initializing the layers directly within 
> > the crtc init code. If you look at rockchip's drm driver, you'll see 
> > they do this. There is a good reason to do it this way, as you need 
> > to first create the primary and cursor layers, pass them in when you 
> > create the crtc, then initialize any additional layers with the 
> > possible_crtcs bitmap. 
> 
> But furthurly maybe more layers will be created for DE2 mixer, and
> may even depends on mixer type (On A83T/H3/A64/H5 mixer1 has fewer
> channel than mixer0).

You'll always have one primary and one cursor plane, no matter how
much planes you support.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170405/bd177b26/attachment.sig>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [linux-sunxi] Re: [PATCH v3 04/11] drm/sun4i: abstract the layer type
  2017-04-05  2:27         ` Chen-Yu Tsai
  (?)
@ 2017-04-05 17:14           ` icenowy
  -1 siblings, 0 replies; 9+ messages in thread
From: icenowy @ 2017-04-05 17:14 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: devicetree, Jernej Skrabec, linux-sunxi, linux-kernel, dri-devel,
	Rob Herring, Sean Paul, Maxime Ripard, linux-clk,
	linux-arm-kernel

在 2017-04-05 10:27,Chen-Yu Tsai 写道:
> On Wed, Apr 5, 2017 at 3:53 AM, Icenowy Zheng <icenowy@aosc.io> wrote:
>> 
>> 
>> 在 2017年04月05日 03:28, Sean Paul 写道:
>>> 
>>> On Thu, Mar 30, 2017 at 03:46:06AM +0800, Icenowy Zheng wrote:
>>>> 
>>>> As we are going to add support for the Allwinner DE2 Mixer in 
>>>> sun4i-drm
>>>> driver, we will finally have two types of layer.
>>>> 
>>>> Abstract the layer type to void * and a ops struct, which contains 
>>>> the
>>>> only function used by crtc -- get the drm_plane struct of the layer.
>>>> 
>>>> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
>>>> ---
>>>> Refactored patch in v3.
>>>> 
>>>>  drivers/gpu/drm/sun4i/sun4i_crtc.c  | 19 +++++++++++--------
>>>>  drivers/gpu/drm/sun4i/sun4i_crtc.h  |  3 ++-
>>>>  drivers/gpu/drm/sun4i/sun4i_layer.c | 19 ++++++++++++++++++-
>>>>  drivers/gpu/drm/sun4i/sun4i_layer.h |  2 +-
>>>>  drivers/gpu/drm/sun4i/sunxi_layer.h | 17 +++++++++++++++++
>>>>  5 files changed, 49 insertions(+), 11 deletions(-)
>>>>  create mode 100644 drivers/gpu/drm/sun4i/sunxi_layer.h
>>>> 
>>>> diff --git a/drivers/gpu/drm/sun4i/sun4i_crtc.c
>>>> b/drivers/gpu/drm/sun4i/sun4i_crtc.c
>>>> index 3c876c3a356a..33854ee7f636 100644
>>>> --- a/drivers/gpu/drm/sun4i/sun4i_crtc.c
>>>> +++ b/drivers/gpu/drm/sun4i/sun4i_crtc.c
>>>> @@ -29,6 +29,7 @@
>>>>  #include "sun4i_crtc.h"
>>>>  #include "sun4i_drv.h"
>>>>  #include "sun4i_layer.h"
>>>> +#include "sunxi_layer.h"
>>>>  #include "sun4i_tcon.h"
>>>> 
>>>>  static void sun4i_crtc_atomic_begin(struct drm_crtc *crtc,
>>>> @@ -149,7 +150,7 @@ struct sun4i_crtc *sun4i_crtc_init(struct 
>>>> drm_device
>>>> *drm,
>>>>         scrtc->tcon = tcon;
>>>> 
>>>>         /* Create our layers */
>>>> -       scrtc->layers = sun4i_layers_init(drm, scrtc->backend);
>>>> +       scrtc->layers = (void **)sun4i_layers_init(drm, scrtc);
>>>>         if (IS_ERR(scrtc->layers)) {
>>>>                 dev_err(drm->dev, "Couldn't create the planes\n");
>>>>                 return NULL;
>>>> @@ -157,14 +158,15 @@ struct sun4i_crtc *sun4i_crtc_init(struct
>>>> drm_device *drm,
>>>> 
>>>>         /* find primary and cursor planes for 
>>>> drm_crtc_init_with_planes
>>>> */
>>>>         for (i = 0; scrtc->layers[i]; i++) {
>>>> -               struct sun4i_layer *layer = scrtc->layers[i];
>>>> +               void *layer = scrtc->layers[i];
>>>> +               struct drm_plane *plane =
>>>> scrtc->layer_ops->get_plane(layer);
>>>> 
>>>> -               switch (layer->plane.type) {
>>>> +               switch (plane->type) {
>>>>                 case DRM_PLANE_TYPE_PRIMARY:
>>>> -                       primary = &layer->plane;
>>>> +                       primary = plane;
>>>>                         break;
>>>>                 case DRM_PLANE_TYPE_CURSOR:
>>>> -                       cursor = &layer->plane;
>>>> +                       cursor = plane;
>>>>                         break;
>>>>                 default:
>>>>                         break;
>>>> @@ -190,10 +192,11 @@ struct sun4i_crtc *sun4i_crtc_init(struct
>>>> drm_device *drm,
>>>>         /* Set possible_crtcs to this crtc for overlay planes */
>>>>         for (i = 0; scrtc->layers[i]; i++) {
>>>>                 uint32_t possible_crtcs =
>>>> BIT(drm_crtc_index(&scrtc->crtc));
>>>> -               struct sun4i_layer *layer = scrtc->layers[i];
>>>> +               void *layer = scrtc->layers[i];
>>>> +               struct drm_plane *plane =
>>>> scrtc->layer_ops->get_plane(layer);
>>>> 
>>>> -               if (layer->plane.type == DRM_PLANE_TYPE_OVERLAY)
>>>> -                       layer->plane.possible_crtcs = 
>>>> possible_crtcs;
>>>> +               if (plane->type == DRM_PLANE_TYPE_OVERLAY)
>>>> +                       plane->possible_crtcs = possible_crtcs;
>>>>         }
>>>> 
>>>>         return scrtc;
>>>> diff --git a/drivers/gpu/drm/sun4i/sun4i_crtc.h
>>>> b/drivers/gpu/drm/sun4i/sun4i_crtc.h
>>>> index 230cb8f0d601..a4036ee44cf8 100644
>>>> --- a/drivers/gpu/drm/sun4i/sun4i_crtc.h
>>>> +++ b/drivers/gpu/drm/sun4i/sun4i_crtc.h
>>>> @@ -19,7 +19,8 @@ struct sun4i_crtc {
>>>> 
>>>>         struct sun4i_backend            *backend;
>>>>         struct sun4i_tcon               *tcon;
>>>> -       struct sun4i_layer              **layers;
>>>> +       void                            **layers;
>>>> +       const struct sunxi_layer_ops    *layer_ops;
>>> 
>>> 
>>> I think you should probably take a different approach to abstract the
>>> layer
>>> type. How about creating
>>> 
>>> struct sunxi_layer {
>>>         struct drm_plane plane;
>>> }
>>> 
>>> base and then subclassing that for sun4i and sun8i? By doing this you 
>>> can
>>> avoid
>>> the nasty casting and you can also get rid of the get_plane() hook 
>>> and
>>> layer_ops.
>> 
>> 
>> For the situation that using ** things are easily to get weird.
> 
> That code could be reworked, by initializing the layers directly within
> the crtc init code. If you look at rockchip's drm driver, you'll see
> they do this. There is a good reason to do it this way, as you need
> to first create the primary and cursor layers, pass them in when you
> create the crtc, then initialize any additional layers with the
> possible_crtcs bitmap.

I feel that it's still more proper to offload plane creation code
to *_layers_init function, as:

1. We cannot assume the cursor layer's
existance. In fact currently no code in sun4i-drm (including this
patchset) create a cursor layer.

2. The format of planes heavily depend on the engine type (
sun4i-backend or sun8i-mixer).

3. We should create planes according to the type of engine.
Currently the *_layers_init function is part of engine code (See my
Makefile change).

4. If we do so we will have two codes for plane creating -- one for
primary in sun4i_crtc_init, another for overlays in *_layers_init.

> 
> In our driver we are currently initializing all layers, then going
> back and filling in possible_crtcs for the extra layers.
> 
> And as Maxime and I mentioned in the other thread, we don't really
> need to keep a reference to **layers.

It's correct, layers doesn't need to be kept.

And the struct sunxi_layer refactor also makes sense.

> 
> Regards
> ChenYu
> 
>> 
>>> 
>>> Sean
>>> 
>>> 
>>> 
>>>>  };
>>>> 
>>>>  static inline struct sun4i_crtc *drm_crtc_to_sun4i_crtc(struct 
>>>> drm_crtc
>>>> *crtc)
>>>> diff --git a/drivers/gpu/drm/sun4i/sun4i_layer.c
>>>> b/drivers/gpu/drm/sun4i/sun4i_layer.c
>>>> index f26bde5b9117..bc4a70d6968b 100644
>>>> --- a/drivers/gpu/drm/sun4i/sun4i_layer.c
>>>> +++ b/drivers/gpu/drm/sun4i/sun4i_layer.c
>>>> @@ -16,7 +16,9 @@
>>>>  #include <drm/drmP.h>
>>>> 
>>>>  #include "sun4i_backend.h"
>>>> +#include "sun4i_crtc.h"
>>>>  #include "sun4i_layer.h"
>>>> +#include "sunxi_layer.h"
>>>> 
>>>>  struct sun4i_plane_desc {
>>>>                enum drm_plane_type     type;
>>>> @@ -100,6 +102,17 @@ static const struct sun4i_plane_desc
>>>> sun4i_backend_planes[] = {
>>>>         },
>>>>  };
>>>> 
>>>> +static struct drm_plane *sun4i_layer_get_plane(void *layer)
>>>> +{
>>>> +       struct sun4i_layer *sun4i_layer = layer;
>>>> +
>>>> +       return &sun4i_layer->plane;
>>>> +}
>>>> +
>>>> +static const struct sunxi_layer_ops layer_ops = {
>>>> +       .get_plane = sun4i_layer_get_plane,
>>>> +};
>>>> +
>>>>  static struct sun4i_layer *sun4i_layer_init_one(struct drm_device 
>>>> *drm,
>>>>                                                 struct sun4i_backend
>>>> *backend,
>>>>                                                 const struct
>>>> sun4i_plane_desc *plane)
>>>> @@ -129,9 +142,10 @@ static struct sun4i_layer
>>>> *sun4i_layer_init_one(struct drm_device *drm,
>>>>  }
>>>> 
>>>>  struct sun4i_layer **sun4i_layers_init(struct drm_device *drm,
>>>> -                                      struct sun4i_backend 
>>>> *backend)
>>>> +                                      struct sun4i_crtc *crtc)
>>>>  {
>>>>         struct sun4i_layer **layers;
>>>> +       struct sun4i_backend *backend = crtc->backend;
>>>>         int i;
>>>> 
>>>>         layers = devm_kcalloc(drm->dev, 
>>>> ARRAY_SIZE(sun4i_backend_planes)
>>>> + 1,
>>>> @@ -181,5 +195,8 @@ struct sun4i_layer **sun4i_layers_init(struct
>>>> drm_device *drm,
>>>>                 layers[i] = layer;
>>>>         };
>>>> 
>>>> +       /* Assign layer ops to the CRTC */
>>>> +       crtc->layer_ops = &layer_ops;
>>>> +
>>>>         return layers;
>>>>  }
>>>> diff --git a/drivers/gpu/drm/sun4i/sun4i_layer.h
>>>> b/drivers/gpu/drm/sun4i/sun4i_layer.h
>>>> index 4be1f0919df2..425eea7b9e3b 100644
>>>> --- a/drivers/gpu/drm/sun4i/sun4i_layer.h
>>>> +++ b/drivers/gpu/drm/sun4i/sun4i_layer.h
>>>> @@ -27,6 +27,6 @@ plane_to_sun4i_layer(struct drm_plane *plane)
>>>>  }
>>>> 
>>>>  struct sun4i_layer **sun4i_layers_init(struct drm_device *drm,
>>>> -                                      struct sun4i_backend 
>>>> *backend);
>>>> +                                      struct sun4i_crtc *crtc);
>>>> 
>>>>  #endif /* _SUN4I_LAYER_H_ */
>>>> diff --git a/drivers/gpu/drm/sun4i/sunxi_layer.h
>>>> b/drivers/gpu/drm/sun4i/sunxi_layer.h
>>>> new file mode 100644
>>>> index 000000000000..d8838ec39299
>>>> --- /dev/null
>>>> +++ b/drivers/gpu/drm/sun4i/sunxi_layer.h
>>>> @@ -0,0 +1,17 @@
>>>> +/*
>>>> + * Copyright (C) 2017 Icenowy Zheng <icenowy@aosc.xyz>
>>>> + *
>>>> + * This program is free software; you can redistribute it and/or
>>>> + * modify it under the terms of the GNU General Public License as
>>>> + * published by the Free Software Foundation; either version 2 of
>>>> + * the License, or (at your option) any later version.
>>>> + */
>>>> +
>>>> +#ifndef _SUNXI_LAYER_H_
>>>> +#define _SUNXI_LAYER_H_
>>>> +
>>>> +struct sunxi_layer_ops {
>>>> +       struct drm_plane *(*get_plane)(void *layer);
>>>> +};
>>>> +
>>>> +#endif /* _SUNXI_LAYER_H_ */
>>>> --
>>>> 2.12.0
>>>> 
>>>> 
>>>> _______________________________________________
>>>> linux-arm-kernel mailing list
>>>> linux-arm-kernel@lists.infradead.org
>>>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>>> 
>>> 
>> 
>> --
>> You received this message because you are subscribed to the Google 
>> Groups
>> "linux-sunxi" group.
>> To unsubscribe from this group and stop receiving emails from it, send 
>> an
>> email to linux-sunxi+unsubscribe@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [linux-sunxi] Re: [PATCH v3 04/11] drm/sun4i: abstract the layer type
@ 2017-04-05 17:14           ` icenowy
  0 siblings, 0 replies; 9+ messages in thread
From: icenowy @ 2017-04-05 17:14 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: devicetree, Jernej Skrabec, linux-kernel, dri-devel, linux-sunxi,
	Rob Herring, Sean Paul, Maxime Ripard, linux-clk,
	linux-arm-kernel

5ZyoIDIwMTctMDQtMDUgMTA6MjfvvIxDaGVuLVl1IFRzYWkg5YaZ6YGT77yaCj4gT24gV2VkLCBB
cHIgNSwgMjAxNyBhdCAzOjUzIEFNLCBJY2Vub3d5IFpoZW5nIDxpY2Vub3d5QGFvc2MuaW8+IHdy
b3RlOgo+PiAKPj4gCj4+IOWcqCAyMDE35bm0MDTmnIgwNeaXpSAwMzoyOCwgU2VhbiBQYXVsIOWG
memBkzoKPj4+IAo+Pj4gT24gVGh1LCBNYXIgMzAsIDIwMTcgYXQgMDM6NDY6MDZBTSArMDgwMCwg
SWNlbm93eSBaaGVuZyB3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xpbmcgbGlzdAo+IGxpbnV4LWFy
bS1rZXJuZWxAbGlzdHMuaW5mcmFkZWFkLm9yZwo+IGh0dHA6Ly9saXN0cy5pbmZyYWRlYWQub3Jn
L21haWxtYW4vbGlzdGluZm8vbGludXgtYXJtLWtlcm5lbAoKX19fX19fX19fX19fX19fX19fX19f
X19fX19fX19fX19fX19fX19fX19fX19fX18KbGludXgtYXJtLWtlcm5lbCBtYWlsaW5nIGxpc3QK
bGludXgtYXJtLWtlcm5lbEBsaXN0cy5pbmZyYWRlYWQub3JnCmh0dHA6Ly9saXN0cy5pbmZyYWRl
YWQub3JnL21haWxtYW4vbGlzdGluZm8vbGludXgtYXJtLWtlcm5lbAo=

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [linux-sunxi] Re: [PATCH v3 04/11] drm/sun4i: abstract the layer type
@ 2017-04-05 17:14           ` icenowy
  0 siblings, 0 replies; 9+ messages in thread
From: icenowy at aosc.io @ 2017-04-05 17:14 UTC (permalink / raw)
  To: linux-arm-kernel

? 2017-04-05 10:27?Chen-Yu Tsai ???
> On Wed, Apr 5, 2017 at 3:53 AM, Icenowy Zheng <icenowy@aosc.io> wrote:
>> 
>> 
>> ? 2017?04?05? 03:28, Sean Paul ??:
>>> 
>>> On Thu, Mar 30, 2017 at 03:46:06AM +0800, Icenowy Zheng wrote:
>>>> 
>>>> As we are going to add support for the Allwinner DE2 Mixer in 
>>>> sun4i-drm
>>>> driver, we will finally have two types of layer.
>>>> 
>>>> Abstract the layer type to void * and a ops struct, which contains 
>>>> the
>>>> only function used by crtc -- get the drm_plane struct of the layer.
>>>> 
>>>> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
>>>> ---
>>>> Refactored patch in v3.
>>>> 
>>>>  drivers/gpu/drm/sun4i/sun4i_crtc.c  | 19 +++++++++++--------
>>>>  drivers/gpu/drm/sun4i/sun4i_crtc.h  |  3 ++-
>>>>  drivers/gpu/drm/sun4i/sun4i_layer.c | 19 ++++++++++++++++++-
>>>>  drivers/gpu/drm/sun4i/sun4i_layer.h |  2 +-
>>>>  drivers/gpu/drm/sun4i/sunxi_layer.h | 17 +++++++++++++++++
>>>>  5 files changed, 49 insertions(+), 11 deletions(-)
>>>>  create mode 100644 drivers/gpu/drm/sun4i/sunxi_layer.h
>>>> 
>>>> diff --git a/drivers/gpu/drm/sun4i/sun4i_crtc.c
>>>> b/drivers/gpu/drm/sun4i/sun4i_crtc.c
>>>> index 3c876c3a356a..33854ee7f636 100644
>>>> --- a/drivers/gpu/drm/sun4i/sun4i_crtc.c
>>>> +++ b/drivers/gpu/drm/sun4i/sun4i_crtc.c
>>>> @@ -29,6 +29,7 @@
>>>>  #include "sun4i_crtc.h"
>>>>  #include "sun4i_drv.h"
>>>>  #include "sun4i_layer.h"
>>>> +#include "sunxi_layer.h"
>>>>  #include "sun4i_tcon.h"
>>>> 
>>>>  static void sun4i_crtc_atomic_begin(struct drm_crtc *crtc,
>>>> @@ -149,7 +150,7 @@ struct sun4i_crtc *sun4i_crtc_init(struct 
>>>> drm_device
>>>> *drm,
>>>>         scrtc->tcon = tcon;
>>>> 
>>>>         /* Create our layers */
>>>> -       scrtc->layers = sun4i_layers_init(drm, scrtc->backend);
>>>> +       scrtc->layers = (void **)sun4i_layers_init(drm, scrtc);
>>>>         if (IS_ERR(scrtc->layers)) {
>>>>                 dev_err(drm->dev, "Couldn't create the planes\n");
>>>>                 return NULL;
>>>> @@ -157,14 +158,15 @@ struct sun4i_crtc *sun4i_crtc_init(struct
>>>> drm_device *drm,
>>>> 
>>>>         /* find primary and cursor planes for 
>>>> drm_crtc_init_with_planes
>>>> */
>>>>         for (i = 0; scrtc->layers[i]; i++) {
>>>> -               struct sun4i_layer *layer = scrtc->layers[i];
>>>> +               void *layer = scrtc->layers[i];
>>>> +               struct drm_plane *plane =
>>>> scrtc->layer_ops->get_plane(layer);
>>>> 
>>>> -               switch (layer->plane.type) {
>>>> +               switch (plane->type) {
>>>>                 case DRM_PLANE_TYPE_PRIMARY:
>>>> -                       primary = &layer->plane;
>>>> +                       primary = plane;
>>>>                         break;
>>>>                 case DRM_PLANE_TYPE_CURSOR:
>>>> -                       cursor = &layer->plane;
>>>> +                       cursor = plane;
>>>>                         break;
>>>>                 default:
>>>>                         break;
>>>> @@ -190,10 +192,11 @@ struct sun4i_crtc *sun4i_crtc_init(struct
>>>> drm_device *drm,
>>>>         /* Set possible_crtcs to this crtc for overlay planes */
>>>>         for (i = 0; scrtc->layers[i]; i++) {
>>>>                 uint32_t possible_crtcs =
>>>> BIT(drm_crtc_index(&scrtc->crtc));
>>>> -               struct sun4i_layer *layer = scrtc->layers[i];
>>>> +               void *layer = scrtc->layers[i];
>>>> +               struct drm_plane *plane =
>>>> scrtc->layer_ops->get_plane(layer);
>>>> 
>>>> -               if (layer->plane.type == DRM_PLANE_TYPE_OVERLAY)
>>>> -                       layer->plane.possible_crtcs = 
>>>> possible_crtcs;
>>>> +               if (plane->type == DRM_PLANE_TYPE_OVERLAY)
>>>> +                       plane->possible_crtcs = possible_crtcs;
>>>>         }
>>>> 
>>>>         return scrtc;
>>>> diff --git a/drivers/gpu/drm/sun4i/sun4i_crtc.h
>>>> b/drivers/gpu/drm/sun4i/sun4i_crtc.h
>>>> index 230cb8f0d601..a4036ee44cf8 100644
>>>> --- a/drivers/gpu/drm/sun4i/sun4i_crtc.h
>>>> +++ b/drivers/gpu/drm/sun4i/sun4i_crtc.h
>>>> @@ -19,7 +19,8 @@ struct sun4i_crtc {
>>>> 
>>>>         struct sun4i_backend            *backend;
>>>>         struct sun4i_tcon               *tcon;
>>>> -       struct sun4i_layer              **layers;
>>>> +       void                            **layers;
>>>> +       const struct sunxi_layer_ops    *layer_ops;
>>> 
>>> 
>>> I think you should probably take a different approach to abstract the
>>> layer
>>> type. How about creating
>>> 
>>> struct sunxi_layer {
>>>         struct drm_plane plane;
>>> }
>>> 
>>> base and then subclassing that for sun4i and sun8i? By doing this you 
>>> can
>>> avoid
>>> the nasty casting and you can also get rid of the get_plane() hook 
>>> and
>>> layer_ops.
>> 
>> 
>> For the situation that using ** things are easily to get weird.
> 
> That code could be reworked, by initializing the layers directly within
> the crtc init code. If you look at rockchip's drm driver, you'll see
> they do this. There is a good reason to do it this way, as you need
> to first create the primary and cursor layers, pass them in when you
> create the crtc, then initialize any additional layers with the
> possible_crtcs bitmap.

I feel that it's still more proper to offload plane creation code
to *_layers_init function, as:

1. We cannot assume the cursor layer's
existance. In fact currently no code in sun4i-drm (including this
patchset) create a cursor layer.

2. The format of planes heavily depend on the engine type (
sun4i-backend or sun8i-mixer).

3. We should create planes according to the type of engine.
Currently the *_layers_init function is part of engine code (See my
Makefile change).

4. If we do so we will have two codes for plane creating -- one for
primary in sun4i_crtc_init, another for overlays in *_layers_init.

> 
> In our driver we are currently initializing all layers, then going
> back and filling in possible_crtcs for the extra layers.
> 
> And as Maxime and I mentioned in the other thread, we don't really
> need to keep a reference to **layers.

It's correct, layers doesn't need to be kept.

And the struct sunxi_layer refactor also makes sense.

> 
> Regards
> ChenYu
> 
>> 
>>> 
>>> Sean
>>> 
>>> 
>>> 
>>>>  };
>>>> 
>>>>  static inline struct sun4i_crtc *drm_crtc_to_sun4i_crtc(struct 
>>>> drm_crtc
>>>> *crtc)
>>>> diff --git a/drivers/gpu/drm/sun4i/sun4i_layer.c
>>>> b/drivers/gpu/drm/sun4i/sun4i_layer.c
>>>> index f26bde5b9117..bc4a70d6968b 100644
>>>> --- a/drivers/gpu/drm/sun4i/sun4i_layer.c
>>>> +++ b/drivers/gpu/drm/sun4i/sun4i_layer.c
>>>> @@ -16,7 +16,9 @@
>>>>  #include <drm/drmP.h>
>>>> 
>>>>  #include "sun4i_backend.h"
>>>> +#include "sun4i_crtc.h"
>>>>  #include "sun4i_layer.h"
>>>> +#include "sunxi_layer.h"
>>>> 
>>>>  struct sun4i_plane_desc {
>>>>                enum drm_plane_type     type;
>>>> @@ -100,6 +102,17 @@ static const struct sun4i_plane_desc
>>>> sun4i_backend_planes[] = {
>>>>         },
>>>>  };
>>>> 
>>>> +static struct drm_plane *sun4i_layer_get_plane(void *layer)
>>>> +{
>>>> +       struct sun4i_layer *sun4i_layer = layer;
>>>> +
>>>> +       return &sun4i_layer->plane;
>>>> +}
>>>> +
>>>> +static const struct sunxi_layer_ops layer_ops = {
>>>> +       .get_plane = sun4i_layer_get_plane,
>>>> +};
>>>> +
>>>>  static struct sun4i_layer *sun4i_layer_init_one(struct drm_device 
>>>> *drm,
>>>>                                                 struct sun4i_backend
>>>> *backend,
>>>>                                                 const struct
>>>> sun4i_plane_desc *plane)
>>>> @@ -129,9 +142,10 @@ static struct sun4i_layer
>>>> *sun4i_layer_init_one(struct drm_device *drm,
>>>>  }
>>>> 
>>>>  struct sun4i_layer **sun4i_layers_init(struct drm_device *drm,
>>>> -                                      struct sun4i_backend 
>>>> *backend)
>>>> +                                      struct sun4i_crtc *crtc)
>>>>  {
>>>>         struct sun4i_layer **layers;
>>>> +       struct sun4i_backend *backend = crtc->backend;
>>>>         int i;
>>>> 
>>>>         layers = devm_kcalloc(drm->dev, 
>>>> ARRAY_SIZE(sun4i_backend_planes)
>>>> + 1,
>>>> @@ -181,5 +195,8 @@ struct sun4i_layer **sun4i_layers_init(struct
>>>> drm_device *drm,
>>>>                 layers[i] = layer;
>>>>         };
>>>> 
>>>> +       /* Assign layer ops to the CRTC */
>>>> +       crtc->layer_ops = &layer_ops;
>>>> +
>>>>         return layers;
>>>>  }
>>>> diff --git a/drivers/gpu/drm/sun4i/sun4i_layer.h
>>>> b/drivers/gpu/drm/sun4i/sun4i_layer.h
>>>> index 4be1f0919df2..425eea7b9e3b 100644
>>>> --- a/drivers/gpu/drm/sun4i/sun4i_layer.h
>>>> +++ b/drivers/gpu/drm/sun4i/sun4i_layer.h
>>>> @@ -27,6 +27,6 @@ plane_to_sun4i_layer(struct drm_plane *plane)
>>>>  }
>>>> 
>>>>  struct sun4i_layer **sun4i_layers_init(struct drm_device *drm,
>>>> -                                      struct sun4i_backend 
>>>> *backend);
>>>> +                                      struct sun4i_crtc *crtc);
>>>> 
>>>>  #endif /* _SUN4I_LAYER_H_ */
>>>> diff --git a/drivers/gpu/drm/sun4i/sunxi_layer.h
>>>> b/drivers/gpu/drm/sun4i/sunxi_layer.h
>>>> new file mode 100644
>>>> index 000000000000..d8838ec39299
>>>> --- /dev/null
>>>> +++ b/drivers/gpu/drm/sun4i/sunxi_layer.h
>>>> @@ -0,0 +1,17 @@
>>>> +/*
>>>> + * Copyright (C) 2017 Icenowy Zheng <icenowy@aosc.xyz>
>>>> + *
>>>> + * This program is free software; you can redistribute it and/or
>>>> + * modify it under the terms of the GNU General Public License as
>>>> + * published by the Free Software Foundation; either version 2 of
>>>> + * the License, or (at your option) any later version.
>>>> + */
>>>> +
>>>> +#ifndef _SUNXI_LAYER_H_
>>>> +#define _SUNXI_LAYER_H_
>>>> +
>>>> +struct sunxi_layer_ops {
>>>> +       struct drm_plane *(*get_plane)(void *layer);
>>>> +};
>>>> +
>>>> +#endif /* _SUNXI_LAYER_H_ */
>>>> --
>>>> 2.12.0
>>>> 
>>>> 
>>>> _______________________________________________
>>>> linux-arm-kernel mailing list
>>>> linux-arm-kernel at lists.infradead.org
>>>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>>> 
>>> 
>> 
>> --
>> You received this message because you are subscribed to the Google 
>> Groups
>> "linux-sunxi" group.
>> To unsubscribe from this group and stop receiving emails from it, send 
>> an
>> email to linux-sunxi+unsubscribe at googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [linux-sunxi] Re: [PATCH v3 04/11] drm/sun4i: abstract the layer type
  2017-04-04 19:53     ` Icenowy Zheng
@ 2017-04-05  2:27         ` Chen-Yu Tsai
  0 siblings, 0 replies; 9+ messages in thread
From: Chen-Yu Tsai @ 2017-04-05  2:27 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Sean Paul, Rob Herring, Maxime Ripard, Chen-Yu Tsai,
	Jernej Skrabec, devicetree, linux-kernel, dri-devel, linux-sunxi,
	linux-clk, linux-arm-kernel

On Wed, Apr 5, 2017 at 3:53 AM, Icenowy Zheng <icenowy@aosc.io> wrote:
>
>
> 在 2017年04月05日 03:28, Sean Paul 写道:
>>
>> On Thu, Mar 30, 2017 at 03:46:06AM +0800, Icenowy Zheng wrote:
>>>
>>> As we are going to add support for the Allwinner DE2 Mixer in sun4i-drm
>>> driver, we will finally have two types of layer.
>>>
>>> Abstract the layer type to void * and a ops struct, which contains the
>>> only function used by crtc -- get the drm_plane struct of the layer.
>>>
>>> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
>>> ---
>>> Refactored patch in v3.
>>>
>>>  drivers/gpu/drm/sun4i/sun4i_crtc.c  | 19 +++++++++++--------
>>>  drivers/gpu/drm/sun4i/sun4i_crtc.h  |  3 ++-
>>>  drivers/gpu/drm/sun4i/sun4i_layer.c | 19 ++++++++++++++++++-
>>>  drivers/gpu/drm/sun4i/sun4i_layer.h |  2 +-
>>>  drivers/gpu/drm/sun4i/sunxi_layer.h | 17 +++++++++++++++++
>>>  5 files changed, 49 insertions(+), 11 deletions(-)
>>>  create mode 100644 drivers/gpu/drm/sun4i/sunxi_layer.h
>>>
>>> diff --git a/drivers/gpu/drm/sun4i/sun4i_crtc.c
>>> b/drivers/gpu/drm/sun4i/sun4i_crtc.c
>>> index 3c876c3a356a..33854ee7f636 100644
>>> --- a/drivers/gpu/drm/sun4i/sun4i_crtc.c
>>> +++ b/drivers/gpu/drm/sun4i/sun4i_crtc.c
>>> @@ -29,6 +29,7 @@
>>>  #include "sun4i_crtc.h"
>>>  #include "sun4i_drv.h"
>>>  #include "sun4i_layer.h"
>>> +#include "sunxi_layer.h"
>>>  #include "sun4i_tcon.h"
>>>
>>>  static void sun4i_crtc_atomic_begin(struct drm_crtc *crtc,
>>> @@ -149,7 +150,7 @@ struct sun4i_crtc *sun4i_crtc_init(struct drm_device
>>> *drm,
>>>         scrtc->tcon = tcon;
>>>
>>>         /* Create our layers */
>>> -       scrtc->layers = sun4i_layers_init(drm, scrtc->backend);
>>> +       scrtc->layers = (void **)sun4i_layers_init(drm, scrtc);
>>>         if (IS_ERR(scrtc->layers)) {
>>>                 dev_err(drm->dev, "Couldn't create the planes\n");
>>>                 return NULL;
>>> @@ -157,14 +158,15 @@ struct sun4i_crtc *sun4i_crtc_init(struct
>>> drm_device *drm,
>>>
>>>         /* find primary and cursor planes for drm_crtc_init_with_planes
>>> */
>>>         for (i = 0; scrtc->layers[i]; i++) {
>>> -               struct sun4i_layer *layer = scrtc->layers[i];
>>> +               void *layer = scrtc->layers[i];
>>> +               struct drm_plane *plane =
>>> scrtc->layer_ops->get_plane(layer);
>>>
>>> -               switch (layer->plane.type) {
>>> +               switch (plane->type) {
>>>                 case DRM_PLANE_TYPE_PRIMARY:
>>> -                       primary = &layer->plane;
>>> +                       primary = plane;
>>>                         break;
>>>                 case DRM_PLANE_TYPE_CURSOR:
>>> -                       cursor = &layer->plane;
>>> +                       cursor = plane;
>>>                         break;
>>>                 default:
>>>                         break;
>>> @@ -190,10 +192,11 @@ struct sun4i_crtc *sun4i_crtc_init(struct
>>> drm_device *drm,
>>>         /* Set possible_crtcs to this crtc for overlay planes */
>>>         for (i = 0; scrtc->layers[i]; i++) {
>>>                 uint32_t possible_crtcs =
>>> BIT(drm_crtc_index(&scrtc->crtc));
>>> -               struct sun4i_layer *layer = scrtc->layers[i];
>>> +               void *layer = scrtc->layers[i];
>>> +               struct drm_plane *plane =
>>> scrtc->layer_ops->get_plane(layer);
>>>
>>> -               if (layer->plane.type == DRM_PLANE_TYPE_OVERLAY)
>>> -                       layer->plane.possible_crtcs = possible_crtcs;
>>> +               if (plane->type == DRM_PLANE_TYPE_OVERLAY)
>>> +                       plane->possible_crtcs = possible_crtcs;
>>>         }
>>>
>>>         return scrtc;
>>> diff --git a/drivers/gpu/drm/sun4i/sun4i_crtc.h
>>> b/drivers/gpu/drm/sun4i/sun4i_crtc.h
>>> index 230cb8f0d601..a4036ee44cf8 100644
>>> --- a/drivers/gpu/drm/sun4i/sun4i_crtc.h
>>> +++ b/drivers/gpu/drm/sun4i/sun4i_crtc.h
>>> @@ -19,7 +19,8 @@ struct sun4i_crtc {
>>>
>>>         struct sun4i_backend            *backend;
>>>         struct sun4i_tcon               *tcon;
>>> -       struct sun4i_layer              **layers;
>>> +       void                            **layers;
>>> +       const struct sunxi_layer_ops    *layer_ops;
>>
>>
>> I think you should probably take a different approach to abstract the
>> layer
>> type. How about creating
>>
>> struct sunxi_layer {
>>         struct drm_plane plane;
>> }
>>
>> base and then subclassing that for sun4i and sun8i? By doing this you can
>> avoid
>> the nasty casting and you can also get rid of the get_plane() hook and
>> layer_ops.
>
>
> For the situation that using ** things are easily to get weird.

That code could be reworked, by initializing the layers directly within
the crtc init code. If you look at rockchip's drm driver, you'll see
they do this. There is a good reason to do it this way, as you need
to first create the primary and cursor layers, pass them in when you
create the crtc, then initialize any additional layers with the
possible_crtcs bitmap.

In our driver we are currently initializing all layers, then going
back and filling in possible_crtcs for the extra layers.

And as Maxime and I mentioned in the other thread, we don't really
need to keep a reference to **layers.

Regards
ChenYu

>
>>
>> Sean
>>
>>
>>
>>>  };
>>>
>>>  static inline struct sun4i_crtc *drm_crtc_to_sun4i_crtc(struct drm_crtc
>>> *crtc)
>>> diff --git a/drivers/gpu/drm/sun4i/sun4i_layer.c
>>> b/drivers/gpu/drm/sun4i/sun4i_layer.c
>>> index f26bde5b9117..bc4a70d6968b 100644
>>> --- a/drivers/gpu/drm/sun4i/sun4i_layer.c
>>> +++ b/drivers/gpu/drm/sun4i/sun4i_layer.c
>>> @@ -16,7 +16,9 @@
>>>  #include <drm/drmP.h>
>>>
>>>  #include "sun4i_backend.h"
>>> +#include "sun4i_crtc.h"
>>>  #include "sun4i_layer.h"
>>> +#include "sunxi_layer.h"
>>>
>>>  struct sun4i_plane_desc {
>>>                enum drm_plane_type     type;
>>> @@ -100,6 +102,17 @@ static const struct sun4i_plane_desc
>>> sun4i_backend_planes[] = {
>>>         },
>>>  };
>>>
>>> +static struct drm_plane *sun4i_layer_get_plane(void *layer)
>>> +{
>>> +       struct sun4i_layer *sun4i_layer = layer;
>>> +
>>> +       return &sun4i_layer->plane;
>>> +}
>>> +
>>> +static const struct sunxi_layer_ops layer_ops = {
>>> +       .get_plane = sun4i_layer_get_plane,
>>> +};
>>> +
>>>  static struct sun4i_layer *sun4i_layer_init_one(struct drm_device *drm,
>>>                                                 struct sun4i_backend
>>> *backend,
>>>                                                 const struct
>>> sun4i_plane_desc *plane)
>>> @@ -129,9 +142,10 @@ static struct sun4i_layer
>>> *sun4i_layer_init_one(struct drm_device *drm,
>>>  }
>>>
>>>  struct sun4i_layer **sun4i_layers_init(struct drm_device *drm,
>>> -                                      struct sun4i_backend *backend)
>>> +                                      struct sun4i_crtc *crtc)
>>>  {
>>>         struct sun4i_layer **layers;
>>> +       struct sun4i_backend *backend = crtc->backend;
>>>         int i;
>>>
>>>         layers = devm_kcalloc(drm->dev, ARRAY_SIZE(sun4i_backend_planes)
>>> + 1,
>>> @@ -181,5 +195,8 @@ struct sun4i_layer **sun4i_layers_init(struct
>>> drm_device *drm,
>>>                 layers[i] = layer;
>>>         };
>>>
>>> +       /* Assign layer ops to the CRTC */
>>> +       crtc->layer_ops = &layer_ops;
>>> +
>>>         return layers;
>>>  }
>>> diff --git a/drivers/gpu/drm/sun4i/sun4i_layer.h
>>> b/drivers/gpu/drm/sun4i/sun4i_layer.h
>>> index 4be1f0919df2..425eea7b9e3b 100644
>>> --- a/drivers/gpu/drm/sun4i/sun4i_layer.h
>>> +++ b/drivers/gpu/drm/sun4i/sun4i_layer.h
>>> @@ -27,6 +27,6 @@ plane_to_sun4i_layer(struct drm_plane *plane)
>>>  }
>>>
>>>  struct sun4i_layer **sun4i_layers_init(struct drm_device *drm,
>>> -                                      struct sun4i_backend *backend);
>>> +                                      struct sun4i_crtc *crtc);
>>>
>>>  #endif /* _SUN4I_LAYER_H_ */
>>> diff --git a/drivers/gpu/drm/sun4i/sunxi_layer.h
>>> b/drivers/gpu/drm/sun4i/sunxi_layer.h
>>> new file mode 100644
>>> index 000000000000..d8838ec39299
>>> --- /dev/null
>>> +++ b/drivers/gpu/drm/sun4i/sunxi_layer.h
>>> @@ -0,0 +1,17 @@
>>> +/*
>>> + * Copyright (C) 2017 Icenowy Zheng <icenowy@aosc.xyz>
>>> + *
>>> + * This program is free software; you can redistribute it and/or
>>> + * modify it under the terms of the GNU General Public License as
>>> + * published by the Free Software Foundation; either version 2 of
>>> + * the License, or (at your option) any later version.
>>> + */
>>> +
>>> +#ifndef _SUNXI_LAYER_H_
>>> +#define _SUNXI_LAYER_H_
>>> +
>>> +struct sunxi_layer_ops {
>>> +       struct drm_plane *(*get_plane)(void *layer);
>>> +};
>>> +
>>> +#endif /* _SUNXI_LAYER_H_ */
>>> --
>>> 2.12.0
>>>
>>>
>>> _______________________________________________
>>> linux-arm-kernel mailing list
>>> linux-arm-kernel@lists.infradead.org
>>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to linux-sunxi+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [linux-sunxi] Re: [PATCH v3 04/11] drm/sun4i: abstract the layer type
@ 2017-04-05  2:27         ` Chen-Yu Tsai
  0 siblings, 0 replies; 9+ messages in thread
From: Chen-Yu Tsai @ 2017-04-05  2:27 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Apr 5, 2017 at 3:53 AM, Icenowy Zheng <icenowy@aosc.io> wrote:
>
>
> ? 2017?04?05? 03:28, Sean Paul ??:
>>
>> On Thu, Mar 30, 2017 at 03:46:06AM +0800, Icenowy Zheng wrote:
>>>
>>> As we are going to add support for the Allwinner DE2 Mixer in sun4i-drm
>>> driver, we will finally have two types of layer.
>>>
>>> Abstract the layer type to void * and a ops struct, which contains the
>>> only function used by crtc -- get the drm_plane struct of the layer.
>>>
>>> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
>>> ---
>>> Refactored patch in v3.
>>>
>>>  drivers/gpu/drm/sun4i/sun4i_crtc.c  | 19 +++++++++++--------
>>>  drivers/gpu/drm/sun4i/sun4i_crtc.h  |  3 ++-
>>>  drivers/gpu/drm/sun4i/sun4i_layer.c | 19 ++++++++++++++++++-
>>>  drivers/gpu/drm/sun4i/sun4i_layer.h |  2 +-
>>>  drivers/gpu/drm/sun4i/sunxi_layer.h | 17 +++++++++++++++++
>>>  5 files changed, 49 insertions(+), 11 deletions(-)
>>>  create mode 100644 drivers/gpu/drm/sun4i/sunxi_layer.h
>>>
>>> diff --git a/drivers/gpu/drm/sun4i/sun4i_crtc.c
>>> b/drivers/gpu/drm/sun4i/sun4i_crtc.c
>>> index 3c876c3a356a..33854ee7f636 100644
>>> --- a/drivers/gpu/drm/sun4i/sun4i_crtc.c
>>> +++ b/drivers/gpu/drm/sun4i/sun4i_crtc.c
>>> @@ -29,6 +29,7 @@
>>>  #include "sun4i_crtc.h"
>>>  #include "sun4i_drv.h"
>>>  #include "sun4i_layer.h"
>>> +#include "sunxi_layer.h"
>>>  #include "sun4i_tcon.h"
>>>
>>>  static void sun4i_crtc_atomic_begin(struct drm_crtc *crtc,
>>> @@ -149,7 +150,7 @@ struct sun4i_crtc *sun4i_crtc_init(struct drm_device
>>> *drm,
>>>         scrtc->tcon = tcon;
>>>
>>>         /* Create our layers */
>>> -       scrtc->layers = sun4i_layers_init(drm, scrtc->backend);
>>> +       scrtc->layers = (void **)sun4i_layers_init(drm, scrtc);
>>>         if (IS_ERR(scrtc->layers)) {
>>>                 dev_err(drm->dev, "Couldn't create the planes\n");
>>>                 return NULL;
>>> @@ -157,14 +158,15 @@ struct sun4i_crtc *sun4i_crtc_init(struct
>>> drm_device *drm,
>>>
>>>         /* find primary and cursor planes for drm_crtc_init_with_planes
>>> */
>>>         for (i = 0; scrtc->layers[i]; i++) {
>>> -               struct sun4i_layer *layer = scrtc->layers[i];
>>> +               void *layer = scrtc->layers[i];
>>> +               struct drm_plane *plane =
>>> scrtc->layer_ops->get_plane(layer);
>>>
>>> -               switch (layer->plane.type) {
>>> +               switch (plane->type) {
>>>                 case DRM_PLANE_TYPE_PRIMARY:
>>> -                       primary = &layer->plane;
>>> +                       primary = plane;
>>>                         break;
>>>                 case DRM_PLANE_TYPE_CURSOR:
>>> -                       cursor = &layer->plane;
>>> +                       cursor = plane;
>>>                         break;
>>>                 default:
>>>                         break;
>>> @@ -190,10 +192,11 @@ struct sun4i_crtc *sun4i_crtc_init(struct
>>> drm_device *drm,
>>>         /* Set possible_crtcs to this crtc for overlay planes */
>>>         for (i = 0; scrtc->layers[i]; i++) {
>>>                 uint32_t possible_crtcs =
>>> BIT(drm_crtc_index(&scrtc->crtc));
>>> -               struct sun4i_layer *layer = scrtc->layers[i];
>>> +               void *layer = scrtc->layers[i];
>>> +               struct drm_plane *plane =
>>> scrtc->layer_ops->get_plane(layer);
>>>
>>> -               if (layer->plane.type == DRM_PLANE_TYPE_OVERLAY)
>>> -                       layer->plane.possible_crtcs = possible_crtcs;
>>> +               if (plane->type == DRM_PLANE_TYPE_OVERLAY)
>>> +                       plane->possible_crtcs = possible_crtcs;
>>>         }
>>>
>>>         return scrtc;
>>> diff --git a/drivers/gpu/drm/sun4i/sun4i_crtc.h
>>> b/drivers/gpu/drm/sun4i/sun4i_crtc.h
>>> index 230cb8f0d601..a4036ee44cf8 100644
>>> --- a/drivers/gpu/drm/sun4i/sun4i_crtc.h
>>> +++ b/drivers/gpu/drm/sun4i/sun4i_crtc.h
>>> @@ -19,7 +19,8 @@ struct sun4i_crtc {
>>>
>>>         struct sun4i_backend            *backend;
>>>         struct sun4i_tcon               *tcon;
>>> -       struct sun4i_layer              **layers;
>>> +       void                            **layers;
>>> +       const struct sunxi_layer_ops    *layer_ops;
>>
>>
>> I think you should probably take a different approach to abstract the
>> layer
>> type. How about creating
>>
>> struct sunxi_layer {
>>         struct drm_plane plane;
>> }
>>
>> base and then subclassing that for sun4i and sun8i? By doing this you can
>> avoid
>> the nasty casting and you can also get rid of the get_plane() hook and
>> layer_ops.
>
>
> For the situation that using ** things are easily to get weird.

That code could be reworked, by initializing the layers directly within
the crtc init code. If you look at rockchip's drm driver, you'll see
they do this. There is a good reason to do it this way, as you need
to first create the primary and cursor layers, pass them in when you
create the crtc, then initialize any additional layers with the
possible_crtcs bitmap.

In our driver we are currently initializing all layers, then going
back and filling in possible_crtcs for the extra layers.

And as Maxime and I mentioned in the other thread, we don't really
need to keep a reference to **layers.

Regards
ChenYu

>
>>
>> Sean
>>
>>
>>
>>>  };
>>>
>>>  static inline struct sun4i_crtc *drm_crtc_to_sun4i_crtc(struct drm_crtc
>>> *crtc)
>>> diff --git a/drivers/gpu/drm/sun4i/sun4i_layer.c
>>> b/drivers/gpu/drm/sun4i/sun4i_layer.c
>>> index f26bde5b9117..bc4a70d6968b 100644
>>> --- a/drivers/gpu/drm/sun4i/sun4i_layer.c
>>> +++ b/drivers/gpu/drm/sun4i/sun4i_layer.c
>>> @@ -16,7 +16,9 @@
>>>  #include <drm/drmP.h>
>>>
>>>  #include "sun4i_backend.h"
>>> +#include "sun4i_crtc.h"
>>>  #include "sun4i_layer.h"
>>> +#include "sunxi_layer.h"
>>>
>>>  struct sun4i_plane_desc {
>>>                enum drm_plane_type     type;
>>> @@ -100,6 +102,17 @@ static const struct sun4i_plane_desc
>>> sun4i_backend_planes[] = {
>>>         },
>>>  };
>>>
>>> +static struct drm_plane *sun4i_layer_get_plane(void *layer)
>>> +{
>>> +       struct sun4i_layer *sun4i_layer = layer;
>>> +
>>> +       return &sun4i_layer->plane;
>>> +}
>>> +
>>> +static const struct sunxi_layer_ops layer_ops = {
>>> +       .get_plane = sun4i_layer_get_plane,
>>> +};
>>> +
>>>  static struct sun4i_layer *sun4i_layer_init_one(struct drm_device *drm,
>>>                                                 struct sun4i_backend
>>> *backend,
>>>                                                 const struct
>>> sun4i_plane_desc *plane)
>>> @@ -129,9 +142,10 @@ static struct sun4i_layer
>>> *sun4i_layer_init_one(struct drm_device *drm,
>>>  }
>>>
>>>  struct sun4i_layer **sun4i_layers_init(struct drm_device *drm,
>>> -                                      struct sun4i_backend *backend)
>>> +                                      struct sun4i_crtc *crtc)
>>>  {
>>>         struct sun4i_layer **layers;
>>> +       struct sun4i_backend *backend = crtc->backend;
>>>         int i;
>>>
>>>         layers = devm_kcalloc(drm->dev, ARRAY_SIZE(sun4i_backend_planes)
>>> + 1,
>>> @@ -181,5 +195,8 @@ struct sun4i_layer **sun4i_layers_init(struct
>>> drm_device *drm,
>>>                 layers[i] = layer;
>>>         };
>>>
>>> +       /* Assign layer ops to the CRTC */
>>> +       crtc->layer_ops = &layer_ops;
>>> +
>>>         return layers;
>>>  }
>>> diff --git a/drivers/gpu/drm/sun4i/sun4i_layer.h
>>> b/drivers/gpu/drm/sun4i/sun4i_layer.h
>>> index 4be1f0919df2..425eea7b9e3b 100644
>>> --- a/drivers/gpu/drm/sun4i/sun4i_layer.h
>>> +++ b/drivers/gpu/drm/sun4i/sun4i_layer.h
>>> @@ -27,6 +27,6 @@ plane_to_sun4i_layer(struct drm_plane *plane)
>>>  }
>>>
>>>  struct sun4i_layer **sun4i_layers_init(struct drm_device *drm,
>>> -                                      struct sun4i_backend *backend);
>>> +                                      struct sun4i_crtc *crtc);
>>>
>>>  #endif /* _SUN4I_LAYER_H_ */
>>> diff --git a/drivers/gpu/drm/sun4i/sunxi_layer.h
>>> b/drivers/gpu/drm/sun4i/sunxi_layer.h
>>> new file mode 100644
>>> index 000000000000..d8838ec39299
>>> --- /dev/null
>>> +++ b/drivers/gpu/drm/sun4i/sunxi_layer.h
>>> @@ -0,0 +1,17 @@
>>> +/*
>>> + * Copyright (C) 2017 Icenowy Zheng <icenowy@aosc.xyz>
>>> + *
>>> + * This program is free software; you can redistribute it and/or
>>> + * modify it under the terms of the GNU General Public License as
>>> + * published by the Free Software Foundation; either version 2 of
>>> + * the License, or (at your option) any later version.
>>> + */
>>> +
>>> +#ifndef _SUNXI_LAYER_H_
>>> +#define _SUNXI_LAYER_H_
>>> +
>>> +struct sunxi_layer_ops {
>>> +       struct drm_plane *(*get_plane)(void *layer);
>>> +};
>>> +
>>> +#endif /* _SUNXI_LAYER_H_ */
>>> --
>>> 2.12.0
>>>
>>>
>>> _______________________________________________
>>> linux-arm-kernel mailing list
>>> linux-arm-kernel at lists.infradead.org
>>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to linux-sunxi+unsubscribe at googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-04-05 17:15 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-05  5:23 [linux-sunxi] Re: [PATCH v3 04/11] drm/sun4i: abstract the layer type Icenowy Zheng
2017-04-05  8:09 ` Maxime Ripard
2017-04-05  8:09   ` Maxime Ripard
2017-04-05  8:09   ` Maxime Ripard
  -- strict thread matches above, loose matches on Subject: below --
2017-03-29 19:46 [PATCH v3 00/11] Initial Allwinner Display Engine 2.0 Support Icenowy Zheng
2017-03-29 19:46 ` [PATCH v3 04/11] drm/sun4i: abstract the layer type Icenowy Zheng
2017-04-04 19:28   ` Sean Paul
2017-04-04 19:53     ` Icenowy Zheng
2017-04-05  2:27       ` [linux-sunxi] " Chen-Yu Tsai
2017-04-05  2:27         ` Chen-Yu Tsai
2017-04-05 17:14         ` icenowy
2017-04-05 17:14           ` icenowy at aosc.io
2017-04-05 17:14           ` icenowy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.