diff options
Diffstat (limited to 'drivers/gpu/drm/drm_prime.c')
-rw-r--r-- | drivers/gpu/drm/drm_prime.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c index 954eb848b5e2..22408badc617 100644 --- a/drivers/gpu/drm/drm_prime.c +++ b/drivers/gpu/drm/drm_prime.c | |||
@@ -595,15 +595,18 @@ out_unlock: | |||
595 | EXPORT_SYMBOL(drm_gem_prime_handle_to_fd); | 595 | EXPORT_SYMBOL(drm_gem_prime_handle_to_fd); |
596 | 596 | ||
597 | /** | 597 | /** |
598 | * drm_gem_prime_import - helper library implementation of the import callback | 598 | * drm_gem_prime_import_dev - core implementation of the import callback |
599 | * @dev: drm_device to import into | 599 | * @dev: drm_device to import into |
600 | * @dma_buf: dma-buf object to import | 600 | * @dma_buf: dma-buf object to import |
601 | * @attach_dev: struct device to dma_buf attach | ||
601 | * | 602 | * |
602 | * This is the implementation of the gem_prime_import functions for GEM drivers | 603 | * This is the core of drm_gem_prime_import. It's designed to be called by |
603 | * using the PRIME helpers. | 604 | * drivers who want to use a different device structure than dev->dev for |
605 | * attaching via dma_buf. | ||
604 | */ | 606 | */ |
605 | struct drm_gem_object *drm_gem_prime_import(struct drm_device *dev, | 607 | struct drm_gem_object *drm_gem_prime_import_dev(struct drm_device *dev, |
606 | struct dma_buf *dma_buf) | 608 | struct dma_buf *dma_buf, |
609 | struct device *attach_dev) | ||
607 | { | 610 | { |
608 | struct dma_buf_attachment *attach; | 611 | struct dma_buf_attachment *attach; |
609 | struct sg_table *sgt; | 612 | struct sg_table *sgt; |
@@ -625,7 +628,7 @@ struct drm_gem_object *drm_gem_prime_import(struct drm_device *dev, | |||
625 | if (!dev->driver->gem_prime_import_sg_table) | 628 | if (!dev->driver->gem_prime_import_sg_table) |
626 | return ERR_PTR(-EINVAL); | 629 | return ERR_PTR(-EINVAL); |
627 | 630 | ||
628 | attach = dma_buf_attach(dma_buf, dev->dev); | 631 | attach = dma_buf_attach(dma_buf, attach_dev); |
629 | if (IS_ERR(attach)) | 632 | if (IS_ERR(attach)) |
630 | return ERR_CAST(attach); | 633 | return ERR_CAST(attach); |
631 | 634 | ||
@@ -655,6 +658,21 @@ fail_detach: | |||
655 | 658 | ||
656 | return ERR_PTR(ret); | 659 | return ERR_PTR(ret); |
657 | } | 660 | } |
661 | EXPORT_SYMBOL(drm_gem_prime_import_dev); | ||
662 | |||
663 | /** | ||
664 | * drm_gem_prime_import - helper library implementation of the import callback | ||
665 | * @dev: drm_device to import into | ||
666 | * @dma_buf: dma-buf object to import | ||
667 | * | ||
668 | * This is the implementation of the gem_prime_import functions for GEM drivers | ||
669 | * using the PRIME helpers. | ||
670 | */ | ||
671 | struct drm_gem_object *drm_gem_prime_import(struct drm_device *dev, | ||
672 | struct dma_buf *dma_buf) | ||
673 | { | ||
674 | return drm_gem_prime_import_dev(dev, dma_buf, dev->dev); | ||
675 | } | ||
658 | EXPORT_SYMBOL(drm_gem_prime_import); | 676 | EXPORT_SYMBOL(drm_gem_prime_import); |
659 | 677 | ||
660 | /** | 678 | /** |