Hi On Thu, Oct 16, 2014 at 12:28 PM, Daniel Vetter <daniel.vetter@xxxxxxxx> wrote: > Too many new drm driver writers seem to look at i915 for inspiration. > But we have two ways to do mmap, so discourage readers from the old, > ugly version. In a new driver we'd just expose two mmap offsets per > object, one for the gtt map and the other for the cpu map. Yes, please! (also fine with Jani's concerns) Reviewed-by: David Herrmann <dh.herrmann@xxxxxxxxx> Thanks David > Cc: "Cheng, Yao" <yao.cheng@xxxxxxxxx> > Cc: David Herrmann <dh.herrmann@xxxxxxxxx> > Signed-off-by: Daniel Vetter <daniel.vetter@xxxxxxxx> > --- > drivers/gpu/drm/i915/i915_gem.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c > index e9c783d55612..09d859b89aac 100644 > --- a/drivers/gpu/drm/i915/i915_gem.c > +++ b/drivers/gpu/drm/i915/i915_gem.c > @@ -1466,6 +1466,15 @@ unlock: > * > * While the mapping holds a reference on the contents of the object, it doesn't > * imply a ref on the object itself. > + * > + * IMPORTANT: > + * > + * DRM driver writers who look a this function as an example for how to do GEM > + * mmap support, please don't implement mmap support like here. The modern way > + * to implement DRM mmap support is with an mmap offset ioctl (like > + * i915_gem_mmap_gtt) and then using the mmap syscall on the DRM fd directly. > + * That way debug tooling like valgrind will understand what's going on, hiding > + * the mmap call in a driver private ioctl will break that. > */ > int > i915_gem_mmap_ioctl(struct drm_device *dev, void *data, > -- > 1.9.3 > _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx