public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* dma start/stop & vb2 APIs
@ 2016-01-18 16:26 Ran Shalit
  2016-01-18 17:45 ` Hans Verkuil
  0 siblings, 1 reply; 6+ messages in thread
From: Ran Shalit @ 2016-01-18 16:26 UTC (permalink / raw)
  To: linux-media

Hello,

I am trying to understand how to implement dma transfer correctly
using videobuf2 APIs.

Normally, application will do semthing like this (video test API):

                xioctl(fd, VIDIOC_DQBUF, &buf)
                process_image(buffers[buf.index].start, buf.bytesused);
                xioctl(fd, VIDIOC_QBUF, &buf)

Therefore, in the driver below I will assume that:
1. VIDIOC_DQBUF -  trigger dma to start
2. interrupt handler in driver - stop dma
3. VIDIOC_QBUF - do nothing with dma.

But, on code review of the following two drivers, I see other things,
much more complex, and I don't understand it yet.

These are the two drivers I reviewed:
- STA2X11
- dt3511

In STA2X11 I see:

1. start_streaming - also triggers dma to start, why ?
2. buf_queue - add buffer to list & if No active buffer, active the
first one , and trigger dma. why do we trigger dma with buf_queue (I
would assume triggering is done with  VIDIOC_DQBUF -> buffer_finish) ?
3. buf_finish - remove buffer from list, but also get the next buffer
in list and trigger dma, why  do we need to trigger a next buffer ?
Isn't buffer_finish is called as a result of VIDIOC_QBUF ?


In dt3511 I see something else as following:
buf_queue()
{...
if (pd->curr_buf)
list_add_tail(&vb->done_entry, &pd->dmaq);
else {
pd->curr_buf = vb;
elbit_start_acq(pd);
}
...}

1. Again, why dma triggering is done as part of  buf_queue instead buf_finish
2. what's the meaning of the condition in this code, it is as if only
the first buffer in buf_queue i striggered, what about the next
ones,why do they only get into list without triggering dma ?
3. In this driver there is no buf_finish.

Thank you for any comments,
Ran

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-01-30 12:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-18 16:26 dma start/stop & vb2 APIs Ran Shalit
2016-01-18 17:45 ` Hans Verkuil
2016-01-19  4:45   ` Ran Shalit
2016-01-19  7:33     ` Hans Verkuil
2016-01-30 11:55       ` Ran Shalit
2016-01-30 12:26         ` Hans Verkuil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox