Hi Benoit,
On 02/03/18 15:48, Benoit Parrot wrote:
> Add virtual plane support by adding an array to contain
> all of the actual plane_id a "omap_plane" correspond to.
"plane_ids", "an", "corresponds"
> When at least one 'plane' child node is present in DT then
> omap_plane_init will only used the plane described in DT.
"use"
> Some of these nodes may be a virtual plane if they are defined
> as two physical planes.
> Planes can also be associated with various crtcs independently.
> Therefore we can restrict the use of virtual plane to specific
> CRTC/video port if need be, if crtc_mask is not specified then
> the plane will be available to all available crtcs.
> Physical plane which are not described will essentially be hidden
"planes"
> from the driver.
>
> If no 'plane' child node exist then the existing plane
"nodes"
> allocation will take place.
Maybe "normal plane allocation"?
>
> Signed-off-by: Benoit Parrot
> ---
> drivers/gpu/drm/omapdrm/omap_drv.c | 18 +++--
> drivers/gpu/drm/omapdrm/omap_fb.c| 66 +++--
> drivers/gpu/drm/omapdrm/omap_fb.h| 4 +-
> drivers/gpu/drm/omapdrm/omap_plane.c | 139
> +--
> drivers/gpu/drm/omapdrm/omap_plane.h | 3 +-
> 5 files changed, 162 insertions(+), 68 deletions(-)
>
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c
> b/drivers/gpu/drm/omapdrm/omap_drv.c
> index dd68b2556f5b..73796364a592 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -188,10 +188,9 @@ static int omap_connect_dssdevs(void)
> return r;
> }
>
> -static int omap_modeset_init_properties(struct drm_device *dev)
> +static int omap_modeset_init_properties(struct drm_device *dev, u32
> num_planes)
> {
> struct omap_drm_private *priv = dev->dev_private;
> - unsigned int num_planes = priv->dispc_ops->get_num_ovls();
>
> priv->zorder_prop = drm_property_create_range(dev, 0, "zorder", 0,
> num_planes - 1);
> @@ -210,10 +209,19 @@ static int omap_modeset_init(struct drm_device *dev)
> int num_crtcs, crtc_idx, plane_idx;
> int ret;
> u32 plane_crtc_mask;
> + struct dispc_plane_mappings plane_mappings = {0};
>
> drm_mode_config_init(dev);
>
> - ret = omap_modeset_init_properties(dev);
> + ret = priv->dispc_ops->get_plane_mapping(&plane_mappings);
> + if (ret < 0)
> + return ret;
> +
> + /* use plane mappings info */
> + if (plane_mappings.num_planes)
> + num_ovls = plane_mappings.num_planes;
> +
> + ret = omap_modeset_init_properties(dev, num_ovls);
> if (ret < 0)
> return ret;
>
> @@ -266,7 +274,7 @@ static int omap_modeset_init(struct drm_device *dev)
> return -ENOMEM;
>
> plane = omap_plane_init(dev, plane_idx, DRM_PLANE_TYPE_PRIMARY,
> - plane_crtc_mask);
> + plane_crtc_mask, &plane_mappings);
> if (IS_ERR(plane))
> return PTR_ERR(plane);
>
> @@ -296,7 +304,7 @@ static int omap_modeset_init(struct drm_device *dev)
> return -EINVAL;
>
> plane = omap_plane_init(dev, plane_idx, DRM_PLANE_TYPE_OVERLAY,
> - plane_crtc_mask);
> + plane_crtc_mask, &plane_mappings);
> if (IS_ERR(plane))
> return PTR_ERR(plane);
>
> diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c
> b/drivers/gpu/drm/omapdrm/omap_fb.c
> index b2539a90e1a4..80b29b7f5696 100644
> --- a/drivers/gpu/drm/omapdrm/omap_fb.c
> +++ b/drivers/gpu/drm/omapdrm/omap_fb.c
> @@ -153,25 +153,27 @@ static uint32_t drm_rotation_to_tiler(unsigned int
> drm_rot)
> /* update ovl info for scanout, handles cases of multi-planar fb's, etc.
> */
> void omap_framebuffer_update_scanout(struct drm_framebuffer *fb,
> - struct drm_plane_state *state, struct omap_overlay_info *info)
> + struct drm_plane_state *state,
> + struct omap_overlay_info *main_info,
> + struct omap_overlay_info *aux_info)
> {
> struct omap_framebuffer *omap_fb = to_omap_framebuffer(fb);
> const struct drm_format_info *format = omap_fb->format;
> struct plane *plane = &omap_fb->planes[0];
> uint32_t x, y, orient = 0;
>
> - info->fourcc = fb->format->format;
> + main_info->fourcc = fb->format->format;
>
> - info->pos_x = state->crtc_x;
> - info->pos_y = state->crtc_y;
> - info->out_width = state->crtc_w;
> - info->out_height = state->crtc_h;
> - info->width = state->src_w >> 16;
> - info->height = state->src_h >> 16;
> + main_info->pos_x = state->crtc_x;
> + main_info->pos_y = state->crtc_y;
> + main_info->out_width = state->crtc_w;
> + main_info->out_height = state->crtc