For DCU support 16 layers(on ls1021a) or 64 layers(on vf610), add (total_layer - 1) overlay planes.
Signed-off-by: Jianwei Wang <jianwei.wang.chn at gmail.com> Signed-off-by: Meng Yi <meng.yi at nxp.com> --- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c index e50467a..3c2b6b4 100644 --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c @@ -235,8 +235,9 @@ void fsl_dcu_drm_init_planes(struct drm_device *dev) struct drm_plane *fsl_dcu_drm_primary_create_plane(struct drm_device *dev) { - struct drm_plane *primary; - int ret; + struct fsl_dcu_drm_device *fsl_dev = dev->dev_private; + struct drm_plane *primary, *overlay; + int ret, i; primary = kzalloc(sizeof(*primary), GFP_KERNEL); if (!primary) { @@ -256,5 +257,25 @@ struct drm_plane *fsl_dcu_drm_primary_create_plane(struct drm_device *dev) } drm_plane_helper_add(primary, &fsl_dcu_drm_plane_helper_funcs); + for (i = 0; i < fsl_dev->soc->total_layer - 1; i++) { + overlay = kzalloc(sizeof(struct drm_plane), GFP_KERNEL); + if (!overlay) { + DRM_DEBUG_KMS("Failed to allocate overlay plane\n"); + continue; + } + + ret = drm_universal_plane_init(dev, overlay, 1, + &fsl_dcu_drm_plane_funcs, + fsl_dcu_drm_plane_formats, + ARRAY_SIZE( + fsl_dcu_drm_plane_formats), + DRM_PLANE_TYPE_OVERLAY, NULL); + if (ret) { + kfree(overlay); + continue; + } + drm_plane_helper_add(overlay, &fsl_dcu_drm_plane_helper_funcs); + } + return primary; } -- 2.1.0.27.g96db324