linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 15:12:20 +0800	[thread overview]
Message-ID: <5121D454.9000305@gmail.com> (raw)
In-Reply-To: <20130218070119.GA31132-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>

On 02/18/2013 03:01 PM, Thierry Reding wrote:
> On Mon, Feb 18, 2013 at 02:55:04PM +0800, Mark Zhang wrote:
>> On 02/18/2013 02:40 PM, Thierry Reding wrote:
>>> On Mon, Feb 18, 2013 at 02:06:56PM +0800, Mark Zhang wrote:
>>>> 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.
>>>
>>> Why would we want to do that? I don't think doing so would even work,
>>> since the planes are resources that need to be registered with the DRM
>>> core and therefore can't be allocated on-demand.
>>>
>>
>> I'm wondering if we add power management codes in the future, the
>> crtc/plane will be disabled/enabled frequently, e.g: system going to
>> suspend state then resume.
> 
> In that case it makes even less sense to allocate and deallocate the
> plane every time around. However, any optimizations aside, the allocated
> memory is passed into the core via drm_plane_init(), which registers
> that plane with the given CRTC. So if we deallocate the memory when the
> plane when it is disabled, we'd have to make sure to remove it from the
> core as well. However that would also mean that it disappears from the
> list of planes supported by the CRTC and therefore we wouldn't be able
> to use it again.
> 

Alright, I mixed up the "disable" & "remove" of planes and crtcs. You're
right. Just forget what I said in this thread.

Mark
> Thierry
> 

  parent reply	other threads:[~2013-02-18  7:12 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
     [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 [this message]
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=5121D454.9000305@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).