Re: [RFC][PATCHv2 03/12] videobuf2: add V4L2_FLAG_MEMORY_NON_CONSISTENT flag

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On (20/02/19 09:56), Hans Verkuil wrote:
> > +Memory Consistency Flags
> > +========================
> > +
> > +.. tabularcolumns:: |p{7.0cm}|p{2.2cm}|p{8.3cm}|
> > +
> > +.. cssclass:: longtable
> > +
> > +.. flat-table::
> > +    :header-rows:  0
> > +    :stub-columns: 0
> > +    :widths:       3 1 4
> > +
> > +    * .. _`V4L2_FLAG_MEMORY_NON_CONSISTENT`:
> > +
> > +      - ``V4L2_FLAG_MEMORY_NON_CONSISTENT``
> > +      - 0x00000001
> > +      - vb2 buffer is allocated either in consistent (it will be automatically
> > +	coherent between CPU and bus) or non-consistent memory. The latter
> > +	can provide performance gains, for instance CPU cache sync/flush
> > +	operations can be avoided if the buffer is accesed by the corresponding
> > +	device only and CPU does not read/write to/from that buffer. However,
> > +	this requires extra care from the driver -- it must guarantee memory
> > +	consistency by issuing cache flush/sync when consistency is needed.
> > +	If this flag is set V4L2 will attempt to allocate vb2 buffer in
> > +	non-consistent memory. This flag is ignored if queue does not report
> > +        :ret:`V4L2_BUF_CAP_SUPPORTS_CACHE_HINTS` capability.
> 
> This flag only makes sense for the MMAP memory model, right? That should be
> documented and checked in the code.

Not all buffer allocators respect DMA attrs (V4L2_FLAG_MEMORY_NON_CONSISTENT
is a DMA attribute) even if we use MMAP memory model. Right? E.g. dma-cont
does, dma-sg - does not.

So the list is:

  a) buffer allocated for MMAP I/O
  b) buffer allocator which does not allocate pages from kernel page
     allocator
  c) queue that supports user space cache hints

If the driver does not set vb2_dma_contig_memops as q->mem_ops then
that queue should not have ->allow_cache_hints set. But even if it does,
the flag is ignored by the allocator.

So maybe the text can be:

+       ................... The flag takes effect only if the buffer is
+       used for :ref:`memory mapping <mmap>` I/O and the queue reports
+       :ref:`V4L2_BUF_CAP_SUPPORTS_CACHE_HINTS` capability.

	-ss



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux