Skip to contentSkip to conversation

drm: Add the TTM GPU memory manager subsystem.

RFC PATCH New Thomas Hellstrom 1 participant 1 message Jun 10, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 drm: Add the TTM GPU memory manager subsystem.

TTM is a GPU memory manager subsystem designed for use with GPU devices with various memory types (On-card VRAM, AGP, PCI apertures etc.). It's essentially a helper library that assists the DRM driver in creating and managing persistent buffer objects.

TTM manages placement of data and CPU map setup and teardown on data movement. It can also optionally manage synchronization of data on a per-buffer-object level.

TTM takes care to provide an always valid virtual user-space address to a buffer object which makes user-space sub-allocation of big buffer objects feasible.

TTM uses a fine-grained per buffer-object locking scheme, taking care to release all relevant locks when waiting for the GPU. Although this implies some locking overhead, it's probably a big win for devices with multiple command submission mechanisms, since the lock contention will be minimal.

TTM can be used with whatever user-space interface the driver chooses, including GEM. It's used by the upcoming Radeon KMS DRM driver and is also the GPU memory management core of various new experimental DRM drivers.

---
 drivers/gpu/drm/Kconfig               |    8 +
 drivers/gpu/drm/Makefile              |    2 +-
 drivers/gpu/drm/ttm/Makefile          |    9 +
 drivers/gpu/drm/ttm/ttm_agp_backend.c |  150 +++
 drivers/gpu/drm/ttm/ttm_bo.c          | 1698 +++++++++++++++++++++++++++++++++
 drivers/gpu/drm/ttm/ttm_bo_util.c     |  561 +++++++++++
 drivers/gpu/drm/ttm/ttm_bo_vm.c       |  454 +++++++++
 drivers/gpu/drm/ttm/ttm_global.c      |  114 +++
 drivers/gpu/drm/ttm/ttm_memory.c      |  234 +++++
 drivers/gpu/drm/ttm/ttm_module.c      |   50 +
 drivers/gpu/drm/ttm/ttm_tt.c          |  635 ++++++++++++
 include/drm/ttm/ttm_bo_api.h          |  618 ++++++++++++
 include/drm/ttm/ttm_bo_driver.h       |  867 +++++++++++++++++
 include/drm/ttm/ttm_memory.h          |  153 +++
 include/drm/ttm/ttm_module.h          |   58 ++
 include/drm/ttm/ttm_placement.h       |   92 ++
 16 files changed, 5702 insertions(+), 1 deletions(-)
 create mode 100644 drivers/gpu/drm/ttm/Makefile
 create mode 100644 drivers/gpu/drm/ttm/ttm_agp_backend.c
 create mode 100644 drivers/gpu/drm/ttm/ttm_bo.c
 create mode 100644 drivers/gpu/drm/ttm/ttm_bo_util.c
 create mode 100644 drivers/gpu/drm/ttm/ttm_bo_vm.c
 create mode 100644 drivers/gpu/drm/ttm/ttm_global.c
 create mode 100644 drivers/gpu/drm/ttm/ttm_memory.c
 create mode 100644 drivers/gpu/drm/ttm/ttm_module.c
 create mode 100644 drivers/gpu/drm/ttm/ttm_tt.c
 create mode 100644 include/drm/ttm/ttm_bo_api.h
 create mode 100644 include/drm/ttm/ttm_bo_driver.h
 create mode 100644 include/drm/ttm/ttm_memory.h
 create mode 100644 include/drm/ttm/ttm_module.h
 create mode 100644 include/drm/ttm/ttm_placement.h
drivers/gpu/drm/Kconfig +8 -0
index f5d46e7..64a57ad 100644
@@ -18,6 +18,14 @@ menuconfig DRM
 	  details.  You should also select and configure AGP
 	  (/dev/agpgart) support.
 
+config DRM_TTM
+	tristate "TTM memory manager"
+	depends on DRM
+	help
+	  GPU memory management subsystem for devices with multiple
+	  GPU memory types. Will be enabled automatically if a device driver
+	  uses it.
+
 config DRM_TDFX
 	tristate "3dfx Banshee/Voodoo3+"
 	depends on DRM && PCI
drivers/gpu/drm/Makefile +1 -1
index 4ec5061..4e89ab0 100644
@@ -26,4 +26,4 @@ obj-$(CONFIG_DRM_I915)  += i915/
 obj-$(CONFIG_DRM_SIS)   += sis/
 obj-$(CONFIG_DRM_SAVAGE)+= savage/
 obj-$(CONFIG_DRM_VIA)	+=via/
-
+obj-$(CONFIG_DRM_TTM)	+= ttm/
drivers/gpu/drm/ttm/Makefile new file +9 -0
new file mode 100644
index 0000000..0686829
@@ -0,0 +1,9 @@
+#
+# Makefile for the drm device driver.  This driver provides support for the
+
+ccflags-y := -Iinclude/drm
+ttm-y := ttm_agp_backend.o ttm_memory.o ttm_tt.o ttm_bo.o \
+	ttm_bo_util.o ttm_bo_vm.o ttm_module.o ttm_global.o
+
+
+obj-m += ttm.o
drivers/gpu/drm/ttm/ttm_agp_backend.c new file +150 -0

150 lines not on this page · raw message

drivers/gpu/drm/ttm/ttm_bo.c new file +1698 -0

1,698 lines not on this page · raw message

drivers/gpu/drm/ttm/ttm_bo_util.c new file +561 -0

561 lines not on this page · raw message

drivers/gpu/drm/ttm/ttm_bo_vm.c new file +454 -0

454 lines not on this page · raw message

drivers/gpu/drm/ttm/ttm_global.c new file +114 -0

109 lines not on this page · raw message

drivers/gpu/drm/ttm/ttm_memory.c new file +234 -0

234 lines not on this page · raw message

drivers/gpu/drm/ttm/ttm_module.c new file +50 -0

50 lines not on this page · raw message

drivers/gpu/drm/ttm/ttm_tt.c new file +635 -0

635 lines not on this page · raw message

include/drm/ttm/ttm_bo_api.h new file +618 -0

618 lines not on this page · raw message

include/drm/ttm/ttm_bo_driver.h new file +867 -0

867 lines not on this page · raw message

include/drm/ttm/ttm_memory.h new file +153 -0

153 lines not on this page · raw message

include/drm/ttm/ttm_module.h new file +58 -0

58 lines not on this page · raw message

include/drm/ttm/ttm_placement.h new file +92 -0

92 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.6.2.2

Part of the diff is not shown here. View the raw message.