From: Mark Zhang <nvmarkzhang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Thierry Reding
<thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
Cc: Dave Airlie <airlied-cv59FeDIM0c@public.gmane.org>,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v3 2/7] drm/tegra: Add plane support
Date: Mon, 18 Feb 2013 14:06:56 +0800 [thread overview]
Message-ID: <5121C500.3000000@gmail.com> (raw)
In-Reply-To: <1360771506-17849-3-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
On 02/14/2013 12:05 AM, Thierry Reding wrote:
> Add support for the B and C planes which support RGB and YUV pixel
> formats and can be used as overlays or hardware cursor. Currently
> only 32-bit RGBA pixel formats are advertised.
>
> Signed-off-by: Thierry Reding <thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
[...]
> +static int tegra_dc_add_planes(struct drm_device *drm, struct tegra_dc *dc)
> +{
> + unsigned int i;
> + int err = 0;
> +
> + for (i = 0; i < 2; i++) {
> + struct tegra_plane *plane;
> +
> + plane = devm_kzalloc(drm->dev, sizeof(*plane), GFP_KERNEL);
Using "devm_kzalloc" here seems like not a good idea. Everytime plane
disable or crtc disable, we should free "struct tegra_plane" which is
allocated here. But the memory which devm_kzalloc allocates is only
freed when the driver detach. This makes lots of memory can't be
recycled when the plane enable/disable frequently.
> + if (!plane)
> + return -ENOMEM;
> +
> + plane->index = 1 + i;
> +
> + err = drm_plane_init(drm, &plane->base, 1 << dc->pipe,
> + &tegra_plane_funcs, plane_formats,
> + ARRAY_SIZE(plane_formats), false);
> + if (err < 0)
> + return err;
> + }
> +
> + return 0;
> +}
> +
> static const struct drm_crtc_funcs tegra_crtc_funcs = {
> .set_config = drm_crtc_helper_set_config,
> .destroy = drm_crtc_cleanup,
> };
>
> -static void tegra_crtc_dpms(struct drm_crtc *crtc, int mode)
> +static void tegra_crtc_disable(struct drm_crtc *crtc)
> {
> + struct drm_device *drm = crtc->dev;
> + struct drm_plane *plane;
> +
> + list_for_each_entry(plane, &drm->mode_config.plane_list, head) {
> + if (plane->crtc == crtc) {
> + tegra_plane_disable(plane);
> + plane->crtc = NULL;
> +
> + if (plane->fb) {
> + drm_framebuffer_unreference(plane->fb);
> + plane->fb = NULL;
> + }
> + }
> + }
If what I mentioned above(about using devm_kzalloc to allocate "struct
tegra_plane") is correct, we need to free "struct tegra_plane" here.
> }
>
> static bool tegra_crtc_mode_fixup(struct drm_crtc *crtc,
> @@ -46,10 +144,11 @@ static bool tegra_crtc_mode_fixup(struct drm_crtc *crtc,
> return true;
> }
>
[...]
>
next prev parent reply other threads:[~2013-02-18 6:06 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-13 16:04 [PATCH v3 0/7] drm/tegra: Miscellaneous enhancements Thierry Reding
[not found] ` <1360771506-17849-1-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2013-02-13 16:05 ` [PATCH v3 1/7] drm: Add consistency check for page-flipping Thierry Reding
[not found] ` <1360771506-17849-2-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2013-02-13 19:20 ` Daniel Vetter
2013-02-13 16:05 ` [PATCH v3 2/7] drm/tegra: Add plane support Thierry Reding
[not found] ` <1360771506-17849-3-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2013-02-18 6:06 ` Mark Zhang [this message]
[not found] ` <5121C500.3000000-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-02-18 6:40 ` Thierry Reding
[not found] ` <20130218064002.GA30856-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2013-02-18 6:55 ` Mark Zhang
[not found] ` <5121D048.6080202-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-02-18 7:01 ` Thierry Reding
[not found] ` <20130218070119.GA31132-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2013-02-18 7:12 ` Mark Zhang
2013-02-13 16:05 ` [PATCH v3 3/7] drm/tegra: Implement .mode_set_base() Thierry Reding
[not found] ` <1360771506-17849-4-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2013-02-18 6:17 ` Mark Zhang
[not found] ` <5121C791.3040903-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-02-18 6:28 ` Mark Zhang
2013-02-18 6:48 ` Thierry Reding
[not found] ` <20130218064832.GB30856-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2013-02-18 7:06 ` Mark Zhang
[not found] ` <5121D2E2.7080905-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-02-18 7:20 ` Thierry Reding
[not found] ` <20130218072057.GA31486-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2013-02-18 8:40 ` Mark Zhang
[not found] ` <5121E8EB.1050102-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-02-18 9:07 ` Mark Zhang
2013-02-13 16:05 ` [PATCH v3 4/7] drm/tegra: Implement VBLANK support Thierry Reding
2013-02-13 16:05 ` [PATCH v3 5/7] drm/tegra: Implement page-flipping support Thierry Reding
2013-02-13 16:05 ` [PATCH v3 6/7] drm/tegra: Split DC_CMD_STATE_CONTROL register write Thierry Reding
2013-02-13 16:05 ` [PATCH v3 7/7] drm/tegra: Add list of framebuffers to debugfs Thierry Reding
2013-02-18 7:42 ` [PATCH v3 0/7] drm/tegra: Miscellaneous enhancements Mark Zhang
[not found] ` <5121DB6F.60503-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-02-18 7:48 ` Thierry Reding
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=5121C500.3000000@gmail.com \
--to=nvmarkzhang-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=airlied-cv59FeDIM0c@public.gmane.org \
--cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.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;
as well as URLs for NNTP newsgroup(s).