diff options
| author | Thomas Hellstrom <thellstrom@vmware.com> | 2010-10-29 04:46:44 -0400 |
|---|---|---|
| committer | Dave Airlie <airlied@redhat.com> | 2010-11-08 22:33:15 -0500 |
| commit | 3205bc242b5e3950c808049dbf199fca91f2c844 (patch) | |
| tree | 95f458f86be450a08a604ccecaf23867d8a1fef1 /include | |
| parent | f5d8e0eb7a4308f46faf570fb7da1952c68992c5 (diff) | |
drm/ttm: Documentation update
Remove an obsolete comment about mm nodes.
Document the new bo range manager interface.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'include')
| -rw-r--r-- | include/drm/ttm/ttm_bo_driver.h | 79 |
1 files changed, 74 insertions, 5 deletions
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index d01b4ddbdc56..8e0c848326b6 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h | |||
| @@ -206,14 +206,84 @@ struct ttm_tt { | |||
| 206 | struct ttm_mem_type_manager; | 206 | struct ttm_mem_type_manager; |
| 207 | 207 | ||
| 208 | struct ttm_mem_type_manager_func { | 208 | struct ttm_mem_type_manager_func { |
| 209 | /** | ||
| 210 | * struct ttm_mem_type_manager member init | ||
| 211 | * | ||
| 212 | * @man: Pointer to a memory type manager. | ||
| 213 | * @p_size: Implementation dependent, but typically the size of the | ||
| 214 | * range to be managed in pages. | ||
| 215 | * | ||
| 216 | * Called to initialize a private range manager. The function is | ||
| 217 | * expected to initialize the man::priv member. | ||
| 218 | * Returns 0 on success, negative error code on failure. | ||
| 219 | */ | ||
| 209 | int (*init)(struct ttm_mem_type_manager *man, unsigned long p_size); | 220 | int (*init)(struct ttm_mem_type_manager *man, unsigned long p_size); |
| 221 | |||
| 222 | /** | ||
| 223 | * struct ttm_mem_type_manager member takedown | ||
| 224 | * | ||
| 225 | * @man: Pointer to a memory type manager. | ||
| 226 | * | ||
| 227 | * Called to undo the setup done in init. All allocated resources | ||
| 228 | * should be freed. | ||
| 229 | */ | ||
| 210 | int (*takedown)(struct ttm_mem_type_manager *man); | 230 | int (*takedown)(struct ttm_mem_type_manager *man); |
| 231 | |||
| 232 | /** | ||
| 233 | * struct ttm_mem_type_manager member get_node | ||
| 234 | * | ||
| 235 | * @man: Pointer to a memory type manager. | ||
| 236 | * @bo: Pointer to the buffer object we're allocating space for. | ||
| 237 | * @placement: Placement details. | ||
| 238 | * @mem: Pointer to a struct ttm_mem_reg to be filled in. | ||
| 239 | * | ||
| 240 | * This function should allocate space in the memory type managed | ||
| 241 | * by @man. Placement details if | ||
| 242 | * applicable are given by @placement. If successful, | ||
| 243 | * @mem::mm_node should be set to a non-null value, and | ||
| 244 | * @mem::start should be set to a value identifying the beginning | ||
| 245 | * of the range allocated, and the function should return zero. | ||
| 246 | * If the memory region accomodate the buffer object, @mem::mm_node | ||
| 247 | * should be set to NULL, and the function should return 0. | ||
| 248 | * If a system error occured, preventing the request to be fulfilled, | ||
| 249 | * the function should return a negative error code. | ||
| 250 | * | ||
| 251 | * Note that @mem::mm_node will only be dereferenced by | ||
| 252 | * struct ttm_mem_type_manager functions and optionally by the driver, | ||
| 253 | * which has knowledge of the underlying type. | ||
| 254 | * | ||
| 255 | * This function may not be called from within atomic context, so | ||
| 256 | * an implementation can and must use either a mutex or a spinlock to | ||
| 257 | * protect any data structures managing the space. | ||
| 258 | */ | ||
| 211 | int (*get_node)(struct ttm_mem_type_manager *man, | 259 | int (*get_node)(struct ttm_mem_type_manager *man, |
| 212 | struct ttm_buffer_object *bo, | 260 | struct ttm_buffer_object *bo, |
| 213 | struct ttm_placement *placement, | 261 | struct ttm_placement *placement, |
| 214 | struct ttm_mem_reg *mem); | 262 | struct ttm_mem_reg *mem); |
| 263 | |||
| 264 | /** | ||
| 265 | * struct ttm_mem_type_manager member put_node | ||
| 266 | * | ||
| 267 | * @man: Pointer to a memory type manager. | ||
| 268 | * @mem: Pointer to a struct ttm_mem_reg to be filled in. | ||
| 269 | * | ||
| 270 | * This function frees memory type resources previously allocated | ||
| 271 | * and that are identified by @mem::mm_node and @mem::start. May not | ||
| 272 | * be called from within atomic context. | ||
| 273 | */ | ||
| 215 | void (*put_node)(struct ttm_mem_type_manager *man, | 274 | void (*put_node)(struct ttm_mem_type_manager *man, |
| 216 | struct ttm_mem_reg *mem); | 275 | struct ttm_mem_reg *mem); |
| 276 | |||
| 277 | /** | ||
| 278 | * struct ttm_mem_type_manager member debug | ||
| 279 | * | ||
| 280 | * @man: Pointer to a memory type manager. | ||
| 281 | * @prefix: Prefix to be used in printout to identify the caller. | ||
| 282 | * | ||
| 283 | * This function is called to print out the state of the memory | ||
| 284 | * type manager to aid debugging of out-of-memory conditions. | ||
| 285 | * It may not be called from within atomic context. | ||
| 286 | */ | ||
| 217 | void (*debug)(struct ttm_mem_type_manager *man, const char *prefix); | 287 | void (*debug)(struct ttm_mem_type_manager *man, const char *prefix); |
| 218 | }; | 288 | }; |
| 219 | 289 | ||
| @@ -231,14 +301,13 @@ struct ttm_mem_type_manager { | |||
| 231 | uint64_t size; | 301 | uint64_t size; |
| 232 | uint32_t available_caching; | 302 | uint32_t available_caching; |
| 233 | uint32_t default_caching; | 303 | uint32_t default_caching; |
| 304 | const struct ttm_mem_type_manager_func *func; | ||
| 305 | void *priv; | ||
| 234 | 306 | ||
| 235 | /* | 307 | /* |
| 236 | * Protected by the bdev->lru_lock. | 308 | * Protected by the global->lru_lock. |
| 237 | * TODO: Consider one lru_lock per ttm_mem_type_manager. | ||
| 238 | * Plays ill with list removal, though. | ||
| 239 | */ | 309 | */ |
| 240 | const struct ttm_mem_type_manager_func *func; | 310 | |
| 241 | void *priv; | ||
| 242 | struct list_head lru; | 311 | struct list_head lru; |
| 243 | }; | 312 | }; |
| 244 | 313 | ||
