[PATCH 1/6] drm: Add helper to cast DMA-buf to GEM object

Daniel Vetter daniel at ffwll.ch
Thu Jul 13 06:01:59 UTC 2017


On Wed, Jul 12, 2017 at 11:44 PM, Felix Kuehling <felix.kuehling at amd.com> wrote:
>
> --- a/drivers/gpu/drm/drm_prime.c
> +++ b/drivers/gpu/drm/drm_prime.c
> @@ -634,16 +634,14 @@ struct drm_gem_object *drm_gem_prime_import(struct drm_device *dev,
>         struct drm_gem_object *obj;
>         int ret;
>
> -       if (dma_buf->ops == &drm_gem_prime_dmabuf_ops) {
> -               obj = dma_buf->priv;
> -               if (obj->dev == dev) {
> -                       /*
> -                        * Importing dmabuf exported from out own gem increases
> -                        * refcount on gem itself instead of f_count of dmabuf.
> -                        */
> -                       drm_gem_object_reference(obj);
> -                       return obj;
> -               }
> +       obj = drm_gem_prime_dmabuf_to_object(dma_buf, NULL);
> +       if (obj && obj->dev == dev) {
> +               /*
> +                * Importing dmabuf exported from out own gem increases
> +                * refcount on gem itself instead of f_count of dmabuf.
> +                */
> +               drm_gem_object_reference(obj);
> +               return obj;
>         }
>
>         if (!dev->driver->gem_prime_import_sg_table)
>
> Do you want me to do that in the same commit, or a separate one?

I'd squash it into the one commit you have already.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


More information about the amd-gfx mailing list