[Intel-gfx] [PATCHv4 2/3] drm/prime: Introduce drm_gem_prime_import_dev

Chris Wilson chris at chris-wilson.co.uk
Thu May 4 20:16:29 UTC 2017


On Thu, May 04, 2017 at 11:45:47AM -0700, Laura Abbott wrote:
> 
> The existing drm_gem_prime_import function uses the underlying
> struct device of a drm_device for attaching to a dma_buf. Some drivers
> (notably vgem) may not have an underlying device structure. Offer
> an alternate function to attach using any available device structure.
> 
> Signed-off-by: Laura Abbott <labbott at redhat.com>
> ---
> v4: Alternate implemntation to take an arbitrary struct dev instead of just
> a platform device.
> 
> This was different enough that I dropped the previous Reviewed-by
> ---
>  drivers/gpu/drm/drm_prime.c | 30 ++++++++++++++++++++++++------
>  include/drm/drm_prime.h     |  5 +++++
>  2 files changed, 29 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
> index 9fb65b7..5ad9a26 100644
> --- a/drivers/gpu/drm/drm_prime.c
> +++ b/drivers/gpu/drm/drm_prime.c
> @@ -595,15 +595,18 @@ int drm_gem_prime_handle_to_fd(struct drm_device *dev,
>  EXPORT_SYMBOL(drm_gem_prime_handle_to_fd);
>  
>  /**
> - * drm_gem_prime_import - helper library implementation of the import callback
> + * drm_gem_prime_import_dev - core implementation of the import callback
>   * @dev: drm_device to import into
>   * @dma_buf: dma-buf object to import
> + * @attach_dev: struct device to dma_buf attach
>   *
> - * This is the implementation of the gem_prime_import functions for GEM drivers
> - * using the PRIME helpers.
> + * This is the core of drm_gem_prime_import. It's designed to be called by
> + * drivers who want to use a different device structure than dev->dev for
> + * attaching via dma_buf.
>   */
> -struct drm_gem_object *drm_gem_prime_import(struct drm_device *dev,
> -					    struct dma_buf *dma_buf)
> +struct drm_gem_object *drm_gem_prime_import_dev(struct drm_device *dev,
> +					    struct dma_buf *dma_buf,
> +					    struct device *attach_dev)

My critique would be that this should be called
drm_gem_prime_import_for_device()

Either way (though naturally I like my suggestion ;),
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris
>   

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list