linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: linux-media@vger.kernel.org, pawel@osciak.com,
	m.szyprowski@samsung.com, Hans Verkuil <hans.verkuil@cisco.com>
Subject: Re: [RFCv2 PATCH 01/14] vb2: introduce buf_prepare/finish_for_cpu
Date: Sat, 13 Sep 2014 00:25:36 +0300	[thread overview]
Message-ID: <4342247.xaaAE16GTC@avalon> (raw)
In-Reply-To: <1410526803-25887-2-git-send-email-hverkuil@xs4all.nl>

Hi Hans,

Thank you for the patch.

On Friday 12 September 2014 14:59:50 Hans Verkuil wrote:
> From: Hans Verkuil <hans.verkuil@cisco.com>
> 
> 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@cisco.com>
> ---
>  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


  reply	other threads:[~2014-09-12 21:25 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-12 12:59 [RFCv2 PATCH 00/14] vb2: improve dma-sg, expbuf Hans Verkuil
2014-09-12 12:59 ` [RFCv2 PATCH 01/14] vb2: introduce buf_prepare/finish_for_cpu Hans Verkuil
2014-09-12 21:25   ` Laurent Pinchart [this message]
2014-09-12 12:59 ` [RFCv2 PATCH 02/14] vb2-dma-sg: add allocation context to dma-sg Hans Verkuil
2014-09-12 21:49   ` Laurent Pinchart
2014-09-14  3:29   ` Pawel Osciak
2014-09-12 12:59 ` [RFCv2 PATCH 03/14] vb2-dma-sg: add prepare/finish memops Hans Verkuil
2014-09-12 21:54   ` Laurent Pinchart
2014-09-14  3:40   ` Pawel Osciak
2014-09-12 12:59 ` [RFCv2 PATCH 04/14] vb2: memop prepare: return errors Hans Verkuil
2014-09-12 12:59 ` [RFCv2 PATCH 05/14] vb2: call memop prepare before the buf_prepare op is called Hans Verkuil
2014-09-12 12:59 ` [RFCv2 PATCH 06/14] vb2-dma-sg: add dmabuf import support Hans Verkuil
2014-09-14  8:11   ` Laurent Pinchart
2014-09-12 12:59 ` [RFCv2 PATCH 07/14] vb2-dma-sg: add get_dmabuf Hans Verkuil
2014-09-12 12:59 ` [RFCv2 PATCH 08/14] vb2-vmalloc: add get_dmabuf support Hans Verkuil
2014-09-12 12:59 ` [RFCv2 PATCH 09/14] vb2: replace 'write' by 'dma_dir' Hans Verkuil
2014-09-12 22:02   ` Laurent Pinchart
2014-09-12 12:59 ` [RFCv2 PATCH 10/14] vb2: add 'new_cookies' flag Hans Verkuil
2014-09-14  7:02   ` Pawel Osciak
2014-09-12 13:00 ` [RFCv2 PATCH 11/14] tw68: only reprogram DMA engine when necessary Hans Verkuil
2014-09-12 13:00 ` [RFCv2 PATCH 12/14] cx23885: " Hans Verkuil
2014-09-12 13:00 ` [RFCv2 PATCH 13/14] saa7134: don't rebuild the page table unless new_cookies is set Hans Verkuil
2014-09-12 13:00 ` [RFCv2 PATCH 14/14] vivid: enable vb2_expbuf support 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=4342247.xaaAE16GTC@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=hans.verkuil@cisco.com \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=pawel@osciak.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;
as well as URLs for NNTP newsgroup(s).