linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: "Richard Röjfors" <richard.rojfors@pelagicore.com>
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Douglas Schilling Landgraf <dougsland@gmail.com>,
	Samuel Ortiz <sameo@linux.intel.com>,
	"Williams, Dan J" <dan.j.williams@intel.com>
Subject: Re: [PATCH 1/2] media: Add timberdale video-in driver
Date: Sun, 25 Apr 2010 12:24:33 -0300	[thread overview]
Message-ID: <4BD45EB1.5020804@redhat.com> (raw)
In-Reply-To: <1271435291.11641.45.camel@debian>

Richard Röjfors wrote:
> This patch adds the timberdale video-in driver.
> 
> The video IP of timberdale delivers the video data via DMA.
> The driver uses the DMA api to handle DMA transfers, and make use
> of the V4L2 videobuffers to handle buffers against user space.
> Due to some timing constraint it makes sense to do DMA into an
> intermediate buffer and then copy the data to vmalloc:ed buffers.
> 
> If available the driver uses an encoder to get/set the video standard
> 
> Signed-off-by: Richard Röjfors <richard.rojfors@pelagicore.com>
> +#define TIMBLOGIW_DMA_BUFFER_SIZE	(TIMBLOGIW_BYTES_PER_LINE * 576)

...

> +static int __timblogiw_alloc_dma(struct timblogiw_fh *fh, struct device *dev)
> +{
> +	dma_addr_t addr;
> +	int err, i, pos;
> +	int bytes_per_desc = TIMBLOGIW_LINES_PER_DESC *
> +		timblogiw_bytes_per_line(fh->cur_norm);
> +
> +	fh->dma.cookie = -1;
> +	fh->dma.dev = dev;
> +
> +	fh->dma.buf = kzalloc(TIMBLOGIW_DMA_BUFFER_SIZE, GFP_KERNEL);
> +	if (!fh->dma.buf)
> +		return -ENOMEM;


Why do you need a fixed DMA buffer size? Just allocate the buffer size dynamically at
buffer_prepare callback.
> +	videobuf_queue_vmalloc_init(&fh->vb_vidq, &timblogiw_video_qops,
> +			NULL, &fh->queue_lock, V4L2_BUF_TYPE_VIDEO_CAPTURE,
> +			V4L2_FIELD_NONE, sizeof(struct videobuf_buffer), fh);

You should be using, instead, videobuf_dma_sg or videobuf_cont, instead of
using videobuf-vmalloc. This way, you'll avoid double buffering.

-- 

Cheers,
Mauro

  reply	other threads:[~2010-04-25 15:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-16 16:28 [PATCH 1/2] media: Add timberdale video-in driver Richard Röjfors
2010-04-25 15:24 ` Mauro Carvalho Chehab [this message]
2010-04-25 16:01   ` Richard Röjfors
2010-04-25 16:13     ` Mauro Carvalho Chehab
2010-05-26 14:19       ` Richard Röjfors
2010-06-22 17:33         ` Richard Röjfors

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=4BD45EB1.5020804@redhat.com \
    --to=mchehab@redhat.com \
    --cc=dan.j.williams@intel.com \
    --cc=dougsland@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=richard.rojfors@pelagicore.com \
    --cc=sameo@linux.intel.com \
    /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).