Hi
Am 26.02.21 um 21:33 schrieb Pavel Machek:
Hi!
- struct device *dmadev;
- struct drm_gem_object *obj;
- if (!dev_is_usb(dev->dev))
return ERR_PTR(-ENODEV);
- dmadev = usb_intf_get_dma_device(to_usb_interface(dev->dev));
- if (drm_WARN_ONCE(dev, !dmadev, "buffer sharing not supported"))
return ERR_PTR(-ENODEV);
- obj = drm_gem_prime_import_dev(dev, dma_buf, dmadev);
- put_device(dmadev);
Just realized there's another can of worms here because dma_buf_attach does not refcount the struct device. But the dma_buf can easily outlive the underlying device, at least right now.
We should probably require that devices get rid of all their mappings in their hotunplug code.
Ofc now that we pick some random other device struct this gets kinda worse.
Anyway, also just another pre-existing condition that we should worry about here. It's all still a very bad hack.
This is actually regression fix if I understand this correctly. Bug means udl is unusable, so that's kind of bad.
Should we revert the original commit causing this while this get sorted out?
Better not. It's not easily revert-able, so other code might break in the process.
I'd rather wait a bit for this to get ready, or meanwhile cherry-pick the current patch.
Best regards Thomas
Best regards, Pavel
dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel