On Thu, Oct 24, 2019 at 04:42:35PM +0200, Thomas Zimmermann wrote: > Implementing vmap() and vunmap() of struct drm_gem_object_funcs is > required by generic fbdev emulation. Supporting free() is easy as > well. More udl-specific interfaces can probably be replaced by GEM > object functions in later patches. > > Signed-off-by: Thomas Zimmermann <tzimmermann@xxxxxxx> > --- > drivers/gpu/drm/udl/udl_gem.c | 34 ++++++++++++++++++++++++++++++++++ > 1 file changed, 34 insertions(+) > > diff --git a/drivers/gpu/drm/udl/udl_gem.c b/drivers/gpu/drm/udl/udl_gem.c > index 3ea0cd9ae2d6..6ca097c270d6 100644 > --- a/drivers/gpu/drm/udl/udl_gem.c > +++ b/drivers/gpu/drm/udl/udl_gem.c > @@ -11,6 +11,8 @@ > > #include "udl_drv.h" > > +static const struct drm_gem_object_funcs udl_gem_object_funcs; > + > struct udl_gem_object *udl_gem_alloc_object(struct drm_device *dev, > size_t size) > { > @@ -25,6 +27,7 @@ struct udl_gem_object *udl_gem_alloc_object(struct drm_device *dev, > return NULL; > } > > + obj->base.funcs = &udl_gem_object_funcs; > obj->flags = UDL_BO_CACHEABLE; > return obj; > } > @@ -230,3 +233,34 @@ int udl_gem_mmap(struct drm_file *file, struct drm_device *dev, > mutex_unlock(&udl->gem_lock); > return ret; > } > + > +/* > + * Helpers for struct drm_gem_object_funcs > + */ > + > +static void udl_gem_object_free(struct drm_gem_object *obj) > +{ > + udl_gem_free_object(obj); > +} > + > +static void *udl_gem_object_vmap(struct drm_gem_object *obj) > +{ > + struct udl_gem_object *uobj = to_udl_bo(obj); > + int ret; > + > + ret = udl_gem_vmap(uobj); > + if (ret) > + return ERR_PTR(ret); > + return uobj->vmapping; > +} > + > +static void udl_gem_object_vunmap(struct drm_gem_object *obj, void *vaddr) > +{ > + return udl_gem_vunmap(to_udl_bo(obj)); > +} > + > +static const struct drm_gem_object_funcs udl_gem_object_funcs = { > + .free = udl_gem_object_free, > + .vmap = udl_gem_object_vmap, > + .vunmap = udl_gem_object_vunmap, Yeah this doesn't work, you need to refcount the vmap here I think. I'd say simpler to first cut over to shmem helpers. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel