Importing dma-bufs via PRIME requires a DMA-capable hardware device. This is not the case for USB, where DMA is controller entirely by the USB controller instead of the USB devices. Drivers for USB-based hardware maintainer their own workaround for this problem. The original ideas to resolve this was to provide different PRIME helpers for such devices, but the dma-buf code assumes DMA functionality as well. So that ideas is not realistic. Let's instead turn the current workaround into a feature. It will also be useful in other code. Patch 1 add a dma_device field to struct drm_device and makes the PRIME code use it. Patches 2 to 4 replace related driver code. There are other possible users of the new field. The exynos and mediatek drivers already maintain a dedicated DMA device for non-PRIME code. They could likely use dma_dev as well. GEM-DMA helpers currently allocate DMA memory with the regular parent device. They should support the dma_dev settings as well. Tested with udl. Thomas Zimmermann (4): drm/prime: Support dedicated DMA device for dma-buf imports drm/gm12u320: Set struct drm_device.dma_dev drm/gud: Set struct drm_device.dma_dev drm/udl: Set struct drm_device.dma_dev drivers/gpu/drm/drm_drv.c | 2 ++ drivers/gpu/drm/drm_prime.c | 2 +- drivers/gpu/drm/gud/gud_drv.c | 26 +++---------------- drivers/gpu/drm/gud/gud_internal.h | 1 - drivers/gpu/drm/tiny/gm12u320.c | 41 ++++++------------------------ drivers/gpu/drm/udl/udl_drv.c | 17 ------------- drivers/gpu/drm/udl/udl_drv.h | 1 - drivers/gpu/drm/udl/udl_main.c | 9 ++----- include/drm/drm_device.h | 37 +++++++++++++++++++++++++++ 9 files changed, 53 insertions(+), 83 deletions(-) -- 2.48.1