All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adam Wozniak <awozniak@irobot.com>
To: linux-omap@vger.kernel.org
Subject: SDMA, V4L2, and videobuf-dma-sg
Date: Mon, 02 Aug 2010 10:54:28 -0700	[thread overview]
Message-ID: <4C570654.3050006@irobot.com> (raw)

Hello,

I'm working with an OMAP3530 based custom board.  The board has 4 
cameras attached to it, using the drivers/media/video/omap34xxcam.c and 
.../ov3640.c and .../isp/isp*.c drivers.  We've modified these drivers 
slightly so we can mux an I2C bus to talk to each different camera.  
When we want to use a specific camera, we tri-state all the other 
cameras and enable the one we want.  This works well, and we can get 
images from all 4 cameras.

Now we'd like to take all 4 cameras and collage their images together to 
produce a single stream showing all 4 images in each frame.  I've 
allocated a global frame buffer using kmalloc( ...,GFP_DMA).  There's 
just one of those, and we create it at the beginning of time and keep it 
around forever.  We also dma_map_single() it so we can DMA to it.  The 
idea being that, as each frame comes by, we want to use SDMA to copy it 
at a reduced resolution into the correct quadrant of the global buffer, 
then SDMA back from the global buffer into our frame.

So far in testing I think I have a good handle on the SDMA part.  If I 
kmalloc() a second buffer, I can SDMA back and forth, and I've got all 
the SDMA settings correct to do what I want (verified by putting known 
values in buffers and checking before vs after).  Now I just need a 
pointer suitable for SDMA I can use for the real frames when they come 
by.  In other words, I need to know the value to fill in an 
omap_dma_channel_params.src_start for my first call to 
omap_set_dma_params().

So how do I do this?  I've hooked my new code in right before the call 
to isp_buf->complete so I can do my thing there.  So I have access to an 
isp_buf and the videobuf_buffer contained therein.

The problem I'm running into (I think) is that omap34xxcam.c uses 
videobuf-dma-sg to do its allocation and the videobuf_buffer I get is 
using a scatterlist, and the pages in the scatterlist are 
noncontiguous.  In other words, if I use videobuf_to_dma(vb), the 
videobuf_dmabuf I get back has a vmalloc of null and a bus_addr of null; 
only the scatterlist and pages fields have valid values.  There's no 
contiguous memory pointer I can grab onto there.

How do I get a pointer suitable for SDMA?  Will anything map this 
scatterlist so it looks contiguous for SDMA?

I've tried changing omap34xxcam.c to use videobuf-dma-contig but that 
didn't "just work" so I abandoned that line of investigation.

I've tried using dma_map_single on vb->map->start as well as 
ispbuf->isp_addr, and several variations on that theme, without success.

I feel like I'm missing some fundamental piece of understanding, and I'm 
hoping there's a magic call or two that will cure all my woes.

The only alternative I can come up with is to double my global buffer 
size and take my nice two step process and break it into three phases, 
(1) walk the scatterlist to SDMA from each page into the first half of 
the global buffer, (2) SDMA from the first half of the global buffer 
into the second half and finally (3) walk the scatterlist again, SDMAing 
from the second half of the global buffer into each page in the 
scatterlist.  This seems ugly and messy and I feel there must be some 
other way!

Any help is appreciated.

--Adam

             reply	other threads:[~2010-08-02 18:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-02 17:54 Adam Wozniak [this message]
2010-08-04 21:59 ` SDMA, V4L2, and videobuf-dma-sg John Faith

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=4C570654.3050006@irobot.com \
    --to=awozniak@irobot.com \
    --cc=linux-omap@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.