Copying from GEM-SHMEM duplicated a number of interfaces that are not required. Remove them.
Signed-off-by: Thomas Zimmermann <[email protected]> --- drivers/gpu/drm/drm_gem_uma_helper.c | 111 --------------------------- include/drm/drm_gem_uma_helper.h | 16 ---- 2 files changed, 127 deletions(-) diff --git a/drivers/gpu/drm/drm_gem_uma_helper.c b/drivers/gpu/drm/drm_gem_uma_helper.c index d617cfd981e1..2b88e21b1db9 100644 --- a/drivers/gpu/drm/drm_gem_uma_helper.c +++ b/drivers/gpu/drm/drm_gem_uma_helper.c @@ -18,7 +18,6 @@ #include <drm/drm.h> #include <drm/drm_device.h> #include <drm/drm_drv.h> -#include <drm/drm_dumb_buffers.h> #include <drm/drm_gem_uma_helper.h> #include <drm/drm_prime.h> #include <drm/drm_print.h> @@ -466,29 +465,6 @@ void drm_gem_uma_vunmap_locked(struct drm_gem_uma_object *uma, struct iosys_map } EXPORT_SYMBOL_GPL(drm_gem_uma_vunmap_locked); -static int -drm_gem_uma_create_with_handle(struct drm_file *file_priv, - struct drm_device *dev, size_t size, - uint32_t *handle) -{ - struct drm_gem_uma_object *uma; - int ret; - - uma = drm_gem_uma_create(dev, size); - if (IS_ERR(uma)) - return PTR_ERR(uma); - - /* - * Allocate an id of idr table where the obj is registered - * and handle has the id what user can see. - */ - ret = drm_gem_handle_create(file_priv, &uma->base, handle); - /* drop reference from allocate - handle holds it now. */ - drm_gem_object_put(&uma->base); - - return ret; -} - /* Update madvise status, returns true if not purged, else * false or -errno. */ @@ -537,36 +513,6 @@ void drm_gem_uma_purge_locked(struct drm_gem_uma_object *uma) } EXPORT_SYMBOL_GPL(drm_gem_uma_purge_locked); -/** - * drm_gem_uma_dumb_create - Create a dumb UMA buffer object - * @file: DRM file structure to create the dumb buffer for - * @dev: DRM device - * @args: IOCTL data - * - * This function computes the pitch of the dumb buffer and rounds it up to an - * integer number of bytes per pixel. Drivers for hardware that doesn't have - * any additional restrictions on the pitch can directly use this function as - * their &drm_driver.dumb_create callback. - * - * For hardware with additional restrictions, drivers can adjust the fields - * set up by userspace before calling into this function. - * - * Returns: - * 0 on success or a negative error code on failure. - */ -int drm_gem_uma_dumb_create(struct drm_file *file, struct drm_device *dev, - struct drm_mode_create_dumb *args) -{ - int ret; - - ret = drm_mode_size_dumb(dev, args, SZ_8, 0); - if (ret) - return ret; - - return drm_gem_uma_create_with_handle(file, dev, args->size, &args->handle); -} -EXPORT_SYMBOL_GPL(drm_gem_uma_dumb_create); - static vm_fault_t drm_gem_uma_fault(struct vm_fault *vmf) { struct vm_area_struct *vma = vmf->vma; @@ -836,63 +782,6 @@ drm_gem_uma_prime_import_sg_table(struct drm_device *dev, } EXPORT_SYMBOL_GPL(drm_gem_uma_prime_import_sg_table); -/** - * drm_gem_uma_prime_import_no_map - Import dmabuf without mapping its sg_table - * @dev: Device to import into - * @dma_buf: dma-buf object to import - * - * Drivers that use the GEM UMA helpers but also wants to import dmabuf without - * mapping its sg_table can use this as their &drm_driver.gem_prime_import - * implementation. - */ -struct drm_gem_object *drm_gem_uma_prime_import_no_map(struct drm_device *dev, - struct dma_buf *dma_buf) -{ - struct dma_buf_attachment *attach; - struct drm_gem_uma_object *uma; - struct drm_gem_object *obj; - size_t size; - int ret; - - if (drm_gem_is_prime_exported_dma_buf(dev, dma_buf)) { - /* - * Importing dmabuf exported from our own gem increases - * refcount on gem itself instead of f_count of dmabuf. - */ - obj = dma_buf->priv; - drm_gem_object_get(obj); - return obj; - } - - attach = dma_buf_attach(dma_buf, dev->dev); - if (IS_ERR(attach)) - return ERR_CAST(attach); - - get_dma_buf(dma_buf); - - size = PAGE_ALIGN(attach->dmabuf->size); - - uma = __drm_gem_uma_create(dev, size, true, NULL); - if (IS_ERR(uma)) { - ret = PTR_ERR(uma); - goto fail_detach; - } - - drm_dbg_prime(dev, "size = %zu\n", size); - - uma->base.import_attach = attach; - uma->base.resv = dma_buf->resv; - - return &uma->base; - -fail_detach: - dma_buf_detach(dma_buf, attach); - dma_buf_put(dma_buf); - - return ERR_PTR(ret); -} -EXPORT_SYMBOL_GPL(drm_gem_uma_prime_import_no_map); - MODULE_DESCRIPTION("DRM UMA memory-management helpers"); MODULE_IMPORT_NS("DMA_BUF"); MODULE_LICENSE("GPL"); diff --git a/include/drm/drm_gem_uma_helper.h b/include/drm/drm_gem_uma_helper.h index e7722c625fab..3d6de27efe79 100644 --- a/include/drm/drm_gem_uma_helper.h +++ b/include/drm/drm_gem_uma_helper.h @@ -13,7 +13,6 @@ #include <drm/drm_prime.h> struct dma_buf_attachment; -struct drm_mode_create_dumb; struct drm_printer; struct sg_table; @@ -290,20 +289,5 @@ struct drm_gem_object * drm_gem_uma_prime_import_sg_table(struct drm_device *dev, struct dma_buf_attachment *attach, struct sg_table *sgt); -int drm_gem_uma_dumb_create(struct drm_file *file, struct drm_device *dev, - struct drm_mode_create_dumb *args); -struct drm_gem_object *drm_gem_uma_prime_import_no_map(struct drm_device *dev, - struct dma_buf *buf); - -/** - * DRM_GEM_UMA_DRIVER_OPS - Default GEM UMA operations - * - * This macro provides a shortcut for setting the GEM UMA operations - * in the &drm_driver structure. Drivers that do not require an s/g table - * for imported buffers should use this. - */ -#define DRM_GEM_UMA_DRIVER_OPS \ - .gem_prime_import = drm_gem_uma_prime_import_no_map, \ - .dumb_create = drm_gem_uma_dumb_create #endif /* __DRM_GEM_UMA_HELPER_H__ */ -- 2.52.0
