[RFCv2 06/10] drm: Specify primary plane at CRTC initialization

Rob Clark robdclark at gmail.com
Sun Mar 9 14:12:31 PDT 2014


On Fri, Mar 7, 2014 at 7:03 PM, Matt Roper <matthew.d.roper at intel.com> wrote:
> Add primary plane as a parameter to drm_crtc_init() and update all
> existing DRM drivers to use a helper-provided primary plane.
>
> Signed-off-by: Matt Roper <matthew.d.roper at intel.com>
> ---
>  drivers/gpu/drm/armada/armada_crtc.c       | 4 +++-
>  drivers/gpu/drm/ast/ast_mode.c             | 4 +++-
>  drivers/gpu/drm/bochs/bochs_kms.c          | 4 +++-
>  drivers/gpu/drm/cirrus/cirrus_mode.c       | 4 +++-
>  drivers/gpu/drm/drm_crtc.c                 | 8 +++++++-
>  drivers/gpu/drm/exynos/exynos_drm_crtc.c   | 4 +++-
>  drivers/gpu/drm/gma500/psb_intel_display.c | 4 +++-
>  drivers/gpu/drm/i915/intel_display.c       | 4 +++-
>  drivers/gpu/drm/mgag200/mgag200_mode.c     | 4 +++-
>  drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c   | 4 +++-
>  drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c   | 4 +++-
>  drivers/gpu/drm/nouveau/dispnv04/crtc.c    | 4 +++-
>  drivers/gpu/drm/nouveau/nv50_display.c     | 4 +++-
>  drivers/gpu/drm/omapdrm/omap_crtc.c        | 4 +++-
>  drivers/gpu/drm/qxl/qxl_display.c          | 4 +++-
>  drivers/gpu/drm/radeon/radeon_display.c    | 4 +++-
>  drivers/gpu/drm/rcar-du/rcar_du_crtc.c     | 4 +++-
>  drivers/gpu/drm/shmobile/shmob_drm_crtc.c  | 3 ++-
>  drivers/gpu/drm/tegra/dc.c                 | 4 +++-
>  drivers/gpu/drm/tilcdc/tilcdc_crtc.c       | 4 +++-
>  drivers/gpu/drm/udl/udl_modeset.c          | 4 +++-
>  drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c        | 4 +++-
>  drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c       | 4 +++-
>  drivers/staging/imx-drm/imx-drm-core.c     | 4 +++-
>  include/drm/drm_crtc.h                     | 4 ++++
>  25 files changed, 79 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c
> index d8e3982..0a14d24 100644
> --- a/drivers/gpu/drm/armada/armada_crtc.c
> +++ b/drivers/gpu/drm/armada/armada_crtc.c
> @@ -1030,6 +1030,7 @@ int armada_drm_crtc_create(struct drm_device *dev, unsigned num,
>  {
>         struct armada_private *priv = dev->dev_private;
>         struct armada_crtc *dcrtc;
> +       struct drm_plane *primary;
>         void __iomem *base;
>         int ret;
>
> @@ -1086,7 +1087,8 @@ int armada_drm_crtc_create(struct drm_device *dev, unsigned num,
>
>         priv->dcrtc[dcrtc->num] = dcrtc;
>
> -       drm_crtc_init(dev, &dcrtc->crtc, &armada_crtc_funcs);
> +       primary = drm_primary_helper_create_plane(dev);
> +       drm_crtc_init(dev, &dcrtc->crtc, primary, &armada_crtc_funcs);
>         drm_crtc_helper_add(&dcrtc->crtc, &armada_crtc_helper_funcs);
>
>         drm_object_attach_property(&dcrtc->crtc.base, priv->csc_yuv_prop,
> diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
> index cca063b..44f0d32 100644
> --- a/drivers/gpu/drm/ast/ast_mode.c
> +++ b/drivers/gpu/drm/ast/ast_mode.c
> @@ -626,13 +626,15 @@ static const struct drm_crtc_funcs ast_crtc_funcs = {
>  static int ast_crtc_init(struct drm_device *dev)
>  {
>         struct ast_crtc *crtc;
> +       struct drm_plane *primary;
>         int i;
>
>         crtc = kzalloc(sizeof(struct ast_crtc), GFP_KERNEL);
>         if (!crtc)
>                 return -ENOMEM;
>
> -       drm_crtc_init(dev, &crtc->base, &ast_crtc_funcs);
> +       primary = drm_primary_helper_create_plane(dev);
> +       drm_crtc_init(dev, &crtc->base, primary, &ast_crtc_funcs);
>         drm_mode_crtc_set_gamma_size(&crtc->base, 256);
>         drm_crtc_helper_add(&crtc->base, &ast_crtc_helper_funcs);
>
> diff --git a/drivers/gpu/drm/bochs/bochs_kms.c b/drivers/gpu/drm/bochs/bochs_kms.c
> index 62ec7d4..182f5c9 100644
> --- a/drivers/gpu/drm/bochs/bochs_kms.c
> +++ b/drivers/gpu/drm/bochs/bochs_kms.c
> @@ -129,8 +129,10 @@ static void bochs_crtc_init(struct drm_device *dev)
>  {
>         struct bochs_device *bochs = dev->dev_private;
>         struct drm_crtc *crtc = &bochs->crtc;
> +       struct drm_plane *primary;
>
> -       drm_crtc_init(dev, crtc, &bochs_crtc_funcs);
> +       primary = drm_primary_helper_create_plane(dev);
> +       drm_crtc_init(dev, crtc, primary, &bochs_crtc_funcs);
>         drm_mode_crtc_set_gamma_size(crtc, 256);
>         drm_crtc_helper_add(crtc, &bochs_helper_funcs);
>  }
> diff --git a/drivers/gpu/drm/cirrus/cirrus_mode.c b/drivers/gpu/drm/cirrus/cirrus_mode.c
> index 530f78f..449246f 100644
> --- a/drivers/gpu/drm/cirrus/cirrus_mode.c
> +++ b/drivers/gpu/drm/cirrus/cirrus_mode.c
> @@ -381,6 +381,7 @@ static void cirrus_crtc_init(struct drm_device *dev)
>  {
>         struct cirrus_device *cdev = dev->dev_private;
>         struct cirrus_crtc *cirrus_crtc;
> +       struct drm_plane *primary;
>         int i;
>
>         cirrus_crtc = kzalloc(sizeof(struct cirrus_crtc) +
> @@ -390,7 +391,8 @@ static void cirrus_crtc_init(struct drm_device *dev)
>         if (cirrus_crtc == NULL)
>                 return;
>
> -       drm_crtc_init(dev, &cirrus_crtc->base, &cirrus_crtc_funcs);
> +       primary = drm_primary_helper_create_plane(dev);
> +       drm_crtc_init(dev, &cirrus_crtc->base, primary, &cirrus_crtc_funcs);
>
>         drm_mode_crtc_set_gamma_size(&cirrus_crtc->base, CIRRUS_LUT_SIZE);
>         cdev->mode_info.crtc = cirrus_crtc;
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 5b9b512..35e78a4 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -657,7 +657,8 @@ EXPORT_SYMBOL(drm_framebuffer_remove);
>   * Zero on success, error code on failure.
>   */
>  int drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
> -                  const struct drm_crtc_funcs *funcs)
> +                 struct drm_plane *primary,
> +                 const struct drm_crtc_funcs *funcs)
>  {
>         int ret;
>
> @@ -678,6 +679,9 @@ int drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
>         list_add_tail(&crtc->head, &dev->mode_config.crtc_list);
>         dev->mode_config.num_crtc++;
>
> +       crtc->primary = primary;
> +       primary->possible_crtcs = 1 << drm_crtc_index(crtc);
> +
>   out:
>         drm_modeset_unlock_all(dev);
>
> @@ -2376,6 +2380,8 @@ int drm_mode_set_config_internal(struct drm_mode_set *set)
>
>         ret = crtc->funcs->set_config(set);
>         if (ret == 0) {
> +               crtc->primary->crtc = crtc;
> +
>                 /* crtc->fb must be updated by ->set_config, enforces this. */
>                 WARN_ON(fb != crtc->fb);
>         }
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> index 6f3400f..507abd5 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> @@ -323,6 +323,7 @@ int exynos_drm_crtc_create(struct drm_device *dev, unsigned int nr)
>         struct exynos_drm_crtc *exynos_crtc;
>         struct exynos_drm_private *private = dev->dev_private;
>         struct drm_crtc *crtc;
> +       struct drm_plane *primary;
>
>         exynos_crtc = kzalloc(sizeof(*exynos_crtc), GFP_KERNEL);
>         if (!exynos_crtc)
> @@ -342,7 +343,8 @@ int exynos_drm_crtc_create(struct drm_device *dev, unsigned int nr)
>
>         private->crtc[nr] = crtc;
>
> -       drm_crtc_init(dev, crtc, &exynos_crtc_funcs);
> +       primary = drm_primary_helper_create_plane(dev);
> +       drm_crtc_init(dev, crtc, primary, &exynos_crtc_funcs);
>         drm_crtc_helper_add(crtc, &exynos_crtc_helper_funcs);
>
>         exynos_drm_crtc_attach_mode_property(crtc);
> diff --git a/drivers/gpu/drm/gma500/psb_intel_display.c b/drivers/gpu/drm/gma500/psb_intel_display.c
> index c8841ac..c8f833d 100644
> --- a/drivers/gpu/drm/gma500/psb_intel_display.c
> +++ b/drivers/gpu/drm/gma500/psb_intel_display.c
> @@ -491,6 +491,7 @@ void psb_intel_crtc_init(struct drm_device *dev, int pipe,
>  {
>         struct drm_psb_private *dev_priv = dev->dev_private;
>         struct gma_crtc *gma_crtc;
> +       struct drm_plane *primary;
>         int i;
>         uint16_t *r_base, *g_base, *b_base;
>
> @@ -511,7 +512,8 @@ void psb_intel_crtc_init(struct drm_device *dev, int pipe,
>         }
>
>         /* Set the CRTC operations from the chip specific data */
> -       drm_crtc_init(dev, &gma_crtc->base, dev_priv->ops->crtc_funcs);
> +       primary = drm_primary_helper_create_plane(dev);
> +       drm_crtc_init(dev, &gma_crtc->base, primary, dev_priv->ops->crtc_funcs);
>
>         /* Set the CRTC clock functions from chip specific data */
>         gma_crtc->clock_funcs = dev_priv->ops->clock_funcs;
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 53f7c9c..9a92895 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -10280,13 +10280,15 @@ static void intel_crtc_init(struct drm_device *dev, int pipe)
>  {
>         drm_i915_private_t *dev_priv = dev->dev_private;
>         struct intel_crtc *intel_crtc;
> +       struct drm_plane *primary;
>         int i;
>
>         intel_crtc = kzalloc(sizeof(*intel_crtc), GFP_KERNEL);
>         if (intel_crtc == NULL)
>                 return;
>
> -       drm_crtc_init(dev, &intel_crtc->base, &intel_crtc_funcs);
> +       primary = drm_primary_helper_create_plane(dev);
> +       drm_crtc_init(dev, &intel_crtc->base, primary, &intel_crtc_funcs);
>
>         drm_mode_crtc_set_gamma_size(&intel_crtc->base, 256);
>         for (i = 0; i < 256; i++) {
> diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c
> index 9683747..4d6a043 100644
> --- a/drivers/gpu/drm/mgag200/mgag200_mode.c
> +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
> @@ -1314,6 +1314,7 @@ static const struct drm_crtc_helper_funcs mga_helper_funcs = {
>  static void mga_crtc_init(struct mga_device *mdev)
>  {
>         struct mga_crtc *mga_crtc;
> +       struct drm_plane *primary;
>         int i;
>
>         mga_crtc = kzalloc(sizeof(struct mga_crtc) +
> @@ -1323,7 +1324,8 @@ static void mga_crtc_init(struct mga_device *mdev)
>         if (mga_crtc == NULL)
>                 return;
>
> -       drm_crtc_init(mdev->dev, &mga_crtc->base, &mga_crtc_funcs);
> +       primary = drm_primary_helper_create_plane(dev);
> +       drm_crtc_init(mdev->dev, &mga_crtc->base, primary, &mga_crtc_funcs);
>
>         drm_mode_crtc_set_gamma_size(&mga_crtc->base, MGAG200_LUT_SIZE);
>         mdev->mode_info.crtc = mga_crtc;
> diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c
> index 84c5b13..372670e 100644
> --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c
> +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c
> @@ -753,6 +753,7 @@ struct drm_crtc *mdp4_crtc_init(struct drm_device *dev,
>                 enum mdp4_dma dma_id)
>  {
>         struct drm_crtc *crtc = NULL;
> +       struct drm_plane *primary;
>         struct mdp4_crtc *mdp4_crtc;
>         int ret;
>
> @@ -791,7 +792,8 @@ struct drm_crtc *mdp4_crtc_init(struct drm_device *dev,
>
>         INIT_FENCE_CB(&mdp4_crtc->pageflip_cb, pageflip_cb);
>
> -       drm_crtc_init(dev, crtc, &mdp4_crtc_funcs);
> +       primary = drm_primary_helper_create_plane(dev);
> +       drm_crtc_init(dev, crtc, primary, &mdp4_crtc_funcs);

note that msm, omap, and iirc exynos (and maybe even some others)
already have their own private (now primary) planes.  I suspect they
should be using their existing plane, rather than creating a helper
plane.

BR,
-R

>         drm_crtc_helper_add(crtc, &mdp4_crtc_helper_funcs);
>
>         mdp4_plane_install_properties(mdp4_crtc->plane, &crtc->base);
> diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
> index f279402..da27348 100644
> --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
> +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
> @@ -533,6 +533,7 @@ struct drm_crtc *mdp5_crtc_init(struct drm_device *dev,
>  {
>         struct drm_crtc *crtc = NULL;
>         struct mdp5_crtc *mdp5_crtc;
> +       struct drm_plane *primary;
>         int ret;
>
>         mdp5_crtc = kzalloc(sizeof(*mdp5_crtc), GFP_KERNEL);
> @@ -559,7 +560,8 @@ struct drm_crtc *mdp5_crtc_init(struct drm_device *dev,
>
>         INIT_FENCE_CB(&mdp5_crtc->pageflip_cb, pageflip_cb);
>
> -       drm_crtc_init(dev, crtc, &mdp5_crtc_funcs);
> +       primary = drm_primary_helper_create_plane(dev);
> +       drm_crtc_init(dev, crtc, primary, &mdp5_crtc_funcs);
>         drm_crtc_helper_add(crtc, &mdp5_crtc_helper_funcs);
>
>         mdp5_plane_install_properties(mdp5_crtc->plane, &crtc->base);
> diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
> index 0e3270c..b55be84 100644
> --- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c
> +++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
> @@ -1106,6 +1106,7 @@ int
>  nv04_crtc_create(struct drm_device *dev, int crtc_num)
>  {
>         struct nouveau_crtc *nv_crtc;
> +       struct drm_plane *primary;
>         int ret, i;
>
>         nv_crtc = kzalloc(sizeof(*nv_crtc), GFP_KERNEL);
> @@ -1122,7 +1123,8 @@ nv04_crtc_create(struct drm_device *dev, int crtc_num)
>         nv_crtc->index = crtc_num;
>         nv_crtc->last_dpms = NV_DPMS_CLEARED;
>
> -       drm_crtc_init(dev, &nv_crtc->base, &nv04_crtc_funcs);
> +       primary = drm_primary_helper_create_plane(dev);
> +       drm_crtc_init(dev, &nv_crtc->base, primary, &nv04_crtc_funcs);
>         drm_crtc_helper_add(&nv_crtc->base, &nv04_crtc_helper_funcs);
>         drm_mode_crtc_set_gamma_size(&nv_crtc->base, 256);
>
> diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
> index 2dccafc..5706842 100644
> --- a/drivers/gpu/drm/nouveau/nv50_display.c
> +++ b/drivers/gpu/drm/nouveau/nv50_display.c
> @@ -1348,6 +1348,7 @@ nv50_crtc_create(struct drm_device *dev, struct nouveau_object *core, int index)
>         struct nv50_disp *disp = nv50_disp(dev);
>         struct nv50_head *head;
>         struct drm_crtc *crtc;
> +       struct drm_plane *primary;
>         int ret, i;
>
>         head = kzalloc(sizeof(*head), GFP_KERNEL);
> @@ -1369,7 +1370,8 @@ nv50_crtc_create(struct drm_device *dev, struct nouveau_object *core, int index)
>         }
>
>         crtc = &head->base.base;
> -       drm_crtc_init(dev, crtc, &nv50_crtc_func);
> +       primary = drm_primary_helper_create_plane(dev);
> +       drm_crtc_init(dev, crtc, primary, &nv50_crtc_func);
>         drm_crtc_helper_add(crtc, &nv50_crtc_hfunc);
>         drm_mode_crtc_set_gamma_size(crtc, 256);
>
> diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
> index 4313bb0..2015715 100644
> --- a/drivers/gpu/drm/omapdrm/omap_crtc.c
> +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
> @@ -633,6 +633,7 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev,
>                 struct drm_plane *plane, enum omap_channel channel, int id)
>  {
>         struct drm_crtc *crtc = NULL;
> +       struct drm_plane *primary;
>         struct omap_crtc *omap_crtc;
>         struct omap_overlay_manager_info *info;
>
> @@ -677,7 +678,8 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev,
>         info->trans_key_type = OMAP_DSS_COLOR_KEY_GFX_DST;
>         info->trans_enabled = false;
>
> -       drm_crtc_init(dev, crtc, &omap_crtc_funcs);
> +       primary = drm_primary_helper_create_plane(dev);
> +       drm_crtc_init(dev, crtc, primary, &omap_crtc_funcs);
>         drm_crtc_helper_add(crtc, &omap_crtc_helper_funcs);
>
>         omap_plane_install_properties(omap_crtc->plane, &crtc->base);
> diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c
> index 798bde2..24b6112 100644
> --- a/drivers/gpu/drm/qxl/qxl_display.c
> +++ b/drivers/gpu/drm/qxl/qxl_display.c
> @@ -636,12 +636,14 @@ static const struct drm_crtc_helper_funcs qxl_crtc_helper_funcs = {
>  static int qdev_crtc_init(struct drm_device *dev, int crtc_id)
>  {
>         struct qxl_crtc *qxl_crtc;
> +       struct drm_plane *primary;
>
>         qxl_crtc = kzalloc(sizeof(struct qxl_crtc), GFP_KERNEL);
>         if (!qxl_crtc)
>                 return -ENOMEM;
>
> -       drm_crtc_init(dev, &qxl_crtc->base, &qxl_crtc_funcs);
> +       primary = drm_primary_helper_create_plane(dev);
> +       drm_crtc_init(dev, &qxl_crtc->base, primary, &qxl_crtc_funcs);
>         qxl_crtc->index = crtc_id;
>         drm_mode_crtc_set_gamma_size(&qxl_crtc->base, 256);
>         drm_crtc_helper_add(&qxl_crtc->base, &qxl_crtc_helper_funcs);
> diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
> index fbd8b93..a29d217 100644
> --- a/drivers/gpu/drm/radeon/radeon_display.c
> +++ b/drivers/gpu/drm/radeon/radeon_display.c
> @@ -552,13 +552,15 @@ static void radeon_crtc_init(struct drm_device *dev, int index)
>  {
>         struct radeon_device *rdev = dev->dev_private;
>         struct radeon_crtc *radeon_crtc;
> +       struct drm_plane *primary;
>         int i;
>
>         radeon_crtc = kzalloc(sizeof(struct radeon_crtc) + (RADEONFB_CONN_LIMIT * sizeof(struct drm_connector *)), GFP_KERNEL);
>         if (radeon_crtc == NULL)
>                 return;
>
> -       drm_crtc_init(dev, &radeon_crtc->base, &radeon_crtc_funcs);
> +       primary = drm_primary_helper_create_plane(dev);
> +       drm_crtc_init(dev, &radeon_crtc->base, primary, &radeon_crtc_funcs);
>
>         drm_mode_crtc_set_gamma_size(&radeon_crtc->base, 256);
>         radeon_crtc->crtc_id = index;
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> index fbf4be3..151ffaa 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> @@ -540,6 +540,7 @@ int rcar_du_crtc_create(struct rcar_du_group *rgrp, unsigned int index)
>         struct platform_device *pdev = to_platform_device(rcdu->dev);
>         struct rcar_du_crtc *rcrtc = &rcdu->crtcs[index];
>         struct drm_crtc *crtc = &rcrtc->crtc;
> +       struct drm_plane *primary;
>         unsigned int irqflags;
>         char clk_name[5];
>         char *name;
> @@ -568,7 +569,8 @@ int rcar_du_crtc_create(struct rcar_du_group *rgrp, unsigned int index)
>
>         rcrtc->plane->crtc = crtc;
>
> -       ret = drm_crtc_init(rcdu->ddev, crtc, &crtc_funcs);
> +       primary = drm_primary_helper_create_plane(dev);
> +       ret = drm_crtc_init(rcdu->ddev, crtc, primary, &crtc_funcs);
>         if (ret < 0)
>                 return ret;
>
> diff --git a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
> index 0428076..e806553 100644
> --- a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
> +++ b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
> @@ -512,11 +512,12 @@ static const struct drm_crtc_funcs crtc_funcs = {
>  int shmob_drm_crtc_create(struct shmob_drm_device *sdev)
>  {
>         struct drm_crtc *crtc = &sdev->crtc.crtc;
> +       struct drm_plane *primary;
>         int ret;
>
>         sdev->crtc.dpms = DRM_MODE_DPMS_OFF;
>
> -       ret = drm_crtc_init(sdev->ddev, crtc, &crtc_funcs);
> +       ret = drm_crtc_init(sdev->ddev, crtc, primary, &crtc_funcs);
>         if (ret < 0)
>                 return ret;
>
> diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
> index 76e5b22..5e2ee9d 100644
> --- a/drivers/gpu/drm/tegra/dc.c
> +++ b/drivers/gpu/drm/tegra/dc.c
> @@ -1099,9 +1099,11 @@ static int tegra_dc_init(struct host1x_client *client)
>  {
>         struct tegra_drm *tegra = dev_get_drvdata(client->parent);
>         struct tegra_dc *dc = host1x_client_to_dc(client);
> +       struct drm_plane *primary;
>         int err;
>
> -       drm_crtc_init(tegra->drm, &dc->base, &tegra_crtc_funcs);
> +       primary = drm_primary_helper_create_plane(dev);
> +       drm_crtc_init(tegra->drm, &dc->base, primary, &tegra_crtc_funcs);
>         drm_mode_crtc_set_gamma_size(&dc->base, 256);
>         drm_crtc_helper_add(&dc->base, &tegra_crtc_helper_funcs);
>
> diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
> index d36efc1..310314c 100644
> --- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
> +++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
> @@ -651,6 +651,7 @@ struct drm_crtc *tilcdc_crtc_create(struct drm_device *dev)
>  {
>         struct tilcdc_crtc *tilcdc_crtc;
>         struct drm_crtc *crtc;
> +       struct drm_plane *primary;
>         int ret;
>
>         tilcdc_crtc = kzalloc(sizeof(*tilcdc_crtc), GFP_KERNEL);
> @@ -671,7 +672,8 @@ struct drm_crtc *tilcdc_crtc_create(struct drm_device *dev)
>                 goto fail;
>         }
>
> -       ret = drm_crtc_init(dev, crtc, &tilcdc_crtc_funcs);
> +       primary = drm_primary_helper_create_plane(dev);
> +       ret = drm_crtc_init(dev, crtc, primary, &tilcdc_crtc_funcs);
>         if (ret < 0)
>                 goto fail;
>
> diff --git a/drivers/gpu/drm/udl/udl_modeset.c b/drivers/gpu/drm/udl/udl_modeset.c
> index 2ae1eb7..1255944 100644
> --- a/drivers/gpu/drm/udl/udl_modeset.c
> +++ b/drivers/gpu/drm/udl/udl_modeset.c
> @@ -389,12 +389,14 @@ static const struct drm_crtc_funcs udl_crtc_funcs = {
>  static int udl_crtc_init(struct drm_device *dev)
>  {
>         struct drm_crtc *crtc;
> +       struct drm_plane *primary;
>
>         crtc = kzalloc(sizeof(struct drm_crtc) + sizeof(struct drm_connector *), GFP_KERNEL);
>         if (crtc == NULL)
>                 return -ENOMEM;
>
> -       drm_crtc_init(dev, crtc, &udl_crtc_funcs);
> +       primary = drm_primary_helper_create_plane(dev);
> +       drm_crtc_init(dev, crtc, primary, &udl_crtc_funcs);
>         drm_crtc_helper_add(crtc, &udl_helper_funcs);
>
>         return 0;
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
> index a055a26..001ec81 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
> @@ -343,6 +343,7 @@ static int vmw_ldu_init(struct vmw_private *dev_priv, unsigned unit)
>         struct drm_connector *connector;
>         struct drm_encoder *encoder;
>         struct drm_crtc *crtc;
> +       struct drm_plane *primary;
>
>         ldu = kzalloc(sizeof(*ldu), GFP_KERNEL);
>         if (!ldu)
> @@ -373,7 +374,8 @@ static int vmw_ldu_init(struct vmw_private *dev_priv, unsigned unit)
>
>         (void) drm_sysfs_connector_add(connector);
>
> -       drm_crtc_init(dev, crtc, &vmw_legacy_crtc_funcs);
> +       primary = drm_primary_helper_create_plane(dev);
> +       drm_crtc_init(dev, crtc, primary, &vmw_legacy_crtc_funcs);
>
>         drm_mode_crtc_set_gamma_size(crtc, 256);
>
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
> index 22406c8..585da43 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
> @@ -439,6 +439,7 @@ static int vmw_sou_init(struct vmw_private *dev_priv, unsigned unit)
>         struct drm_connector *connector;
>         struct drm_encoder *encoder;
>         struct drm_crtc *crtc;
> +       struct drm_plane *primary;
>
>         sou = kzalloc(sizeof(*sou), GFP_KERNEL);
>         if (!sou)
> @@ -469,7 +470,8 @@ static int vmw_sou_init(struct vmw_private *dev_priv, unsigned unit)
>
>         (void) drm_sysfs_connector_add(connector);
>
> -       drm_crtc_init(dev, crtc, &vmw_screen_object_crtc_funcs);
> +       primary = drm_primary_helper_create_plane(dev);
> +       drm_crtc_init(dev, crtc, primary, &vmw_screen_object_crtc_funcs);
>
>         drm_mode_crtc_set_gamma_size(crtc, 256);
>
> diff --git a/drivers/staging/imx-drm/imx-drm-core.c b/drivers/staging/imx-drm/imx-drm-core.c
> index 236ed66..8c7b1d3 100644
> --- a/drivers/staging/imx-drm/imx-drm-core.c
> +++ b/drivers/staging/imx-drm/imx-drm-core.c
> @@ -475,6 +475,7 @@ int imx_drm_add_crtc(struct drm_crtc *crtc,
>  {
>         struct imx_drm_device *imxdrm = __imx_drm_device();
>         struct imx_drm_crtc *imx_drm_crtc;
> +       struct drm_plane *primary;
>         int ret;
>
>         mutex_lock(&imxdrm->mutex);
> @@ -520,7 +521,8 @@ int imx_drm_add_crtc(struct drm_crtc *crtc,
>         drm_crtc_helper_add(crtc,
>                         imx_drm_crtc->imx_drm_helper_funcs.crtc_helper_funcs);
>
> -       drm_crtc_init(imxdrm->drm, crtc,
> +       primary = drm_primary_helper_create_plane(dev);
> +       drm_crtc_init(imxdrm->drm, crtc, primary,
>                         imx_drm_crtc->imx_drm_helper_funcs.crtc_funcs);
>
>         drm_mode_group_reinit(imxdrm->drm);
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index d8a1dc8..c83321b 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -422,6 +422,9 @@ struct drm_crtc {
>
>         struct drm_mode_object base;
>
> +       /* primary plane for CRTC */
> +       struct drm_plane *primary;
> +
>         /* framebuffer the connector is currently bound to */
>         struct drm_framebuffer *fb;
>
> @@ -1031,6 +1034,7 @@ extern void drm_warn_on_modeset_not_all_locked(struct drm_device *dev);
>
>  extern int drm_crtc_init(struct drm_device *dev,
>                          struct drm_crtc *crtc,
> +                        struct drm_plane *primary,
>                          const struct drm_crtc_funcs *funcs);
>  extern void drm_crtc_cleanup(struct drm_crtc *crtc);
>  extern unsigned int drm_crtc_index(struct drm_crtc *crtc);
> --
> 1.8.5.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


More information about the dri-devel mailing list