aboutsummaryrefslogtreecommitdiffstats
path: root/include/drm/ttm
diff options
context:
space:
mode:
authorJerome Glisse <jglisse@redhat.com>2011-11-02 23:59:28 -0400
committerDave Airlie <airlied@redhat.com>2011-12-06 05:39:24 -0500
commitb1e5f172325547270f35e7d1e42416a606e1dbd2 (patch)
tree03fc21fd5f74add89441308008b45987d09cfbc6 /include/drm/ttm
parent649bf3ca77343e3be1e0af8e21356fa569b1abd9 (diff)
drm/ttm: introduce callback for ttm_tt populate & unpopulate V4
Move the page allocation and freeing to driver callback and provide ttm code helper function for those. Most intrusive change, is the fact that we now only fully populate an object this simplify some of code designed around the page fault design. V2 Rebase on top of memory accounting overhaul V3 New rebase on top of more memory accouting changes V4 Rebase on top of no memory account changes (where/when is my delorean when i need it ?) Signed-off-by: Jerome Glisse <jglisse@redhat.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Diffstat (limited to 'include/drm/ttm')
-rw-r--r--include/drm/ttm/ttm_bo_driver.h41
-rw-r--r--include/drm/ttm/ttm_page_alloc.h18
2 files changed, 41 insertions, 18 deletions
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 6b8c5cd690a0..ae06e421cf90 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -319,6 +319,26 @@ struct ttm_bo_driver {
319 struct page *dummy_read_page); 319 struct page *dummy_read_page);
320 320
321 /** 321 /**
322 * ttm_tt_populate
323 *
324 * @ttm: The struct ttm_tt to contain the backing pages.
325 *
326 * Allocate all backing pages
327 * Returns:
328 * -ENOMEM: Out of memory.
329 */
330 int (*ttm_tt_populate)(struct ttm_tt *ttm);
331
332 /**
333 * ttm_tt_unpopulate
334 *
335 * @ttm: The struct ttm_tt to contain the backing pages.
336 *
337 * Free all backing page
338 */
339 void (*ttm_tt_unpopulate)(struct ttm_tt *ttm);
340
341 /**
322 * struct ttm_bo_driver member invalidate_caches 342 * struct ttm_bo_driver member invalidate_caches
323 * 343 *
324 * @bdev: the buffer object device. 344 * @bdev: the buffer object device.
@@ -585,15 +605,6 @@ extern int ttm_tt_init(struct ttm_tt *ttm, struct ttm_bo_device *bdev,
585extern int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem); 605extern int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem);
586 606
587/** 607/**
588 * ttm_tt_populate:
589 *
590 * @ttm: The struct ttm_tt to contain the backing pages.
591 *
592 * Add backing pages to all of @ttm
593 */
594extern int ttm_tt_populate(struct ttm_tt *ttm);
595
596/**
597 * ttm_ttm_destroy: 608 * ttm_ttm_destroy:
598 * 609 *
599 * @ttm: The struct ttm_tt. 610 * @ttm: The struct ttm_tt.
@@ -612,19 +623,13 @@ extern void ttm_tt_destroy(struct ttm_tt *ttm);
612extern void ttm_tt_unbind(struct ttm_tt *ttm); 623extern void ttm_tt_unbind(struct ttm_tt *ttm);
613 624
614/** 625/**
615 * ttm_ttm_destroy: 626 * ttm_tt_swapin:
616 * 627 *
617 * @ttm: The struct ttm_tt. 628 * @ttm: The struct ttm_tt.
618 * @index: Index of the desired page.
619 * 629 *
620 * Return a pointer to the struct page backing @ttm at page 630 * Swap in a previously swap out ttm_tt.
621 * index @index. If the page is unpopulated, one will be allocated to
622 * populate that index.
623 *
624 * Returns:
625 * NULL on OOM.
626 */ 631 */
627extern struct page *ttm_tt_get_page(struct ttm_tt *ttm, int index); 632extern int ttm_tt_swapin(struct ttm_tt *ttm);
628 633
629/** 634/**
630 * ttm_tt_cache_flush: 635 * ttm_tt_cache_flush:
diff --git a/include/drm/ttm/ttm_page_alloc.h b/include/drm/ttm/ttm_page_alloc.h
index fe61c8d85684..18deeee23494 100644
--- a/include/drm/ttm/ttm_page_alloc.h
+++ b/include/drm/ttm/ttm_page_alloc.h
@@ -68,6 +68,24 @@ int ttm_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages);
68void ttm_page_alloc_fini(void); 68void ttm_page_alloc_fini(void);
69 69
70/** 70/**
71 * ttm_pool_populate:
72 *
73 * @ttm: The struct ttm_tt to contain the backing pages.
74 *
75 * Add backing pages to all of @ttm
76 */
77extern int ttm_pool_populate(struct ttm_tt *ttm);
78
79/**
80 * ttm_pool_unpopulate:
81 *
82 * @ttm: The struct ttm_tt which to free backing pages.
83 *
84 * Free all pages of @ttm
85 */
86extern void ttm_pool_unpopulate(struct ttm_tt *ttm);
87
88/**
71 * Output the state of pools to debugfs file 89 * Output the state of pools to debugfs file
72 */ 90 */
73extern int ttm_page_alloc_debugfs(struct seq_file *m, void *data); 91extern int ttm_page_alloc_debugfs(struct seq_file *m, void *data);