Skip to content

drm/{ttm,xe}: Improve ttm_bo_vmap() and update xe

Thomas Zimmermann dri-devel intel-gfx intel-xe 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6iosys-map: Add allocator flagsinclude/linux/iosys-map.h+12 -10 replies
2/6drm/ttm: Store the bo_kmap_type in struct iosys_mapdrivers/gpu/drm/ttm/ttm_bo_util.c+31 -153 replies
3/6drm/ttm: Support partial buffer mappings for ttm_bo_vmap()drivers/gpu/drm/drm_gem_ttm_helper.c drivers/gpu/drm/drm_gem_vram_helper.c drivers/gpu/drm/loongson/lsdc_gem.c +5 more+24 -132 replies
4/6drm/ttm: Support kmap for single-page mappings in ttm_bo_vmap()drivers/gpu/drm/ttm/ttm_bo_util.c+24 -90 replies
5/6drm/xe: Remove vunmap calls object-freeing codedrivers/gpu/drm/xe/display/intel_fb_bo.c drivers/gpu/drm/xe/xe_bo.c drivers/gpu/drm/xe/xe_bo.h +1 more+33 -170 replies
6/6drm/xe: Replace ttm_bo_kmap() with ttm_bo_vmap()drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_object.h drivers/gpu/drm/xe/xe_bo.c drivers/gpu/drm/xe/xe_bo_types.h+10 -410 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/6] drm/{ttm,xe}: Improve ttm_bo_vmap() and update xe

Add ttm_bo_kmap()'s features to ttm_bo_vmap() and convert xe to use the latter helper. ttm_bo_vmap() returns mappings in an instance of struct iosys_map, which simplifies driver code in several places.

Patches 1 and 2 allow ttm_bo_vmap() to store the method of allocation in the iosys_map instance. This simplifies the unmap and driver code.

Patch 3 adds support for partial mappings to ttm_bo_vmap(). That's another feature of ttm_bo_kmap(). It is now possible to map only a subrange of a buffer object's memory buffer. This requires a trivial change to existing callers, so that they still map the full buffer range.

Patch 4 adds support for kmap()-based mappings in certain cases to ttm_bo_vmap().

Patches 5 and 6 convert xe to ttm_bo_vmap(). ttm_bo_vmap() tests if the caller holds the object's reservation lock; and therefore cannot be called while relasing the buffer object. Patch 5 resolves this problem in xe. Patch 6 then replaces ttm_bo_kmap() with ttm_bo_vmap() and also updates the callers to use struct iosys_map everywhere.

Tested on Intel ARC hardware.

Future direction: DRM's TTM-based drivers use a mixture of ttm_bo_kmap() and ttm_bo_vmap(). After merging these updates for ttm_bo_vmap(), the other drivers can be converted and ttm_bo_kmap() can be removed.

Thomas Zimmermann (6):
iosys-map: Add allocator flags
drm/ttm: Store the bo_kmap_type in struct iosys_map drm/ttm: Support partial buffer mappings for ttm_bo_vmap() drm/ttm: Support kmap for single-page mappings in ttm_bo_vmap() drm/xe: Remove vunmap calls object-freeing code drm/xe: Replace ttm_bo_kmap() with ttm_bo_vmap()

 drivers/gpu/drm/drm_gem_ttm_helper.c          |  2 +-
 drivers/gpu/drm/drm_gem_vram_helper.c         |  2 +-
 drivers/gpu/drm/loongson/lsdc_gem.c           |  2 +-
 drivers/gpu/drm/qxl/qxl_object.c              |  2 +-
 drivers/gpu/drm/ttm/ttm_bo_util.c             | 94 +++++++++++++------
 .../compat-i915-headers/gem/i915_gem_object.h | 17 +---
 drivers/gpu/drm/xe/display/intel_fb_bo.c      | 12 ++-
 drivers/gpu/drm/xe/xe_bo.c                    | 46 ++++-----
 drivers/gpu/drm/xe/xe_bo.h                    | 23 ++---
 drivers/gpu/drm/xe/xe_bo_types.h              |  2 -
 drivers/gpu/drm/xe/xe_lrc.c                   |  3 +-
 drivers/gpu/drm/xe/xe_vm.c                    |  2 +-
 include/drm/ttm/ttm_bo.h                      |  4 +-
 include/linux/iosys-map.h                     | 13 ++-
 14 files changed, 131 insertions(+), 93 deletions(-)
Signature · 1 line
2.45.2