diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-11-12 11:11:58 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-11-12 11:11:58 -0500 |
| commit | 99efb9369c54fa98fc354a9ad4bc8c59f3212ff4 (patch) | |
| tree | e6e6145d84a1e0f4f0c190434746dfee0da5dd9e /include | |
| parent | fb1cb7b27bba3446bed377c173dbdd2d288e3992 (diff) | |
| parent | 7dfbbdcffebc41441e64278961f57d2840a76259 (diff) | |
Merge branch 'drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6
* 'drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6: (39 commits)
drm/ttm: Be consistent on ttm_bo_init() failures
drm/radeon/kms: Fix retrying ttm_bo_init() after it failed once.
drm/radeon/kms: fix thermal sensor reporting on rv6xx
drm/radeon/kms: fix bugs in ddc and cd path router code
drm/radeon/kms: add support for clock/data path routers
drm: vmwgfx: fix information leak to userland
drivers/gpu: Use vzalloc
drm/vmwgfx: Fix oops on failing bo pin
drm/ttm: Remove the CAP_SYS_ADMIN requirement for bo pinning
drm/ttm: Make sure a sync object doesn't disappear while we use it
drm/radeon/kms: don't disable shared encoders on pre-DCE3 display blocks
drivers/gpu/drm: Update WARN uses
drivers/gpu/drm/vmwgfx: Fix k.alloc switched arguments
DRM: ignore invalid EDID extensions
drm/radeon/kms: make the connector code less verbose
drm/ttm: remove failed ttm binding error printout
drm/ttm: Add a barrier when unreserving
drm/ttm: Remove mm init error printouts and checks
drm/ttm: Remove pointless list_empty check
drm/ttm: Use private locks for the default bo range manager
...
Diffstat (limited to 'include')
| -rw-r--r-- | include/drm/ttm/ttm_bo_api.h | 4 | ||||
| -rw-r--r-- | include/drm/ttm/ttm_bo_driver.h | 79 |
2 files changed, 78 insertions, 5 deletions
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h index 5afa5b52063e..beafc156a535 100644 --- a/include/drm/ttm/ttm_bo_api.h +++ b/include/drm/ttm/ttm_bo_api.h | |||
| @@ -432,6 +432,10 @@ extern void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo); | |||
| 432 | * together with the @destroy function, | 432 | * together with the @destroy function, |
| 433 | * enables driver-specific objects derived from a ttm_buffer_object. | 433 | * enables driver-specific objects derived from a ttm_buffer_object. |
| 434 | * On successful return, the object kref and list_kref are set to 1. | 434 | * On successful return, the object kref and list_kref are set to 1. |
| 435 | * If a failure occurs, the function will call the @destroy function, or | ||
| 436 | * kfree() if @destroy is NULL. Thus, after a failure, dereferencing @bo is | ||
| 437 | * illegal and will likely cause memory corruption. | ||
| 438 | * | ||
| 435 | * Returns | 439 | * Returns |
| 436 | * -ENOMEM: Out of memory. | 440 | * -ENOMEM: Out of memory. |
| 437 | * -EINVAL: Invalid placement flags. | 441 | * -EINVAL: Invalid placement flags. |
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 | ||
