[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200122013937.GC149602@google.com>
Date: Wed, 22 Jan 2020 10:39:37 +0900
From: Sergey Senozhatsky <senozhatsky@...omium.org>
To: Hans Verkuil <hverkuil@...all.nl>
Cc: Sergey Senozhatsky <senozhatsky@...omium.org>,
Hans Verkuil <hans.verkuil@...co.com>,
Tomasz Figa <tfiga@...omium.org>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Kyungmin Park <kyungmin.park@...sung.com>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Sakari Ailus <sakari.ailus@....fi>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Pawel Osciak <posciak@...omium.org>,
linux-media@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC][PATCH 02/15] videobuf2: handle V4L2 buffer cache flags
Hi,
Sorry for the delayed.
On (20/01/10 11:24), Hans Verkuil wrote:
> On 12/17/19 4:20 AM, Sergey Senozhatsky wrote:
> > Set video buffer cache management flags corresponding to V4L2 cache
> > flags.
> >
> > Both ->prepare() and ->finish() cache management hints should be
> > passed during this stage (buffer preparation), because there is no
> > other way for user-space to skip ->finish() cache flush.
> >
> > There are two possible alternative approaches:
> > - The first one is to move cache sync from ->finish() to dqbuf().
> > But this breaks some drivers, that need to fix-up buffers before
> > dequeueing them.
> >
> > - The second one is to move ->finish() call from ->done() to dqbuf.
>
> Please combine this patch with patch 13/15!
OK.
[..]
> > }
> >
> > +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;
> > +
> > + if (q->dma_dir != DMA_TO_DEVICE)
>
> What should be done when dma_dir == DMA_BIDIRECTIONAL?
Well, ->need_cache_sync_on_prepare/->need_cache_sync_on_finish are set,
by default. If the queue supports user-space cache hints (driver has
set ->allow_cache_hints), then user-space can override cache behavior.
We probably cannot enforce any other behavior here. Am I missing
something?
> > + vb->need_cache_sync_on_finish = 1;
> > + else
> > + vb->need_cache_sync_on_finish = 0;
> > +
> > + if (!q->allow_cache_hints)
> > + return;
> > +
> > + if (b->flags & V4L2_BUF_FLAG_NO_CACHE_INVALIDATE)
> > + vb->need_cache_sync_on_finish = 0;
> > +
> > + if (b->flags & V4L2_BUF_FLAG_NO_CACHE_CLEAN)
> > + vb->need_cache_sync_on_prepare = 0;
> > +}
-ss
Powered by blists - more mailing lists