Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit e6303f3

Browse files
committed
drm: manager to keep track of GPUs VA mappings
Add infrastructure to keep track of GPU virtual address (VA) mappings with a decicated VA space manager implementation. New UAPIs, motivated by Vulkan sparse memory bindings graphics drivers start implementing, allow userspace applications to request multiple and arbitrary GPU VA mappings of buffer objects. The DRM GPU VA manager is intended to serve the following purposes in this context. 1) Provide infrastructure to track GPU VA allocations and mappings, using an interval tree (RB-tree). 2) Generically connect GPU VA mappings to their backing buffers, in particular DRM GEM objects. 3) Provide a common implementation to perform more complex mapping operations on the GPU VA space. In particular splitting and merging of GPU VA mappings, e.g. for intersecting mapping requests or partial unmap requests. Acked-by: Thomas Hellström <[email protected]> Acked-by: Matthew Brost <[email protected]> Reviewed-by: Boris Brezillon <[email protected]> Tested-by: Matthew Brost <[email protected]> Tested-by: Donald Robson <[email protected]> Suggested-by: Dave Airlie <[email protected]> Signed-off-by: Danilo Krummrich <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 41639b3 commit e6303f3

File tree

7 files changed

+2556
-0
lines changed

7 files changed

+2556
-0
lines changed

Documentation/gpu/drm-mm.rst

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,42 @@ DRM MM Range Allocator Function References
466466
.. kernel-doc:: drivers/gpu/drm/drm_mm.c
467467
:export:
468468

469+
DRM GPU VA Manager
470+
==================
471+
472+
Overview
473+
--------
474+
475+
.. kernel-doc:: drivers/gpu/drm/drm_gpuva_mgr.c
476+
:doc: Overview
477+
478+
Split and Merge
479+
---------------
480+
481+
.. kernel-doc:: drivers/gpu/drm/drm_gpuva_mgr.c
482+
:doc: Split and Merge
483+
484+
Locking
485+
-------
486+
487+
.. kernel-doc:: drivers/gpu/drm/drm_gpuva_mgr.c
488+
:doc: Locking
489+
490+
Examples
491+
--------
492+
493+
.. kernel-doc:: drivers/gpu/drm/drm_gpuva_mgr.c
494+
:doc: Examples
495+
496+
DRM GPU VA Manager Function References
497+
--------------------------------------
498+
499+
.. kernel-doc:: include/drm/drm_gpuva_mgr.h
500+
:internal:
501+
502+
.. kernel-doc:: drivers/gpu/drm/drm_gpuva_mgr.c
503+
:export:
504+
469505
DRM Buddy Allocator
470506
===================
471507

drivers/gpu/drm/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ drm-y := \
4545
drm_vblank.o \
4646
drm_vblank_work.o \
4747
drm_vma_manager.o \
48+
drm_gpuva_mgr.o \
4849
drm_writeback.o
4950
drm-$(CONFIG_DRM_LEGACY) += \
5051
drm_agpsupport.o \

drivers/gpu/drm/drm_gem.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,9 @@ void drm_gem_private_object_init(struct drm_device *dev,
164164
if (!obj->resv)
165165
obj->resv = &obj->_resv;
166166

167+
if (drm_core_check_feature(dev, DRIVER_GEM_GPUVA))
168+
drm_gem_gpuva_init(obj);
169+
167170
drm_vma_node_reset(&obj->vma_node);
168171
INIT_LIST_HEAD(&obj->lru_node);
169172
}

0 commit comments

Comments
 (0)