From: Karl Mehltretter <kmehltretter@gmail.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: "Tomasz Figa" <tfiga@chromium.org>,
"Marek Szyprowski" <m.szyprowski@samsung.com>,
"Hans de Goede" <hansg@kernel.org>,
"Hans Verkuil" <hverkuil@kernel.org>,
"Mauro Carvalho Chehab" <mchehab@kernel.org>,
"Christian König" <christian.koenig@amd.com>,
"Nicolas Dufresne" <nicolas@ndufresne.ca>,
"Sumit Semwal" <sumit.semwal@linaro.org>,
linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org,
linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 0/3] media: synchronize CPU access to imported DMA-BUFs
Date: Thu, 12 Nov 2026 04:16:19 +0100 [thread overview]
Message-ID: <avUvHGb4talXW7qS@gmail.com> (raw)
In-Reply-To: <20261107105946.GA96745@killaraus.ideasonboard.com>
On Sat, Nov 07, 2026 at 12:59:46PM +0100, Laurent Pinchart wrote:
> Hi Karl,
>
> We discussed in v1 how this is not the right approach. Why are you
> posting a v2 without addressing that ? You need to go back to the design
> table.
>
v1 ended with two conflicting positions on non-coherent DMA-BUFs:
- Laurent [1] and Nicolas [2]: end_cpu_access(WRITE) only marks the CPU
cache dirty, and non-coherent DMA importers clean before starting DMA.
Persistent DRM/KMS imports then need a sync call on each submission.
- Christian [3]: devices must access DMA-BUFs coherently with the CPU,
using begin/end_cpu_access() around CPU accesses. Importing a buffer
with dirty CPU caches onto a non-coherent device is intentionally
unsupported. Today cma_heap and system_heap sync all mapped
attachments inside begin/end_cpu_access().
On my Pi 500+ with a USB UVC camera (640x480 YUYV) and V3D on CMA
DMA-BUFs:
- Without vb2 CPU sync, V3D reads stale data on 8/8 zero-copy frames.
- With vb2 begin/end_cpu_access() on cma_heap, zero-copy V3D is clean
(0/8 stale). CPU capture takes 91 us/frame without a V3D import, and
144 us/frame when an idle V3D PRIME import is attached.
- With a test heap that tracks CPU cache state and syncs imported BOs
at V3D job submission, zero-copy V3D stays clean (0/8 stale) and the
idle-V3D CPU read drops back to 89 us/frame.
Question to all: should I look at opt-in cache-state tracking in
dma-buf (with a sync call before DMA submission), or keep
begin/end_cpu_access() as is and handle CPU consumers via V4L2 cache
hints?
[1] https://lore.kernel.org/r/20261021175900.GG15441@killaraus.ideasonboard.com/
[2] https://lore.kernel.org/r/7e4c7707880e9092180d28484ecf674be29b40a0.camel@ndufresne.ca/
[3] https://lore.kernel.org/r/1e798600-5a76-412a-959c-94313629baf4@amd.com/
Thanks,
Karl
prev parent reply other threads:[~2026-11-12 3:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-07 10:47 Karl Mehltretter
2026-11-07 10:47 ` [PATCH v2 1/3] media: videobuf2: add opt-in DMA-BUF CPU access Karl Mehltretter
2026-11-07 10:47 ` [PATCH v2 2/3] media: uvcvideo: synchronize imported DMA-BUFs for " Karl Mehltretter
2026-11-07 10:47 ` [PATCH v2 3/3] media: vivid: " Karl Mehltretter
2026-11-07 10:59 ` [PATCH v2 0/3] media: synchronize CPU access to imported DMA-BUFs Laurent Pinchart
2026-11-12 3:16 ` Karl Mehltretter [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=avUvHGb4talXW7qS@gmail.com \
--to=kmehltretter@gmail.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=hansg@kernel.org \
--cc=hverkuil@kernel.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=mchehab@kernel.org \
--cc=nicolas@ndufresne.ca \
--cc=sumit.semwal@linaro.org \
--cc=tfiga@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®