[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAFQd5Dx50nt=yOCj-ufDDey=Zur_F5yE34a9OQP630A1opBSQ@mail.gmail.com>
Date: Tue, 28 Jan 2020 16:22:16 +0900
From: Tomasz Figa <tfiga@...omium.org>
To: Sergey Senozhatsky <senozhatsky@...omium.org>
Cc: Hans Verkuil <hverkuil@...all.nl>,
Hans Verkuil <hans.verkuil@...co.com>,
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 Mailing List <linux-media@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [RFC][PATCH 13/15] videobuf2: do not sync buffers for DMABUF queues
On Fri, Jan 24, 2020 at 4:32 PM Sergey Senozhatsky
<senozhatsky@...omium.org> wrote:
>
> On (20/01/24 11:25), Sergey Senozhatsky wrote:
> [..]
> >
> > > Then, if q->allow_cache_hint is set, then default to a cache sync (cache clean)
> > > in the prepare for OUTPUT buffers and a cache sync (cache invalidate) in the
> > > finish for CAPTURE buffers.
> >
> > We alter default cache sync behaviour based both on queue ->memory
> > type and queue ->dma_dir. Shall both of those cases depend on
> > ->allow_cache_hints, or q->memory can be independent?
> >
> > static void set_buffer_cache_hints(struct vb2_queue *q,
> > struct vb2_buffer *vb,
> > struct v4l2_buffer *b)
> > {
> > if (!q->allow_cache_hints)
> > return;
> >
> > /*
> > * DMA exporter should take care of cache syncs, so we can avoid
> > * explicit ->prepare()/->finish() syncs. For other ->memory types
> > * we always need ->prepare() or/and ->finish() cache sync.
> > */
> > if (q->memory == VB2_MEMORY_DMABUF) {
> > vb->need_cache_sync_on_finish = 0;
> > vb->need_cache_sync_on_prepare = 0;
> > return;
> > }
>
> I personally would prefer this to be above ->allow_cache_hints check,
> IOW to be independent. Because we need to skip flush/invalidation for
> DMABUF anyway, that's what allocators do in ->prepare() and ->finish()
> currently.
I think it's even more than personal preference. We shouldn't even
attempt to sync imported DMA-bufs, so the code above may result in
incorrect behavior.
Powered by blists - more mailing lists