PRIME functionality is now provided by GEM object functions. The driver callback functions are obsolete. So this patch renames them and turns them into static internal functions of the VRAM helper library. The implementation of gem_prime_mmap is now unused and the patch removes it. v3: * kept each renamed function at its original location within file * kept documentation Signed-off-by: Thomas Zimmermann <tzimmermann@xxxxxxx> --- Documentation/gpu/todo.rst | 4 +- drivers/gpu/drm/drm_gem_vram_helper.c | 77 ++++++++++----------------- include/drm/drm_gem_vram_helper.h | 22 -------- 3 files changed, 29 insertions(+), 74 deletions(-) diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst index d49c1cc6dc28..3f6ecf846263 100644 --- a/Documentation/gpu/todo.rst +++ b/Documentation/gpu/todo.rst @@ -221,9 +221,7 @@ struct drm_gem_object_funcs GEM objects can now have a function table instead of having the callbacks on the DRM driver struct. This is now the preferred way and drivers can be moved over. -DRM_GEM_CMA_VMAP_DRIVER_OPS, DRM_GEM_SHMEM_DRIVER_OPS already support this, but -DRM_GEM_VRAM_DRIVER_PRIME does not yet and needs to be aligned with the previous -two. We also need a 2nd version of the CMA define that doesn't require the +We also need a 2nd version of the CMA define that doesn't require the vmapping to be present (different hook for prime importing). Plus this needs to be rolled out to all drivers using their own implementations, too. diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c b/drivers/gpu/drm/drm_gem_vram_helper.c index 22bc6989c1c5..e0fbfb6570cf 100644 --- a/drivers/gpu/drm/drm_gem_vram_helper.c +++ b/drivers/gpu/drm/drm_gem_vram_helper.c @@ -465,21 +465,24 @@ const struct drm_vram_mm_funcs drm_gem_vram_mm_funcs = { EXPORT_SYMBOL(drm_gem_vram_mm_funcs); /* - * Helpers for struct drm_driver + * Helpers for struct drm_gem_object_funcs */ /** - * drm_gem_vram_driver_gem_free_object_unlocked() - \ - Implements &struct drm_driver.gem_free_object_unlocked - * @gem: GEM object. Refers to &struct drm_gem_vram_object.gem + * drm_gem_vram_object_free() - \ + Implements &struct drm_gem_object_funcs.free + * @gem: GEM object. Refers to &struct drm_gem_vram_object.gem */ -void drm_gem_vram_driver_gem_free_object_unlocked(struct drm_gem_object *gem) +static void drm_gem_vram_object_free(struct drm_gem_object *gem) { struct drm_gem_vram_object *gbo = drm_gem_vram_of_gem(gem); drm_gem_vram_put(gbo); } -EXPORT_SYMBOL(drm_gem_vram_driver_gem_free_object_unlocked); + +/* + * Helpers for dump buffers + */ /** * drm_gem_vram_driver_create_dumb() - \ @@ -541,19 +544,19 @@ int drm_gem_vram_driver_dumb_mmap_offset(struct drm_file *file, EXPORT_SYMBOL(drm_gem_vram_driver_dumb_mmap_offset); /* - * PRIME helpers for struct drm_driver + * PRIME helpers */ /** - * drm_gem_vram_driver_gem_prime_pin() - \ - Implements &struct drm_driver.gem_prime_pin + * drm_gem_vram_object_pin() - \ + Implements &struct drm_gem_object_funcs.pin * @gem: The GEM object to pin * * Returns: * 0 on success, or * a negative errno code otherwise. */ -int drm_gem_vram_driver_gem_prime_pin(struct drm_gem_object *gem) +static int drm_gem_vram_object_pin(struct drm_gem_object *gem) { struct drm_gem_vram_object *gbo = drm_gem_vram_of_gem(gem); @@ -567,31 +570,29 @@ int drm_gem_vram_driver_gem_prime_pin(struct drm_gem_object *gem) */ return drm_gem_vram_pin(gbo, 0); } -EXPORT_SYMBOL(drm_gem_vram_driver_gem_prime_pin); /** - * drm_gem_vram_driver_gem_prime_unpin() - \ - Implements &struct drm_driver.gem_prime_unpin + * drm_gem_vram_object_unpin() - \ + Implements &struct drm_gem_object_funcs.unpin * @gem: The GEM object to unpin */ -void drm_gem_vram_driver_gem_prime_unpin(struct drm_gem_object *gem) +static void drm_gem_vram_object_unpin(struct drm_gem_object *gem) { struct drm_gem_vram_object *gbo = drm_gem_vram_of_gem(gem); drm_gem_vram_unpin(gbo); } -EXPORT_SYMBOL(drm_gem_vram_driver_gem_prime_unpin); /** - * drm_gem_vram_driver_gem_prime_vmap() - \ - Implements &struct drm_driver.gem_prime_vmap + * drm_gem_vram_object_vmap() - \ + Implements &struct drm_gem_object_funcs.vmap * @gem: The GEM object to map * * Returns: * The buffers virtual address on success, or * NULL otherwise. */ -void *drm_gem_vram_driver_gem_prime_vmap(struct drm_gem_object *gem) +static void *drm_gem_vram_object_vmap(struct drm_gem_object *gem) { struct drm_gem_vram_object *gbo = drm_gem_vram_of_gem(gem); int ret; @@ -607,52 +608,30 @@ void *drm_gem_vram_driver_gem_prime_vmap(struct drm_gem_object *gem) } return base; } -EXPORT_SYMBOL(drm_gem_vram_driver_gem_prime_vmap); /** - * drm_gem_vram_driver_gem_prime_vunmap() - \ - Implements &struct drm_driver.gem_prime_vunmap + * drm_gem_vram_object_vunmap() - \ + Implements &struct drm_gem_object_funcs.vunmap * @gem: The GEM object to unmap * @vaddr: The mapping's base address */ -void drm_gem_vram_driver_gem_prime_vunmap(struct drm_gem_object *gem, - void *vaddr) +static void drm_gem_vram_object_vunmap(struct drm_gem_object *gem, + void *vaddr) { struct drm_gem_vram_object *gbo = drm_gem_vram_of_gem(gem); drm_gem_vram_kunmap(gbo); drm_gem_vram_unpin(gbo); } -EXPORT_SYMBOL(drm_gem_vram_driver_gem_prime_vunmap); - -/** - * drm_gem_vram_driver_gem_prime_mmap() - \ - Implements &struct drm_driver.gem_prime_mmap - * @gem: The GEM object to map - * @vma: The VMA describing the mapping - * - * Returns: - * 0 on success, or - * a negative errno code otherwise. - */ -int drm_gem_vram_driver_gem_prime_mmap(struct drm_gem_object *gem, - struct vm_area_struct *vma) -{ - struct drm_gem_vram_object *gbo = drm_gem_vram_of_gem(gem); - - gbo->gem.vma_node.vm_node.start = gbo->bo.vma_node.vm_node.start; - return drm_gem_prime_mmap(gem, vma); -} -EXPORT_SYMBOL(drm_gem_vram_driver_gem_prime_mmap); /* * GEM object funcs */ static const struct drm_gem_object_funcs drm_gem_vram_object_funcs = { - .free = drm_gem_vram_driver_gem_free_object_unlocked, - .pin = drm_gem_vram_driver_gem_prime_pin, - .unpin = drm_gem_vram_driver_gem_prime_unpin, - .vmap = drm_gem_vram_driver_gem_prime_vmap, - .vunmap = drm_gem_vram_driver_gem_prime_vunmap + .free = drm_gem_vram_object_free, + .pin = drm_gem_vram_object_pin, + .unpin = drm_gem_vram_object_unpin, + .vmap = drm_gem_vram_object_vmap, + .vunmap = drm_gem_vram_object_vunmap }; diff --git a/include/drm/drm_gem_vram_helper.h b/include/drm/drm_gem_vram_helper.h index bc8fe9feee3b..b41d932eb53a 100644 --- a/include/drm/drm_gem_vram_helper.h +++ b/include/drm/drm_gem_vram_helper.h @@ -108,7 +108,6 @@ extern const struct drm_vram_mm_funcs drm_gem_vram_mm_funcs; * Helpers for struct drm_driver */ -void drm_gem_vram_driver_gem_free_object_unlocked(struct drm_gem_object *gem); int drm_gem_vram_driver_dumb_create(struct drm_file *file, struct drm_device *dev, struct drm_mode_create_dumb *args); @@ -124,29 +123,8 @@ int drm_gem_vram_driver_dumb_mmap_offset(struct drm_file *file, * &struct drm_driver with default functions. */ #define DRM_GEM_VRAM_DRIVER \ - .gem_free_object_unlocked = \ - drm_gem_vram_driver_gem_free_object_unlocked, \ .dumb_create = drm_gem_vram_driver_dumb_create, \ .dumb_map_offset = drm_gem_vram_driver_dumb_mmap_offset, \ .gem_prime_mmap = drm_gem_prime_mmap -/* - * PRIME helpers for struct drm_driver - */ - -int drm_gem_vram_driver_gem_prime_pin(struct drm_gem_object *obj); -void drm_gem_vram_driver_gem_prime_unpin(struct drm_gem_object *obj); -void *drm_gem_vram_driver_gem_prime_vmap(struct drm_gem_object *obj); -void drm_gem_vram_driver_gem_prime_vunmap(struct drm_gem_object *obj, - void *vaddr); -int drm_gem_vram_driver_gem_prime_mmap(struct drm_gem_object *obj, - struct vm_area_struct *vma); - -#define DRM_GEM_VRAM_DRIVER_PRIME \ - .gem_prime_pin = drm_gem_vram_driver_gem_prime_pin, \ - .gem_prime_unpin = drm_gem_vram_driver_gem_prime_unpin, \ - .gem_prime_vmap = drm_gem_vram_driver_gem_prime_vmap, \ - .gem_prime_vunmap = drm_gem_vram_driver_gem_prime_vunmap, \ - .gem_prime_mmap = drm_gem_vram_driver_gem_prime_mmap - #endif -- 2.21.0 _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel