Skip to contentSkip to conversation

Add TTM functionality and drm exports for vmwgfx

PATCH Applied Thomas Hellstrom 2 participants 7 messages Dec 6, 2009 – Dec 7, 2009

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

cover Add TTM functionality and drm exports for vmwgfx

This patch series adds TTM functionality and a couple of drm exports needed by the vmwgfx drm driver. The patch adding the vmwgfx driver itself will be posted later. The current driver source is available at

git://git.freedesktop.org/git/mesa/vmwgfx

#1 lore raw

PATCH 1/5 drm/ttm: Add user-space objects.

Add objects needed for user-space to maintain reference counts on ttm objects. This is used by the vmwgfx driver which allows user-space to maintain map-counts on dma buffers, lock-counts on the ttm lock and ref-counts on gpu surfaces, gpu contexts and dma buffer.

---
 drivers/gpu/drm/ttm/Makefile     |    3 +-
 drivers/gpu/drm/ttm/ttm_object.c |  452 ++++++++++++++++++++++++++++++++++++++
 include/drm/ttm/ttm_object.h     |  267 ++++++++++++++++++++++
 3 files changed, 721 insertions(+), 1 deletions(-)
 create mode 100644 drivers/gpu/drm/ttm/ttm_object.c
 create mode 100644 include/drm/ttm/ttm_object.h
drivers/gpu/drm/ttm/Makefile +2 -1
index b0a9de7..a9cc9f8 100644
@@ -3,6 +3,7 @@
 
 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
+	ttm_bo_util.o ttm_bo_vm.o ttm_module.o ttm_global.o \
+	ttm_object.o
 
 obj-$(CONFIG_DRM_TTM) += ttm.o
drivers/gpu/drm/ttm/ttm_object.c new file +452 -0

452 lines not on this page · raw message

include/drm/ttm/ttm_object.h new file +267 -0

267 lines not on this page · raw message

Signature · 1 line
1.5.3.2
#2 lore raw

PATCH 2/5 drm/ttm: Add ttm lock functionality.

This is intended to be used by ttm-aware drivers to
1) Block clients to inactive masters when they try to validate buffers for GPU use.
2) Optionally block clients to the current master when there is thrashing due to GPU memory shortage.

Used by the vmwgfx driver.

---
 drivers/gpu/drm/ttm/Makefile   |    2 +-
 drivers/gpu/drm/ttm/ttm_lock.c |  311 ++++++++++++++++++++++++++++++++++++++++
 include/drm/ttm/ttm_lock.h     |  247 +++++++++++++++++++++++++++++++
 3 files changed, 559 insertions(+), 1 deletions(-)
 create mode 100644 drivers/gpu/drm/ttm/ttm_lock.c
 create mode 100644 include/drm/ttm/ttm_lock.h
drivers/gpu/drm/ttm/Makefile +1 -1
index a9cc9f8..4473549 100644
@@ -4,6 +4,6 @@
 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 \
-	ttm_object.o
+	ttm_object.o ttm_lock.o
 
 obj-$(CONFIG_DRM_TTM) += ttm.o
drivers/gpu/drm/ttm/ttm_lock.c new file +311 -0

311 lines not on this page · raw message

include/drm/ttm/ttm_lock.h new file +247 -0

247 lines not on this page · raw message

Signature · 1 line
1.5.3.2
#3 lore raw

PATCH 3/5 drm/ttm: Add TTM execbuf utilities.

Utilities to reserve, unreserve and fence a list of TTM buffer objects in a deadlock-safe manner.

Used by the vmwgfx driver.

---
 drivers/gpu/drm/ttm/Makefile           |    2 +-
 drivers/gpu/drm/ttm/ttm_execbuf_util.c |  117 ++++++++++++++++++++++++++++++++
 include/drm/ttm/ttm_execbuf_util.h     |  107 +++++++++++++++++++++++++++++
 3 files changed, 225 insertions(+), 1 deletions(-)
 create mode 100644 drivers/gpu/drm/ttm/ttm_execbuf_util.c
 create mode 100644 include/drm/ttm/ttm_execbuf_util.h
drivers/gpu/drm/ttm/Makefile +1 -1
index 4473549..1e138f5 100644
@@ -4,6 +4,6 @@
 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 \
-	ttm_object.o ttm_lock.o
+	ttm_object.o ttm_lock.o ttm_execbuf_util.o
 
 obj-$(CONFIG_DRM_TTM) += ttm.o
drivers/gpu/drm/ttm/ttm_execbuf_util.c new file +117 -0

117 lines not on this page · raw message

include/drm/ttm/ttm_execbuf_util.h new file +107 -0

107 lines not on this page · raw message

Signature · 1 line
1.5.3.2
#4 lore raw

PATCH 4/5 drm/ttm: Export symbols needed for the vmwgfx driver.

---
 drivers/gpu/drm/ttm/ttm_bo_util.c |    1 +
 drivers/gpu/drm/ttm/ttm_memory.c  |    3 +++
 drivers/gpu/drm/ttm/ttm_tt.c      |    1 +
 include/drm/ttm/ttm_bo_driver.h   |    9 +++++++++
 4 files changed, 14 insertions(+), 0 deletions(-)
drivers/gpu/drm/ttm/ttm_bo_util.c +1 -0
index c70927e..ceae52f 100644
@@ -369,6 +369,7 @@ pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp)
 #endif
 	return tmp;
 }
+EXPORT_SYMBOL(ttm_io_prot);
 
 static int ttm_bo_ioremap(struct ttm_buffer_object *bo,
 			  unsigned long bus_base,
drivers/gpu/drm/ttm/ttm_memory.c +3 -0
index 072c281..716d0ed 100644
@@ -460,6 +460,7 @@ void ttm_mem_global_free(struct ttm_mem_global *glob,
 {
 	return ttm_mem_global_free_zone(glob, NULL, amount);
 }
+EXPORT_SYMBOL(ttm_mem_global_free);
 
 static int ttm_mem_global_reserve(struct ttm_mem_global *glob,
 				  struct ttm_mem_zone *single_zone,
@@ -533,6 +534,7 @@ int ttm_mem_global_alloc(struct ttm_mem_global *glob, uint64_t memory,
 	return ttm_mem_global_alloc_zone(glob, NULL, memory, no_wait,
 					 interruptible);
 }
+EXPORT_SYMBOL(ttm_mem_global_alloc);
 
 int ttm_mem_global_alloc_page(struct ttm_mem_global *glob,
 			      struct page *page,
@@ -588,3 +590,4 @@ size_t ttm_round_pot(size_t size)
 	}
 	return 0;
 }
+EXPORT_SYMBOL(ttm_round_pot);
drivers/gpu/drm/ttm/ttm_tt.c +1 -0
index 7bcb89f..9c2b1cc 100644
@@ -192,6 +192,7 @@ int ttm_tt_populate(struct ttm_tt *ttm)
 	ttm->state = tt_unbound;
 	return 0;
 }
+EXPORT_SYMBOL(ttm_tt_populate);
 
 #ifdef CONFIG_X86
 static inline int ttm_tt_set_page_caching(struct page *p,
include/drm/ttm/ttm_bo_driver.h +9 -0
index d260a87..67355a1 100644
@@ -545,6 +545,15 @@ extern int ttm_tt_set_user(struct ttm_tt *ttm,
 extern int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem);
 
 /**
+ * ttm_tt_populate:
+ *
+ * @ttm: The struct ttm_tt to contain the backing pages.
+ *
+ * Add backing pages to all of @ttm
+ */
+extern int ttm_tt_populate(struct ttm_tt *ttm);
+
+/**
  * ttm_ttm_destroy:
  *
  * @ttm: The struct ttm_tt.
Signature · 1 line
1.5.3.2
#5 lore raw

PATCH 5/5 drm: Export symbols needed for the vmwgfx driver.

---
 drivers/gpu/drm/drm_stub.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/gpu/drm/drm_stub.c +2 -0
index 2c1b528..ad73e14 100644
@@ -128,6 +128,7 @@ struct drm_master *drm_master_get(struct drm_master *master)
 	kref_get(&master->refcount);
 	return master;
 }
+EXPORT_SYMBOL(drm_master_get);
 
 static void drm_master_destroy(struct kref *kref)
 {
@@ -170,6 +171,7 @@ void drm_master_put(struct drm_master **master)
 	kref_put(&(*master)->refcount, drm_master_destroy);
 	*master = NULL;
 }
+EXPORT_SYMBOL(drm_master_put);
 
 int drm_setmaster_ioctl(struct drm_device *dev, void *data,
 			struct drm_file *file_priv)
Signature · 1 line
1.5.3.2
maintainer Applied
#6 lore raw
In reply to Thomas Hellstrom
Quoted 5 lines · Thomas Hellstrom

This patch series adds TTM functionality and a couple of drm exports needed by the vmwgfx drm driver. The patch adding the vmwgfx driver itself will be posted later. The current driver source is available at

git://git.freedesktop.org/git/mesa/vmwgfx

Applied all of these to drm-core-next,

Thanks,
Dave.