[PATCH 10/10] drm/prime: Use dma_buf from GEM object instance

Anusha Srivatsa asrivats at redhat.com
Fri Feb 28 16:21:29 UTC 2025


Reviewed-by: ANusha Srivatsa <asrivats at redhat.com>


On Wed, Feb 26, 2025 at 12:28 PM Thomas Zimmermann <tzimmermann at suse.de>
wrote:

> Avoid dereferencing struct drm_gem_object.import_attach for the
> imported dma-buf. The dma_buf field in the GEM object instance refers
> to the same buffer. Prepares to make import_attach optional.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
> ---
>  drivers/gpu/drm/drm_prime.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
> index 32a8781cfd67..bdb51c8f262e 100644
> --- a/drivers/gpu/drm/drm_prime.c
> +++ b/drivers/gpu/drm/drm_prime.c
> @@ -453,13 +453,7 @@ struct dma_buf *drm_gem_prime_handle_to_dmabuf(struct
> drm_device *dev,
>         }
>
>         mutex_lock(&dev->object_name_lock);
> -       /* re-export the original imported object */
> -       if (obj->import_attach) {
> -               dmabuf = obj->import_attach->dmabuf;
> -               get_dma_buf(dmabuf);
> -               goto out_have_obj;
> -       }
> -
> +       /* re-export the original imported/exported object */
>         if (obj->dma_buf) {
>                 get_dma_buf(obj->dma_buf);
>                 dmabuf = obj->dma_buf;
> --
> 2.48.1
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20250228/9e2856fb/attachment-0001.htm>


More information about the dri-devel mailing list