public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Ran Shalit <ranshalit@gmail.com>, linux-media@vger.kernel.org
Subject: Re: cobalt & dma
Date: Tue, 17 Nov 2015 08:53:40 +0100	[thread overview]
Message-ID: <564ADD04.90700@xs4all.nl> (raw)
In-Reply-To: <CAJ2oMhLN1T5GL3OhdcOLpK=t74NpULTz4ezu=fZDOEaXYVoWdg@mail.gmail.com>

On 11/17/2015 08:39 AM, Ran Shalit wrote:
> Hello,
> 
> I intend to use cobalt driver as a refence for new pci v4l2 driver,
> which is required to use several input simultaneously. for this cobalt
> seems like a best starting point.
> read/write streaming will probably be suffecient (at least for the
> dirst debugging).
> The configuration in my cast is i7 core <-- pci ---> fpga.
> I see that the dma implementation is quite complex, and would like to
> ask for some tips regarding the following points related to dma issue:
> 
> 1. Is it possible to do the read/write without dma (for debug as start) ?

No. All video capture/output devices all use DMA since it would be prohibitively
expensive for the CPU to do otherwise. So just dig in and implement it.

> What changes are required for read without dma (I assume dma is used
> by default in read/write) ?
> Is it done by using  #include <media/videobuf2-vmalloc.h> instead of
> #include <media/videobuf2-dma*> ?

No. The vmalloc variant is typically used for USB devices. For PCI(e) you'll
use videobuf2-dma-contig if the DMA engine requires physically contiguous DMA,
or videobuf2-dma-sg if the DMA engine supports scatter-gather DMA. You can
start with dma-contig since the DMA code tends to be simpler, but it is
harder to get the required physically contiguous memory if memory fragmentation
takes place. So you may not be able to allocate the buffers. dma-sg works much
better with virtual memory.

> 
> 2. I find it difficult to unerstand  cobalt_dma_start_streaming()
> implementation, which has many specific cobalt memory writing
> iowrite32().
> How can I understand how/what to implement dma in my specific platform/device ?

Read include/media/videobuf2-core.h.

There is also an LWN article somewhere (albeit somewhat outdated by now).

Don't expect to write three lines of code and everything works. You *do*
have to write the code for your DMA hardware, there is no way around that.

Regards,

	Hans

> 
> 
> Best Regards,
> Ran
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


  reply	other threads:[~2015-11-17  7:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-17  7:39 cobalt & dma Ran Shalit
2015-11-17  7:53 ` Hans Verkuil [this message]
2015-11-17 13:15   ` Ran Shalit
2015-11-17 13:32     ` Steven Toth
2015-11-17 13:54     ` Hans Verkuil
2015-11-17 21:43       ` Ran Shalit
2015-11-20 14:49   ` Ran Shalit
2015-11-20 14:55     ` Hans Verkuil
2015-11-20 16:14       ` Ran Shalit
2015-11-20 16:25         ` Hans Verkuil

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=564ADD04.90700@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    --cc=ranshalit@gmail.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