Re: dma start/stop & vb2 APIs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 19, 2016 at 9:33 AM, Hans Verkuil <hverkuil@xxxxxxxxx> wrote:
> On 01/19/2016 05:45 AM, Ran Shalit wrote:
>> On Mon, Jan 18, 2016 at 7:45 PM, Hans Verkuil <hverkuil@xxxxxxxxx> wrote:
>>> On 01/18/2016 05:26 PM, Ran Shalit wrote:
>>>> 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
>>>
>>> No. DMA typically starts when VIDIOC_STREAMON is called, although depending
>>> on the hardware the start of the DMA may be delayed if insufficient buffers
>>> have been queued. When the start_streaming op is called you know that STREAMON
>>> has been called and that at least min_buffers_needed buffers have been queued.
>>>
>>>> 2. interrupt handler in driver - stop dma
>>>
>>> ??? No, this just passes the buffer that has been filled by the DMA engine
>>> to vb2 via vb2_buffer_done. The DMA will continue filling the next queued buffer.
>>>
>>
>> Hi,
>> Just to be sure I got it all right:
>> "The DMA will continue filling the next queued buffer" is usually the
>> responsibility of the interrupt handler .
>> Interrrupt will get the new buffer from list and trigger next dma
>> transaction with that buffer.
>>  Is that Right ?
>
> Usually that's true. Again, I can't give absolutes because it depends on
> the DMA hardware details. There tend to be two main types of DMA:
>
> 1) the DMA engine has pointers to the current and next frame: in that case
> the irq handler has to update the pointers once the current frame finishes
> the DMA.
>
> 2) the DMA engine has a list of descriptors describing each frame and that
> links each frame to the next one. In that case the list of descriptors is
> updated whenever a new buffer is queued. For engines like this the interrupt
> function just returns the DMAed buffer and doesn't have to do anything else.
>

Hi,

Is the first dma engine type above is usually used with contigous dma
(videobuf2-dma-contig.h), while
the second type referese to sg (scatter-gather) mode (videobuf2-dma-sg.h ) ?

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



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux