diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2010-08-04 20:48:18 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2010-10-04 20:01:20 -0400 |
commit | d961db75ce86a84f1f04e91ad1014653ed7d9f46 (patch) | |
tree | a827b77524fdc0c37da70936fbb0627ac7e4b492 /include | |
parent | 42311ff90dc8746bd81427b2ed6efda9af791b77 (diff) |
drm/ttm: restructure to allow driver to plug in alternate memory manager
Nouveau will need this on GeForce 8 and up to account for the GPU
reordering physical VRAM for some memory types.
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Acked-by: Thomas Hellström <thellstrom@vmware.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/drm/ttm/ttm_bo_api.h | 3 | ||||
-rw-r--r-- | include/drm/ttm/ttm_bo_driver.h | 21 |
2 files changed, 21 insertions, 3 deletions
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h index 267a86c74e2e..49b43c23636a 100644 --- a/include/drm/ttm/ttm_bo_api.h +++ b/include/drm/ttm/ttm_bo_api.h | |||
@@ -102,7 +102,8 @@ struct ttm_bus_placement { | |||
102 | */ | 102 | */ |
103 | 103 | ||
104 | struct ttm_mem_reg { | 104 | struct ttm_mem_reg { |
105 | struct drm_mm_node *mm_node; | 105 | void *mm_node; |
106 | unsigned long start; | ||
106 | unsigned long size; | 107 | unsigned long size; |
107 | unsigned long num_pages; | 108 | unsigned long num_pages; |
108 | uint32_t page_alignment; | 109 | uint32_t page_alignment; |
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index 6c694d86e03d..e3371dbe6a10 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h | |||
@@ -203,7 +203,22 @@ struct ttm_tt { | |||
203 | * It's set up by the ttm_bo_driver::init_mem_type method. | 203 | * It's set up by the ttm_bo_driver::init_mem_type method. |
204 | */ | 204 | */ |
205 | 205 | ||
206 | struct ttm_mem_type_manager; | ||
207 | |||
208 | struct ttm_mem_type_manager_func { | ||
209 | int (*init)(struct ttm_mem_type_manager *man, unsigned long p_size); | ||
210 | int (*takedown)(struct ttm_mem_type_manager *man); | ||
211 | int (*get_node)(struct ttm_mem_type_manager *man, | ||
212 | struct ttm_buffer_object *bo, | ||
213 | struct ttm_placement *placement, | ||
214 | struct ttm_mem_reg *mem); | ||
215 | void (*put_node)(struct ttm_mem_type_manager *man, | ||
216 | struct ttm_mem_reg *mem); | ||
217 | void (*debug)(struct ttm_mem_type_manager *man, const char *prefix); | ||
218 | }; | ||
219 | |||
206 | struct ttm_mem_type_manager { | 220 | struct ttm_mem_type_manager { |
221 | struct ttm_bo_device *bdev; | ||
207 | 222 | ||
208 | /* | 223 | /* |
209 | * No protection. Constant from start. | 224 | * No protection. Constant from start. |
@@ -222,8 +237,8 @@ struct ttm_mem_type_manager { | |||
222 | * TODO: Consider one lru_lock per ttm_mem_type_manager. | 237 | * TODO: Consider one lru_lock per ttm_mem_type_manager. |
223 | * Plays ill with list removal, though. | 238 | * Plays ill with list removal, though. |
224 | */ | 239 | */ |
225 | 240 | const struct ttm_mem_type_manager_func *func; | |
226 | struct drm_mm manager; | 241 | void *priv; |
227 | struct list_head lru; | 242 | struct list_head lru; |
228 | }; | 243 | }; |
229 | 244 | ||
@@ -895,6 +910,8 @@ extern int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo, | |||
895 | */ | 910 | */ |
896 | extern pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp); | 911 | extern pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp); |
897 | 912 | ||
913 | extern const struct ttm_mem_type_manager_func ttm_bo_manager_func; | ||
914 | |||
898 | #if (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE))) | 915 | #if (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE))) |
899 | #define TTM_HAS_AGP | 916 | #define TTM_HAS_AGP |
900 | #include <linux/agp_backend.h> | 917 | #include <linux/agp_backend.h> |