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