> > +/** > > + * drm_gem_ttm_mmap_offset() - Returns a GEM ttm object's mmap offset > > + * @gbo: the GEM ttm object > > + * > > + * See drm_vma_node_offset_addr() for more information. > > + * > > + * Returns: > > + * The buffer object's offset for userspace mappings on success, or > > + * 0 if no offset is allocated. > > + */ > > +u64 drm_gem_ttm_mmap_offset(struct ttm_buffer_object *bo) > > +{ > > + return drm_vma_node_offset_addr(&bo->base.vma_node); > > Why do we need a new one here, can't we use the existing gem > implementation for this (there really should only be one I hope, but I > didn't check). Havn't found one. But maybe we don't need this as separate function and can simply move the drm_vma_node_offset_addr() call into drm_gem_ttm_driver_dumb_mmap_offset(). > > +int drm_gem_ttm_driver_dumb_mmap_offset(struct drm_file *file, > > + struct drm_device *dev, > > + uint32_t handle, uint64_t *offset) > > +{ > > + struct drm_gem_object *gem; > > + struct ttm_buffer_object *bo; > > + > > + gem = drm_gem_object_lookup(file, handle); > > + if (!gem) > > + return -ENOENT; > > + > > + bo = drm_gem_ttm_of_gem(gem); > > + *offset = drm_gem_ttm_mmap_offset(bo); > > + > > + drm_gem_object_put_unlocked(gem); > > + > > + return 0; > > +} > > +EXPORT_SYMBOL(drm_gem_ttm_driver_dumb_mmap_offset); > > Same for this, you're just upcasting to ttm_bo and then downcasting to > gem_bo again ... I think just a series to roll out the existing gem > helpers everywhere should work? I don't think so. drm_gem_dumb_map_offset() calls drm_gem_create_mmap_offset(), which I think is not correct for ttm objects because ttm_bo_init() handles vma_node initialization. cheers, Gerd _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel