On Tue, Mar 18, 2014 at 05:22:51PM -0700, Matt Roper wrote:
> Add a plane type property to allow userspace to distinguish plane types.
> The type of the plane will now be established at drm_plane_init() time
> (replacing the 'priv' parameter previously used).
>
> Signed-off-by: Matt Roper
Lots of churn here over all drivers. Can't we just do a sane default
behaviour for drm_plane_init (i.e. overlay planes) and add a new
drm_universal_plane_init with the full powers?
That way the transition is easier to handle and drivers can opt-in at
their own pace and as needed.
-Daniel
> ---
> drivers/gpu/drm/armada/armada_overlay.c| 3 +-
> drivers/gpu/drm/drm_crtc.c | 65
> --
> drivers/gpu/drm/exynos/exynos_drm_plane.c | 4 +-
> drivers/gpu/drm/i915/intel_sprite.c| 2 +-
> drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c | 4 +-
> drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 4 +-
> drivers/gpu/drm/nouveau/dispnv04/overlay.c | 4 +-
> drivers/gpu/drm/omapdrm/omap_plane.c | 4 +-
> drivers/gpu/drm/rcar-du/rcar_du_plane.c| 3 +-
> drivers/gpu/drm/shmobile/shmob_drm_plane.c | 2 +-
> drivers/gpu/drm/tegra/dc.c | 3 +-
> drivers/staging/imx-drm/ipuv3-plane.c | 4 +-
> include/drm/drm_crtc.h | 3 +-
> 13 files changed, 70 insertions(+), 35 deletions(-)
>
> diff --git a/drivers/gpu/drm/armada/armada_overlay.c
> b/drivers/gpu/drm/armada/armada_overlay.c
> index c5b06fd..ef68c42 100644
> --- a/drivers/gpu/drm/armada/armada_overlay.c
> +++ b/drivers/gpu/drm/armada/armada_overlay.c
> @@ -444,7 +444,8 @@ int armada_overlay_plane_create(struct drm_device *dev,
> unsigned long crtcs)
> dplane);
>
> drm_plane_init(dev, &dplane->base, crtcs, &armada_plane_funcs,
> -armada_formats, ARRAY_SIZE(armada_formats), false);
> +armada_formats, ARRAY_SIZE(armada_formats),
> +DRM_PLANE_TYPE_OVERLAY);
>
> dplane->prop.colorkey_yr = 0xfefefe00;
> dplane->prop.colorkey_ug = 0x01010100;
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index db54ae9..8e869d6 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -121,6 +121,15 @@ static const struct drm_prop_enum_list
> drm_dpms_enum_list[] =
>
> DRM_ENUM_NAME_FN(drm_get_dpms_name, drm_dpms_enum_list)
>
> +static const struct drm_prop_enum_list drm_plane_type_enum_list[] =
> +{
> + { DRM_PLANE_TYPE_OVERLAY, "Overlay" },
> + { DRM_PLANE_TYPE_PRIMARY, "Primary" },
> + { DRM_PLANE_TYPE_CURSOR, "Cursor" },
> +};
> +
> +DRM_ENUM_NAME_FN(drm_get_plane_type, drm_plane_type_enum_list)
> +
> /*
> * Optional properties
> */
> @@ -1007,7 +1016,7 @@ EXPORT_SYMBOL(drm_encoder_cleanup);
> * @funcs: callbacks for the new plane
> * @formats: array of supported formats (%DRM_FORMAT_*)
> * @format_count: number of elements in @formats
> - * @priv: plane is private (hidden from userspace)?
> + * @type: type of plane (overlay, primary, cursor)
> *
> * Inits a preallocate plane object created as base part of a driver plane
> * object.
> @@ -1019,7 +1028,7 @@ int drm_plane_init(struct drm_device *dev, struct
> drm_plane *plane,
> unsigned long possible_crtcs,
> const struct drm_plane_funcs *funcs,
> const uint32_t *formats, uint32_t format_count,
> -bool priv)
> +enum drm_plane_type type)
> {
> int ret;
>
> @@ -1044,20 +1053,16 @@ int drm_plane_init(struct drm_device *dev, struct
> drm_plane *plane,
> memcpy(plane->format_types, formats, format_count * sizeof(uint32_t));
> plane->format_count = format_count;
> plane->possible_crtcs = possible_crtcs;
> - plane->type = DRM_PLANE_TYPE_OVERLAY;
> + plane->type = type;
>
> - /* private planes are not exposed to userspace, but depending on
> - * display hardware, might be convenient to allow sharing programming
> - * for the scanout engine with the crtc implementation.
> - */
> - if (!priv) {
> - list_add_tail(&plane->head, &dev->mode_config.plane_list);
> - dev->mode_config.num_total_plane++;
> - if (plane->type == DRM_PLANE_TYPE_OVERLAY)
> - dev->mode_config.num_overlay_plane++;
> - } else {
> - INIT_LIST_HEAD(&plane->head);
> - }
> + list_add_tail(&plane->head, &dev->mode_config.plane_list);
> + dev->mode_config.num_total_plane++;
> + if (plane->type == DRM_PLANE_TYPE_OVERLAY)
> + dev->mode_config.num_overlay_plane++;
> +
> + drm_object_attach_property(&plane->base,
> +dev->mode_config.plane_type_property,
> +plane->type);
>
> out:
> drm_modeset_unlock_all(dev);
> @@ -1081,13 +1086,13 @@ void drm_plane_cleanup(struct drm_plane *plane)
>