Re: [PATCH] drm/prime: Fix mmap fake offset for drm_gem_object_funcs.mmap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Oct 24, 2019 at 02:32:14PM +0200, Daniel Vetter wrote:
> On Thu, Oct 24, 2019 at 11:02:40AM +0200, Gerd Hoffmann wrote:
> > On Wed, Oct 23, 2019 at 05:22:26PM -0500, Rob Herring wrote:
> > > Commit c40069cb7bd6 ("drm: add mmap() to drm_gem_object_funcs")
> > > introduced a GEM object mmap() hook which is expected to subtract the
> > > fake offset from vm_pgoff.
> > 
> > Long-term it is probably a good idea to just remove the fake offset
> > handling from drivers.  But that'll only work once all drivers switched
> > away from custom fops->mmap handlers so we can handle the offset -> obj
> > lookup in the drm core for everybody.
> > 
> > So let's go this way for now.
> > 
> > Acked-by: Gerd Hoffmann <kraxel@xxxxxxxxxx>
> 
> Uh this sounds like doubling down on rather horrible semantics. Can we at
> least stop the mess instead of baking it in for real? The hook is very
> very new after all. I.e.
> - Document that obj->funcs->mmap will have 0 offset in the kerneldoc.
> - Remove the subtracting from the shmem helper
> - In ttm_bo_mmap_obj re-add the offset with a huge FIXME comment.

Ah, right, we can also tweak the drivers which need it instead of doing
it for everybody in drm_gem_mmap_obj().

> Also I guess Gerd didn't really test this prime mmap support?

I did, but I think the test[1] is too simple.  It'll only try to mmap()
the dma-buf, but doesn't touch the pages, so it doesn't see the shmem
fault callback throwing SIGBUS.

cheers,
  Gerd

[1] https://git.kraxel.org/cgit/drminfo/tree/prime.c

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux