From: Stefan Agner <stefan@agner.ch>
To: Dongsheng Wang <dongsheng.wang@freescale.com>
Cc: Yi Meng <b56799@freescale.com>, dri-devel@lists.freedesktop.org
Subject: Re: [RESEND 3/3] drm :fsl-dcu: Add multi layers support
Date: Wed, 02 Dec 2015 17:38:26 -0800 [thread overview]
Message-ID: <5c68035c2a1498dd7a69ef88bf3a9594@agner.ch> (raw)
In-Reply-To: <1448957768-14627-2-git-send-email-dongsheng.wang@freescale.com>
Hi Dongsheng,
On 2015-12-01 00:16, Dongsheng Wang wrote:
> From: Jianwei Wang <jianwei.wang.chn@gmail.com>
>
> For DCU support atmost 16 layers(on ls1021a) or 64 layers(on vf610),
> add (total_layer - 1) overlay planes.
>
> Signed-off-by: Jianwei Wang <jianwei.wang.chn@gmail.com>
> Signed-off-by: Yi Meng <b56799@freescale.com>
> Signed-off-by: Wang Dongsheng <dongsheng.wang@freescale.com>
>
> 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 a8932a8..7ed1a7e 100644
> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
> @@ -235,7 +235,10 @@ static const u32 fsl_dcu_drm_plane_formats[] = {
>
> struct drm_plane *fsl_dcu_drm_primary_create_plane(struct drm_device *dev)
> {
It feels wrong to me to add multi layer support in a function called
fsl_dcu_drm_primary_create_plane...
I suggest to either rename the function, or better create a new function
for the overlay planes. The only shared variable is formats_size, which
is anyway statically determined by the compiler.
--
Stefan
> + struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
> struct drm_plane *primary;
> + struct drm_plane *overlay;
> + unsigned int total_layer, formats_size, i;
> int ret;
>
> primary = kzalloc(sizeof(*primary), GFP_KERNEL);
> @@ -244,11 +247,12 @@ struct drm_plane
> *fsl_dcu_drm_primary_create_plane(struct drm_device *dev)
> return NULL;
> }
>
> + formats_size = ARRAY_SIZE(fsl_dcu_drm_plane_formats);
> /* possible_crtc's will be filled in later by crtc_init */
> ret = drm_universal_plane_init(dev, primary, 0,
> &fsl_dcu_drm_plane_funcs,
> fsl_dcu_drm_plane_formats,
> - ARRAY_SIZE(fsl_dcu_drm_plane_formats),
> + formats_size,
> DRM_PLANE_TYPE_PRIMARY);
> if (ret) {
> kfree(primary);
> @@ -256,5 +260,26 @@ struct drm_plane
> *fsl_dcu_drm_primary_create_plane(struct drm_device *dev)
> }
> drm_plane_helper_add(primary, &fsl_dcu_drm_plane_helper_funcs);
>
> + total_layer = fsl_dev->soc->total_layer;
> + for (i = 0; i < total_layer - 1; i++) {
> + overlay = kzalloc(sizeof(*overlay), GFP_KERNEL);
> + if (!overlay) {
> + DRM_DEBUG_KMS("Failed to allocate overlay plane\n");
> + goto out;
> + }
> +
> + ret = drm_universal_plane_init(dev, overlay, 1,
> + &fsl_dcu_drm_plane_funcs,
> + fsl_dcu_drm_plane_formats,
> + formats_size,
> + DRM_PLANE_TYPE_OVERLAY);
> + if (ret) {
> + kfree(overlay);
You basically allow to initialize only some layers, which is probably
fine. But I think we should add at least an error message here...
--
Stefan
> + goto out;
> + }
> + drm_plane_helper_add(overlay, &fsl_dcu_drm_plane_helper_funcs);
> + }
> +
> +out:
> return primary;
> }
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2015-12-03 1:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-01 8:16 [RESEND 2/3] drm :fsl-dcu: Cleanup vblank interrupt mask and status setting code Dongsheng Wang
2015-12-01 8:16 ` [RESEND 3/3] drm :fsl-dcu: Add multi layers support Dongsheng Wang
2015-12-03 1:38 ` Stefan Agner [this message]
2015-12-03 3:38 ` Wang Dongsheng
2015-12-03 1:56 ` [RESEND 2/3] drm :fsl-dcu: Cleanup vblank interrupt mask and status setting code Stefan Agner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5c68035c2a1498dd7a69ef88bf3a9594@agner.ch \
--to=stefan@agner.ch \
--cc=b56799@freescale.com \
--cc=dongsheng.wang@freescale.com \
--cc=dri-devel@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox