linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: snjw23@gmail.com (Sylwester Nawrocki)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH v1 6/7] media: video: introduce face detection driver module
Date: Sun, 11 Dec 2011 19:38:14 +0100	[thread overview]
Message-ID: <4EE4F896.3080406@gmail.com> (raw)
In-Reply-To: <1322838172-11149-7-git-send-email-ming.lei@canonical.com>

Hi Ming,

On 12/02/2011 04:02 PM, Ming Lei wrote:
> This patch introduces one driver for face detection purpose.
> 
> The driver is responsible for all v4l2 stuff, buffer management
> and other general things, and doesn't touch face detection hardware
> directly. Several interfaces are exported to low level drivers
> (such as the coming omap4 FD driver)which will communicate with
> face detection hw module.
> 
> So the driver will make driving face detection hw modules more
> easy.
> 
> TODO:
> 	- implement FD setting interfaces with v4l2 controls or
> 	ext controls
> 
> Signed-off-by: Ming Lei <ming.lei@canonical.com>
> ---
...
> +static int vidioc_g_fd_result(struct file *file, void *priv,
> +					struct v4l2_fd_result *f)
> +{
> +	struct fdif_dev *dev = video_drvdata(file);
> +	unsigned long flags;
> +	struct v4l2_fdif_result *tmp;
> +	struct v4l2_fdif_result *fr = NULL;
> +	unsigned int cnt = 0;
> +	int ret = -EINVAL;
> +
> +	spin_lock_irqsave(&dev->lock, flags);
> +	list_for_each_entry(tmp, &dev->fdif_dq.complete, list)
> +		if (tmp->index == f->buf_index) {
> +			fr = tmp;
> +			list_del(&tmp->list);
> +			break;
> +		}
> +	spin_unlock_irqrestore(&dev->lock, flags);
> +
> +	if (fr) {
> +		ret = 0;
> +		cnt = min(f->face_cnt, fr->face_cnt);
> +		if (cnt)
> +			memcpy(f->fd, fr->faces,
> +				sizeof(struct v4l2_fd_detection) * cnt);
> +		f->face_cnt = cnt;
> +		kfree(fr->faces);
> +		kfree(fr);

struct v4l2_fdif_result is allocated in HW driver at the time when FD result
is read out and it is freed in generic module here. Not sure if it is a good
practice to split memory management like this. Also IMHO it would be much
better to pre-allocate memory for FD output data, according to maximum number
of detected faces per frame. It could be more reliable than allocating memory
in interrupt context per each frame.


> +	}
> +	return ret;
> +}

--
Regards,
Sylwester

  parent reply	other threads:[~2011-12-11 18:38 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-02 15:02 [RFC PATCH v1 0/7] media&omap4: introduce face detection(FD) driver Ming Lei
2011-12-02 15:02 ` [RFC PATCH v1 1/7] omap4: introduce fdif(face detect module) hwmod Ming Lei
2011-12-02 15:02 ` [RFC PATCH v1 2/7] omap4: build fdif omap device from hwmod Ming Lei
2011-12-02 16:28   ` Aguirre, Sergio
2011-12-05  4:27     ` Ming Lei
2011-12-02 15:02 ` [RFC PATCH v1 3/7] media: videobuf2: move out of setting pgprot_noncached from vb2_mmap_pfn_range Ming Lei
2011-12-02 15:02 ` [RFC PATCH v1 4/7] media: videobuf2: introduce VIDEOBUF2_PAGE memops Ming Lei
2011-12-02 15:02 ` [RFC PATCH v1 5/7] media: v4l2: introduce two IOCTLs for face detection Ming Lei
2011-12-05 22:15   ` Sylwester Nawrocki
2011-12-08  3:42     ` Ming Lei
2011-12-08 22:27       ` Sylwester Nawrocki
2011-12-09  4:34         ` Ming Lei
2011-12-11 17:27           ` Sylwester Nawrocki
2011-12-02 15:02 ` [RFC PATCH v1 6/7] media: video: introduce face detection driver module Ming Lei
2011-12-05 21:55   ` Sylwester Nawrocki
2011-12-06 14:07     ` Ming Lei
2011-12-06 22:01       ` Sylwester Nawrocki
2011-12-06 22:39         ` Sylwester Nawrocki
2011-12-07 13:40         ` Ming Lei
2011-12-08 23:25           ` Sylwester Nawrocki
2011-12-09 15:10             ` Ming Lei
2011-12-11 17:43               ` Sylwester Nawrocki
2011-12-12  9:49                 ` Ming Lei
2011-12-12 12:08                   ` HeungJun, Kim
2011-12-13  4:01                     ` Ming Lei
2011-12-13  5:59                       ` HeungJun, Kim
2011-12-13  6:29                         ` Ming Lei
2011-12-12 21:57                   ` Sylwester Nawrocki
2011-12-11 18:38   ` Sylwester Nawrocki [this message]
2011-12-02 15:02 ` [RFC PATCH v1 7/7] media: video: introduce omap4 face detection module driver Ming Lei
  -- strict thread matches above, loose matches on Subject: below --
2011-12-02  9:12 [RFC PATCH v1 0/7] media&omap4: introduce face detection(FD) driver Ming Lei
2011-12-02  9:12 ` [RFC PATCH v1 6/7] media: video: introduce face detection driver module Ming Lei

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=4EE4F896.3080406@gmail.com \
    --to=snjw23@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.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).