lkml.org 
[lkml]   [2020]   [Jan]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC][PATCH 13/15] videobuf2: do not sync buffers for DMABUF queues
From
Date
On 12/17/19 4:20 AM, Sergey Senozhatsky wrote:
> DMA-exporter is supposed to handle cache syncs, so we can
> avoid ->prepare()/->finish() syncs from videobuf2 core for
> DMABUF buffers.
>
> Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
> ---
> drivers/media/common/videobuf2/videobuf2-v4l2.c | 16 +++++++++++++++-
> 1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/common/videobuf2/videobuf2-v4l2.c b/drivers/media/common/videobuf2/videobuf2-v4l2.c
> index 1762849288ae..2b9d3318e6fb 100644
> --- a/drivers/media/common/videobuf2/videobuf2-v4l2.c
> +++ b/drivers/media/common/videobuf2/videobuf2-v4l2.c
> @@ -341,8 +341,22 @@ static void set_buffer_cache_hints(struct vb2_queue *q,
> struct vb2_buffer *vb,
> struct v4l2_buffer *b)
> {
> - vb->need_cache_sync_on_prepare = 1;
> + /*
> + * DMA exporter should take care of cache syncs, so we can avoid
> + * explicit ->prepare()/->finish() syncs.
> + */
> + if (q->memory == VB2_MEMORY_DMABUF) {
> + vb->need_cache_sync_on_finish = 0;
> + vb->need_cache_sync_on_prepare = 0;
> + return;
> + }
>
> + /*
> + * For other ->memory types we always need ->prepare() cache
> + * sync. ->finish() cache sync, however, can be avoided when queue
> + * direction is TO_DEVICE.
> + */
> + vb->need_cache_sync_on_prepare = 1;

I'm trying to remember: what needs to be done in prepare()
for a capture buffer? I thought that for capture you only
needed to invalidate the cache in finish(), but nothing needs
to be done in the prepare().

Regards,

Hans

> if (q->dma_dir != DMA_TO_DEVICE)
> vb->need_cache_sync_on_finish = 1;
> else
>

\
 
 \ /
  Last update: 2020-01-10 11:31    [W:0.198 / U:0.400 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site