[PATCH 1/3] media: v4l2: Add V4L2_EVENT_BUF_PROGRESS to report progress of capture
Siddharth Vadapalli
s-vadapalli at ti.com
Mon Nov 30 21:26:04 PST 2026
On 11/30/26 8:51 PM, Nicolas Dufresne wrote:
> Hi,
>
> Le dimanche 29 novembre 2026 à 18:58 +0530, Siddharth Vadapalli a écrit :
>> + The buffer remains owned by the driver until it is dequeued, and the
>> + driver does not perform any cache maintenance on the part of the
>> + buffer that was reported. An application that reads that part before
>> + the buffer is dequeued must make sure that its mapping is coherent
>> + with DMA, which is not the case for memory allocated with
>> + ``V4L2_MEMORY_FLAG_NON_COHERENT``. For buffers with memory type
>> + ``V4L2_MEMORY_DMABUF``, cache management is the responsibility of
>> + the exporter of the buffer.
>
>
> I think outside of write-combine, which you likely use, this is completely
> unusable. Its not possible to do device cache management properly without the
> context the driver has.
The limitation has been documented to warn users. While I agree that
'write-combine' (pgprot_writecombine / pgprot_dmacoherent mapping on ARM64)
is one scenario where this is usable, there is another scenario as well
where it is usable => Hardware-Managed Coherence.
On the J784S4 SoC from TI, the MSMC (Multicore Shared Memory
Controller) guarantees Coherence between DMA transactions and the ARM
Cortex-A Cores running Linux. So a partial frame transfer to RAM (System
Memory) by DMA will also be kept in-sync with the Cortex-A Cores' view of
memory without the need for explicit cache-management.
>
> May I propose for the event to deliver a dma fence. Then the driver that do use
I believe that a DMA Fence defeats the purpose here given that the
objective is to reduce the latency. Adding DMA Fence for sub-frames will
add a latency overhead and at that point we don't get a real benefit with
sub-frames anymore.
> device caches can spawn a worker that will signal the fence when the memory is
> actually ready. On top of which, you can deliver the fence once the transfer is
> proven to have started, rather then when its complet. Sub-frame, unless you only
> care about really slow devices, introduce very tight timing which only dma
> fences will really cover.
On platforms where sub-frames work without DMA Fences (Hardware-Managed
Coherence or ARM64 pgprot_dmacoherent mapping), I assume that the latency
advantage is noticeable (as documented in the cover-letter). The usage of
DMA Fences will cover other platforms as well, but that would defeat the
purpose of sub-frames due to higher latency. Hence, a limited support for
sub-frames looks better despite not being supported on all platforms.
Kindly let me know what you think regarding this and please correct me in
case I have misunderstood your proposition for the usage of DMA Fences. I
look forward to your feedback.
Regards,
Siddharth.
More information about the linux-arm-kernel
mailing list