mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-15 08:44:14 +08:00
drm: Remove struct drm_driver.gem_prime_mmap
All drivers initialize this field with drm_gem_prime_mmap(). Call the function directly and remove the field. Simplifies the code and resolves a long-standing TODO item. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230613150441.17720-3-tzimmermann@suse.de
This commit is contained in:
parent
734458b762
commit
0adec22702
@ -319,15 +319,6 @@ Contact: Daniel Vetter, Noralf Tronnes
|
||||
|
||||
Level: Advanced
|
||||
|
||||
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. Callbacks in drivers have been
|
||||
converted, except for struct drm_driver.gem_prime_mmap.
|
||||
|
||||
Level: Intermediate
|
||||
|
||||
connector register/unregister fixes
|
||||
-----------------------------------
|
||||
|
||||
|
@ -376,7 +376,6 @@ static const struct drm_driver driver = {
|
||||
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
|
||||
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
|
||||
.gem_prime_import = ivpu_gem_prime_import,
|
||||
.gem_prime_mmap = drm_gem_prime_mmap,
|
||||
|
||||
.ioctls = ivpu_drm_ioctls,
|
||||
.num_ioctls = ARRAY_SIZE(ivpu_drm_ioctls),
|
||||
|
@ -2809,7 +2809,6 @@ static const struct drm_driver amdgpu_kms_driver = {
|
||||
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
|
||||
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
|
||||
.gem_prime_import = amdgpu_gem_prime_import,
|
||||
.gem_prime_mmap = drm_gem_prime_mmap,
|
||||
|
||||
.name = DRIVER_NAME,
|
||||
.desc = DRIVER_DESC,
|
||||
|
@ -54,12 +54,8 @@ static void drm_fbdev_dma_fb_destroy(struct fb_info *info)
|
||||
static int drm_fbdev_dma_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
|
||||
{
|
||||
struct drm_fb_helper *fb_helper = info->par;
|
||||
struct drm_device *dev = fb_helper->dev;
|
||||
|
||||
if (drm_WARN_ON_ONCE(dev, !fb_helper->dev->driver->gem_prime_mmap))
|
||||
return -ENODEV;
|
||||
|
||||
return fb_helper->dev->driver->gem_prime_mmap(fb_helper->buffer->gem, vma);
|
||||
return drm_gem_prime_mmap(fb_helper->buffer->gem, vma);
|
||||
}
|
||||
|
||||
static const struct fb_ops drm_fbdev_dma_fb_ops = {
|
||||
|
@ -715,8 +715,6 @@ EXPORT_SYMBOL(drm_gem_dmabuf_vunmap);
|
||||
* the same codepath that is used for regular GEM buffer mapping on the DRM fd.
|
||||
* The fake GEM offset is added to vma->vm_pgoff and &drm_driver->fops->mmap is
|
||||
* called to set up the mapping.
|
||||
*
|
||||
* Drivers can use this as their &drm_driver.gem_prime_mmap callback.
|
||||
*/
|
||||
int drm_gem_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma)
|
||||
{
|
||||
@ -772,25 +770,17 @@ EXPORT_SYMBOL(drm_gem_prime_mmap);
|
||||
* @vma: virtual address range
|
||||
*
|
||||
* Provides memory mapping for the buffer. This can be used as the
|
||||
* &dma_buf_ops.mmap callback. It just forwards to &drm_driver.gem_prime_mmap,
|
||||
* which should be set to drm_gem_prime_mmap().
|
||||
*
|
||||
* FIXME: There's really no point to this wrapper, drivers which need anything
|
||||
* else but drm_gem_prime_mmap can roll their own &dma_buf_ops.mmap callback.
|
||||
* &dma_buf_ops.mmap callback. It just forwards to drm_gem_prime_mmap().
|
||||
*
|
||||
* Returns 0 on success or a negative error code on failure.
|
||||
*/
|
||||
int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf, struct vm_area_struct *vma)
|
||||
{
|
||||
struct drm_gem_object *obj = dma_buf->priv;
|
||||
struct drm_device *dev = obj->dev;
|
||||
|
||||
dma_resv_assert_held(dma_buf->resv);
|
||||
|
||||
if (!dev->driver->gem_prime_mmap)
|
||||
return -ENOSYS;
|
||||
|
||||
return dev->driver->gem_prime_mmap(obj, vma);
|
||||
return drm_gem_prime_mmap(obj, vma);
|
||||
}
|
||||
EXPORT_SYMBOL(drm_gem_dmabuf_mmap);
|
||||
|
||||
|
@ -484,7 +484,6 @@ static const struct drm_driver etnaviv_drm_driver = {
|
||||
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
|
||||
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
|
||||
.gem_prime_import_sg_table = etnaviv_gem_prime_import_sg_table,
|
||||
.gem_prime_mmap = drm_gem_prime_mmap,
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
.debugfs_init = etnaviv_debugfs_init,
|
||||
#endif
|
||||
|
@ -113,7 +113,6 @@ static const struct drm_driver exynos_drm_driver = {
|
||||
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
|
||||
.gem_prime_import = exynos_drm_gem_prime_import,
|
||||
.gem_prime_import_sg_table = exynos_drm_gem_prime_import_sg_table,
|
||||
.gem_prime_mmap = drm_gem_prime_mmap,
|
||||
.ioctls = exynos_ioctls,
|
||||
.num_ioctls = ARRAY_SIZE(exynos_ioctls),
|
||||
.fops = &exynos_drm_driver_fops,
|
||||
|
@ -63,7 +63,6 @@ static const struct drm_driver hibmc_driver = {
|
||||
.debugfs_init = drm_vram_mm_debugfs_init,
|
||||
.dumb_create = hibmc_dumb_create,
|
||||
.dumb_map_offset = drm_gem_ttm_dumb_map_offset,
|
||||
.gem_prime_mmap = drm_gem_prime_mmap,
|
||||
};
|
||||
|
||||
static int __maybe_unused hibmc_pm_suspend(struct device *dev)
|
||||
|
@ -279,7 +279,6 @@ static const struct drm_driver lima_drm_driver = {
|
||||
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
|
||||
.gem_prime_import_sg_table = drm_gem_shmem_prime_import_sg_table,
|
||||
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
|
||||
.gem_prime_mmap = drm_gem_prime_mmap,
|
||||
};
|
||||
|
||||
struct lima_block_reader {
|
||||
|
@ -560,7 +560,6 @@ static const struct drm_driver mtk_drm_driver = {
|
||||
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
|
||||
.gem_prime_import = mtk_drm_gem_prime_import,
|
||||
.gem_prime_import_sg_table = mtk_gem_prime_import_sg_table,
|
||||
.gem_prime_mmap = drm_gem_prime_mmap,
|
||||
.fops = &mtk_drm_fops,
|
||||
|
||||
.name = DRIVER_NAME,
|
||||
|
@ -1089,7 +1089,6 @@ static const struct drm_driver msm_driver = {
|
||||
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
|
||||
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
|
||||
.gem_prime_import_sg_table = msm_gem_prime_import_sg_table,
|
||||
.gem_prime_mmap = msm_gem_prime_mmap,
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
.debugfs_init = msm_debugfs_init,
|
||||
#endif
|
||||
|
@ -282,7 +282,6 @@ unsigned long msm_gem_shrinker_shrink(struct drm_device *dev, unsigned long nr_t
|
||||
void msm_gem_shrinker_init(struct drm_device *dev);
|
||||
void msm_gem_shrinker_cleanup(struct drm_device *dev);
|
||||
|
||||
int msm_gem_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma);
|
||||
struct sg_table *msm_gem_prime_get_sg_table(struct drm_gem_object *obj);
|
||||
int msm_gem_prime_vmap(struct drm_gem_object *obj, struct iosys_map *map);
|
||||
void msm_gem_prime_vunmap(struct drm_gem_object *obj, struct iosys_map *map);
|
||||
|
@ -11,11 +11,6 @@
|
||||
#include "msm_drv.h"
|
||||
#include "msm_gem.h"
|
||||
|
||||
int msm_gem_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma)
|
||||
{
|
||||
return drm_gem_prime_mmap(obj, vma);
|
||||
}
|
||||
|
||||
struct sg_table *msm_gem_prime_get_sg_table(struct drm_gem_object *obj)
|
||||
{
|
||||
struct msm_gem_object *msm_obj = to_msm_bo(obj);
|
||||
|
@ -1237,7 +1237,6 @@ driver_stub = {
|
||||
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
|
||||
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
|
||||
.gem_prime_import_sg_table = nouveau_gem_prime_import_sg_table,
|
||||
.gem_prime_mmap = drm_gem_prime_mmap,
|
||||
|
||||
.dumb_create = nouveau_display_dumb_create,
|
||||
.dumb_map_offset = drm_gem_ttm_dumb_map_offset,
|
||||
|
@ -542,7 +542,6 @@ static const struct drm_driver panfrost_drm_driver = {
|
||||
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
|
||||
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
|
||||
.gem_prime_import_sg_table = panfrost_gem_prime_import_sg_table,
|
||||
.gem_prime_mmap = drm_gem_prime_mmap,
|
||||
};
|
||||
|
||||
static int panfrost_probe(struct platform_device *pdev)
|
||||
|
@ -227,7 +227,6 @@ static const struct drm_driver pl111_drm_driver = {
|
||||
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
|
||||
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
|
||||
.gem_prime_import_sg_table = pl111_gem_import_sg_table,
|
||||
.gem_prime_mmap = drm_gem_prime_mmap,
|
||||
|
||||
#if defined(CONFIG_DEBUG_FS)
|
||||
.debugfs_init = pl111_debugfs_init,
|
||||
|
@ -607,7 +607,6 @@ static const struct drm_driver kms_driver = {
|
||||
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
|
||||
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
|
||||
.gem_prime_import_sg_table = radeon_gem_prime_import_sg_table,
|
||||
.gem_prime_mmap = drm_gem_prime_mmap,
|
||||
|
||||
.name = DRIVER_NAME,
|
||||
.desc = DRIVER_DESC,
|
||||
|
@ -651,7 +651,6 @@ static const struct drm_driver rcar_du_driver = {
|
||||
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
|
||||
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
|
||||
.gem_prime_import_sg_table = rcar_du_gem_prime_import_sg_table,
|
||||
.gem_prime_mmap = drm_gem_prime_mmap,
|
||||
.fops = &rcar_du_fops,
|
||||
.name = "rcar-du",
|
||||
.desc = "Renesas R-Car Display Unit",
|
||||
|
@ -227,7 +227,6 @@ static const struct drm_driver rockchip_drm_driver = {
|
||||
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
|
||||
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
|
||||
.gem_prime_import_sg_table = rockchip_gem_prime_import_sg_table,
|
||||
.gem_prime_mmap = drm_gem_prime_mmap,
|
||||
.fops = &rockchip_drm_driver_fops,
|
||||
.name = DRIVER_NAME,
|
||||
.desc = DRIVER_DESC,
|
||||
|
@ -174,7 +174,6 @@ static const struct drm_driver v3d_drm_driver = {
|
||||
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
|
||||
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
|
||||
.gem_prime_import_sg_table = v3d_prime_import_sg_table,
|
||||
.gem_prime_mmap = drm_gem_prime_mmap,
|
||||
|
||||
.ioctls = v3d_drm_ioctls,
|
||||
.num_ioctls = ARRAY_SIZE(v3d_drm_ioctls),
|
||||
|
@ -188,7 +188,6 @@ static const struct drm_driver driver = {
|
||||
#endif
|
||||
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
|
||||
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
|
||||
.gem_prime_mmap = drm_gem_prime_mmap,
|
||||
.gem_prime_import = virtgpu_gem_prime_import,
|
||||
.gem_prime_import_sg_table = virtgpu_gem_prime_import_sg_table,
|
||||
|
||||
|
@ -477,7 +477,6 @@ static const struct drm_driver xen_drm_driver = {
|
||||
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
|
||||
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
|
||||
.gem_prime_import_sg_table = xen_drm_front_gem_import_sg_table,
|
||||
.gem_prime_mmap = drm_gem_prime_mmap,
|
||||
.dumb_create = xen_drm_drv_dumb_create,
|
||||
.fops = &xen_drm_dev_fops,
|
||||
.name = "xendrm-du",
|
||||
|
@ -343,20 +343,6 @@ struct drm_driver {
|
||||
struct drm_device *dev,
|
||||
struct dma_buf_attachment *attach,
|
||||
struct sg_table *sgt);
|
||||
/**
|
||||
* @gem_prime_mmap:
|
||||
*
|
||||
* mmap hook for GEM drivers, used to implement dma-buf mmap in the
|
||||
* PRIME helpers.
|
||||
*
|
||||
* This hook only exists for historical reasons. Drivers must use
|
||||
* drm_gem_prime_mmap() to implement it.
|
||||
*
|
||||
* FIXME: Convert all drivers to implement mmap in struct
|
||||
* &drm_gem_object_funcs and inline drm_gem_prime_mmap() into
|
||||
* its callers. This hook should be removed afterwards.
|
||||
*/
|
||||
int (*gem_prime_mmap)(struct drm_gem_object *obj, struct vm_area_struct *vma);
|
||||
|
||||
/**
|
||||
* @dumb_create:
|
||||
|
@ -169,8 +169,7 @@ drm_gem_dma_prime_import_sg_table(struct drm_device *dev,
|
||||
.dumb_create = (dumb_create_func), \
|
||||
.prime_handle_to_fd = drm_gem_prime_handle_to_fd, \
|
||||
.prime_fd_to_handle = drm_gem_prime_fd_to_handle, \
|
||||
.gem_prime_import_sg_table = drm_gem_dma_prime_import_sg_table, \
|
||||
.gem_prime_mmap = drm_gem_prime_mmap
|
||||
.gem_prime_import_sg_table = drm_gem_dma_prime_import_sg_table
|
||||
|
||||
/**
|
||||
* DRM_GEM_DMA_DRIVER_OPS - DMA GEM driver operations
|
||||
@ -207,8 +206,7 @@ drm_gem_dma_prime_import_sg_table(struct drm_device *dev,
|
||||
.dumb_create = dumb_create_func, \
|
||||
.prime_handle_to_fd = drm_gem_prime_handle_to_fd, \
|
||||
.prime_fd_to_handle = drm_gem_prime_fd_to_handle, \
|
||||
.gem_prime_import_sg_table = drm_gem_dma_prime_import_sg_table_vmap, \
|
||||
.gem_prime_mmap = drm_gem_prime_mmap
|
||||
.gem_prime_import_sg_table = drm_gem_dma_prime_import_sg_table_vmap
|
||||
|
||||
/**
|
||||
* DRM_GEM_DMA_DRIVER_OPS_VMAP - DMA GEM driver operations ensuring a virtual
|
||||
|
@ -293,7 +293,6 @@ int drm_gem_shmem_dumb_create(struct drm_file *file, struct drm_device *dev,
|
||||
.prime_handle_to_fd = drm_gem_prime_handle_to_fd, \
|
||||
.prime_fd_to_handle = drm_gem_prime_fd_to_handle, \
|
||||
.gem_prime_import_sg_table = drm_gem_shmem_prime_import_sg_table, \
|
||||
.gem_prime_mmap = drm_gem_prime_mmap, \
|
||||
.dumb_create = drm_gem_shmem_dumb_create
|
||||
|
||||
#endif /* __DRM_GEM_SHMEM_HELPER_H__ */
|
||||
|
@ -160,7 +160,6 @@ void drm_gem_vram_simple_display_pipe_cleanup_fb(
|
||||
.debugfs_init = drm_vram_mm_debugfs_init, \
|
||||
.dumb_create = drm_gem_vram_driver_dumb_create, \
|
||||
.dumb_map_offset = drm_gem_ttm_dumb_map_offset, \
|
||||
.gem_prime_mmap = drm_gem_prime_mmap, \
|
||||
.prime_handle_to_fd = drm_gem_prime_handle_to_fd, \
|
||||
.prime_fd_to_handle = drm_gem_prime_fd_to_handle
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user