[PATCH 2/2] drm/cma-helper: Implement mmap as GEM CMA object functions
Daniel Vetter
daniel at ffwll.ch
Thu Jan 14 17:19:57 UTC 2021
On Thu, Jan 14, 2021 at 02:26:41PM +0100, Thomas Zimmermann wrote:
> From d0583fe22cd0cd29749ff679e46e13b58de325cb Mon Sep 17 00:00:00 2001
> From: Thomas Zimmermann <tzimmermann at suse.de>
> Date: Thu, 14 Jan 2021 14:21:51 +0100
> Subject: [PATCH] drm/cma: Set vma ops in mmap function
>
> Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
> ---
> drivers/gpu/drm/drm_gem_cma_helper.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c
> index 7942cf05cd93..0bd192736169 100644
> --- a/drivers/gpu/drm/drm_gem_cma_helper.c
> +++ b/drivers/gpu/drm/drm_gem_cma_helper.c
> @@ -489,6 +489,8 @@ int drm_gem_cma_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma)
> struct drm_gem_cma_object *cma_obj;
> int ret;
>
> + vma->vm_ops = obj->funcs->vm_ops;
I think this should be done in core, otherwise we have tons of refcount
leaks. I think this was an oversight when we've done that refactoring.
Also drivers can easily overwrite this one if they really have to, but not
assigned this is a clear bug.
-Daniel
> +
> /*
> * Clear the VM_PFNMAP flag that was set by drm_gem_mmap(), and set the
> * vm_pgoff (used as a fake buffer offset by DRM) to 0 as we want to map
> --
> 2.29.2
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
More information about the dri-devel
mailing list