]> www.infradead.org Git - users/jedix/linux-maple.git/commit
drm/prime: Support dedicated DMA device for dma-buf imports
authorThomas Zimmermann <tzimmermann@suse.de>
Fri, 7 Mar 2025 08:03:59 +0000 (09:03 +0100)
committerThomas Zimmermann <tzimmermann@suse.de>
Wed, 12 Mar 2025 08:03:46 +0000 (09:03 +0100)
commit143ec8d3f93965110689897f0d25165dc9664009
tree02a7f76f2a660f99a77d6c35f4aa744ecba0932c
parentc6a84bc9690afc40b103c5df3cdfb357439cb563
drm/prime: Support dedicated DMA device for dma-buf imports

Importing dma-bufs via PRIME requires a DMA-capable device. Devices on
peripheral busses, such as USB, often cannot perform DMA by themselves.
Without DMA-capable device PRIME import fails. DRM drivers for USB
devices already use a separate DMA device for dma-buf imports. Make the
mechanism generally available.

Besides the case of USB, there are embedded DRM devices without DMA
capability. DMA is performed by a separate controller. DRM drivers should
set this accordingly.

Add the field dma_dev to struct drm_device to refer to the device's DMA
device. For USB this should be the USB controller. Use dma_dev in the
PRIME import helpers, if set.

v2:
- acquire internal reference on dma_dev (Jani)
- add DMA-controller usecase to docs (Maxime)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20250307080836.42848-2-tzimmermann@suse.de
drivers/gpu/drm/drm_drv.c
drivers/gpu/drm/drm_prime.c
include/drm/drm_device.h