Re: [RFCv2 PATCH 01/14] vb2: introduce buf_prepare/finish_for_cpu

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

 



Hi Hans,

Thank you for the patch.

On Friday 12 September 2014 14:59:50 Hans Verkuil wrote:
> From: Hans Verkuil <hans.verkuil@xxxxxxxxx>
> 
> This splits the buf_prepare and buf_finish actions into two: one
> called while the cpu can still access the buffer contents, and one where
> the memory has been prepared for DMA and the cpu no longer can access it.

I don't think this applies to all drivers, or rather to all memory models. vb2 
vmalloc allows drivers to touch buffers that have been prepared, and USB 
drivers certainly expect that behaviour in order to copy the content of URBs 
to the buffer as they are received.

> Update a few drivers that use buf_finish where they really meant
> buf_finish_for_cpu.

I don't think this applies to the UVC driver. The buf_finish implementation 
doesn't touch the contents of the buffer.

> The reason for this split is that some drivers need to modify the buffer,
> either before or after the DMA has taken place, in order to e.g. add JPEG
> headers or do other touch ups.
> 
> You cannot do that in buf_prepare since at that time the buffer is already
> synced for DMA and the CPU shouldn't touch it. So add these extra ops to
> make this explicit.
> 
> Note that the dma-sg memory model doesn't sync the buffers yet in the memop
> prepare. This will change in future patches.
> 
> Signed-off-by: Hans Verkuil <hans.verkuil@xxxxxxxxx>
> ---
>  drivers/media/parport/bw-qcam.c              |  4 +--
>  drivers/media/pci/sta2x11/sta2x11_vip.c      |  4 +--
>  drivers/media/platform/vivid/vivid-vid-cap.c |  4 +--
>  drivers/media/usb/go7007/go7007-v4l2.c       |  4 +--
>  drivers/media/usb/pwc/pwc-if.c               |  4 +--
>  drivers/media/usb/uvc/uvc_queue.c            |  4 +--
>  drivers/media/v4l2-core/videobuf2-core.c     | 29 ++++++++++++-----
>  include/media/videobuf2-core.h               | 48 +++++++++++++++++++------
>  8 files changed, 72 insertions(+), 29 deletions(-)

-- 
Regards,

Laurent Pinchart

--
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