[PATCH 0/8] drm: Clean up mmap for TTM-based GEM drivers

Thomas Zimmermann tzimmermann at suse.de
Tue Apr 6 09:08:55 UTC 2021


Implement mmap via struct drm_gem_object_functions.mmap for amdgpu,
radeon and nouveau. This allows for using common DRM helpers for
the mmap-related callbacks in struct file_operations and struct
drm_driver. The drivers have their own vm_ops, which are now set
automatically by the DRM core functions. The code in each driver's
verify_access becomes part of the driver's new mmap implementation.

With the GEM drivers converted, vmwgfx is the only user of
ttm_bo_mmap() and related infrastructure. So move everything into
vmwgfx and delete the rsp code from TTM.

This touches several drivers. Preferably everything would be merged
at once via drm-misc-next.

Thomas Zimmermann (8):
  drm/ttm: Don't override vm_ops callbacks, if set
  drm/amdgpu: Remove unused function amdgpu_bo_fbdev_mmap()
  drm/amdgpu: Implement mmap as GEM object function
  drm/radeon: Implement mmap as GEM object function
  drm/nouveau: Implement mmap as GEM object function
  drm/vmwgfx: Inline ttm_bo_mmap() into vmwgfx driver
  drm/vmwgfx: Inline vmw_verify_access()
  drm/ttm: Remove ttm_bo_mmap() and friends

 drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 46 -------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.h |  2 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c     |  4 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c     | 64 +++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c  | 19 ------
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.h  |  2 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c     | 71 ---------------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h     |  1 -
 drivers/gpu/drm/nouveau/nouveau_bo.c        | 10 ---
 drivers/gpu/drm/nouveau/nouveau_drm.c       |  3 +-
 drivers/gpu/drm/nouveau/nouveau_gem.c       | 36 +++++++++++
 drivers/gpu/drm/nouveau/nouveau_ttm.c       | 49 --------------
 drivers/gpu/drm/nouveau/nouveau_ttm.h       |  1 -
 drivers/gpu/drm/radeon/radeon_drv.c         |  3 +-
 drivers/gpu/drm/radeon/radeon_gem.c         | 52 +++++++++++++++
 drivers/gpu/drm/radeon/radeon_ttm.c         | 65 -------------------
 drivers/gpu/drm/radeon/radeon_ttm.h         |  1 -
 drivers/gpu/drm/ttm/ttm_bo_vm.c             | 60 ++---------------
 drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c  |  9 ---
 drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c    | 51 ++++++++++++++-
 include/drm/ttm/ttm_bo_api.h                | 13 ----
 include/drm/ttm/ttm_device.h                | 15 -----
 22 files changed, 212 insertions(+), 365 deletions(-)

--
2.30.2



More information about the dri-devel mailing list