mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC PATCH 1/2] media: tegra-vde: match DMA direction on cache reuse
@ 2026-11-29 17:46 Florian Krischer
  2026-11-29 17:46 ` [RFC PATCH 2/2] media: tegra-vde: map capture planes bidirectionally Florian Krischer
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Krischer @ 2026-11-29 17:46 UTC (permalink / raw)
  To: Dmitry Osipenko, Mauro Carvalho Chehab
  Cc: Thierry Reding, Jonathan Hunter, linux-media, linux-tegra, linux-kernel

The DMA-BUF cache can reuse an attachment mapped in a different
direction. Updating the cached direction does not change the mapping,
and later unmap then uses a direction different from the original map.

Match both the DMA-BUF and its mapping direction before reusing a
cached attachment. This preserves the original direction for unmap
and keeps same-direction cache hits.

Signed-off-by: Florian Krischer <florian.krischer@fkr.dev>
---
Build-tested for ARM with W=1 on media-committers/next with the
separately submitted mutex fix applied.
Hardware testing of cross-direction DMA-BUF reuse is pending.

diff --git a/drivers/media/platform/nvidia/tegra-vde/dmabuf-cache.c b/drivers/media/platform/nvidia/tegra-vde/dmabuf-cache.c
--- a/drivers/media/platform/nvidia/tegra-vde/dmabuf-cache.c
+++ b/drivers/media/platform/nvidia/tegra-vde/dmabuf-cache.c
@@ -76,14 +76,11 @@
 	mutex_lock(&vde->map_lock);
 
 	list_for_each_entry(entry, &vde->map_list, list) {
-		if (entry->a->dmabuf != dmabuf)
+		if (entry->a->dmabuf != dmabuf || entry->dma_dir != dma_dir)
 			continue;
 
 		if (!cancel_delayed_work(&entry->dwork))
 			continue;
-
-		if (entry->dma_dir != dma_dir)
-			entry->dma_dir = DMA_BIDIRECTIONAL;
 
 		dma_buf_put(dmabuf);
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-29 17:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-29 17:46 [RFC PATCH 1/2] media: tegra-vde: match DMA direction on cache reuse Florian Krischer
2026-11-29 17:46 ` [RFC PATCH 2/2] media: tegra-vde: map capture planes bidirectionally Florian Krischer

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®