[PATCH v2] drm/gem: Fix mmap fake offset handling for drm_gem_object_funcs.mmap

Daniel Vetter daniel at ffwll.ch
Wed Nov 20 10:39:13 UTC 2019


On Wed, Nov 20, 2019 at 09:05:32AM +0100, Gerd Hoffmann wrote:
>   Hi,
> 
> > > I can see now why you want a private address space for each object.
> > > Does that imply we need an anon_inode for each gem object?  Or is
> > > there some more lightweight way to do this?
> > 
> > I have no idea whether we can get a address_space struct without an inode
> > (and no disasters).
> 
> Anything building on shmem helpers should be able to use
> obj->filp->f_mapping, right?  So allocating an inode unconditionally
> doesn't look like a good plan.

Not sure the shmem helpers forward the mmap to the underlying shmem file,
so not sure this is the greatest way either.

> Guess I'll go look at ttm-local changes for starters and see how it
> goes.

I think for ttm just consistently using the one per-device mapping for
everything, with all the fake offsets, is probably the quickest route.
Maybe also for for shmem helpers.

I'm kinda leaning towards that we just restore the fake offset everywhere,
and document how it works. Until someone comes up with a really bright
idea.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the dri-devel mailing list