diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-11 00:56:47 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-11 00:56:47 -0500 |
commit | 3ef884b4c04e857c283cc77ca70ad8f638d94b0e (patch) | |
tree | c8c5b872e836e6ffe8bd08ab3477f9e8260575ed /drivers/gpu/drm/ttm/ttm_memory.c | |
parent | 4e5df8069b0e4e36c6b528b3be7da298e6f454cd (diff) | |
parent | 4361e52ad0372e6fd2240a2207b49a4de1f45ca9 (diff) |
Merge branch 'drm-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6
* 'drm-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6: (189 commits)
drm/radeon/kms: fix warning about cur_placement being uninitialised.
drm/ttm: Print debug information on memory manager when eviction fails
drm: Add memory manager debug function
drm/radeon/kms: restore surface registers on resume.
drm/radeon/kms/r600/r700: fallback gracefully on ucode failure
drm/ttm: Initialize eviction placement in case the driver callback doesn't
drm/radeon/kms: cleanup structure and module if initialization fails
drm/radeon/kms: actualy set the eviction placements we choose
drm/radeon/kms: Fix NULL ptr dereference
drm/radeon/kms/avivo: add support for new pll selection algo
drm/radeon/kms/avivo: fix some bugs in the display bandwidth setup
drm/radeon/kms: fix return value from fence function.
drm/radeon: Remove tests for -ERESTART from the TTM code.
drm/ttm: Have the TTM code return -ERESTARTSYS instead of -ERESTART.
drm/radeon/kms: Convert radeon to new TTM validation API (V2)
drm/ttm: Rework validation & memory space allocation (V3)
drm: Add search/get functions to get a block in a specific range
drm/radeon/kms: fix avivo tiling regression since radeon object rework
drm/i915: Remove a debugging printk from hangcheck
drm/radeon/kms: make sure i2c id matches
...
Diffstat (limited to 'drivers/gpu/drm/ttm/ttm_memory.c')
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_memory.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_memory.c b/drivers/gpu/drm/ttm/ttm_memory.c index 072c281a6bb5..f5245c02b8fd 100644 --- a/drivers/gpu/drm/ttm/ttm_memory.c +++ b/drivers/gpu/drm/ttm/ttm_memory.c | |||
@@ -274,16 +274,17 @@ static int ttm_mem_init_kernel_zone(struct ttm_mem_global *glob, | |||
274 | static int ttm_mem_init_highmem_zone(struct ttm_mem_global *glob, | 274 | static int ttm_mem_init_highmem_zone(struct ttm_mem_global *glob, |
275 | const struct sysinfo *si) | 275 | const struct sysinfo *si) |
276 | { | 276 | { |
277 | struct ttm_mem_zone *zone = kzalloc(sizeof(*zone), GFP_KERNEL); | 277 | struct ttm_mem_zone *zone; |
278 | uint64_t mem; | 278 | uint64_t mem; |
279 | int ret; | 279 | int ret; |
280 | 280 | ||
281 | if (unlikely(!zone)) | ||
282 | return -ENOMEM; | ||
283 | |||
284 | if (si->totalhigh == 0) | 281 | if (si->totalhigh == 0) |
285 | return 0; | 282 | return 0; |
286 | 283 | ||
284 | zone = kzalloc(sizeof(*zone), GFP_KERNEL); | ||
285 | if (unlikely(!zone)) | ||
286 | return -ENOMEM; | ||
287 | |||
287 | mem = si->totalram; | 288 | mem = si->totalram; |
288 | mem *= si->mem_unit; | 289 | mem *= si->mem_unit; |
289 | 290 | ||
@@ -322,8 +323,10 @@ static int ttm_mem_init_dma32_zone(struct ttm_mem_global *glob, | |||
322 | * No special dma32 zone needed. | 323 | * No special dma32 zone needed. |
323 | */ | 324 | */ |
324 | 325 | ||
325 | if (mem <= ((uint64_t) 1ULL << 32)) | 326 | if (mem <= ((uint64_t) 1ULL << 32)) { |
327 | kfree(zone); | ||
326 | return 0; | 328 | return 0; |
329 | } | ||
327 | 330 | ||
328 | /* | 331 | /* |
329 | * Limit max dma32 memory to 4GB for now | 332 | * Limit max dma32 memory to 4GB for now |
@@ -460,6 +463,7 @@ void ttm_mem_global_free(struct ttm_mem_global *glob, | |||
460 | { | 463 | { |
461 | return ttm_mem_global_free_zone(glob, NULL, amount); | 464 | return ttm_mem_global_free_zone(glob, NULL, amount); |
462 | } | 465 | } |
466 | EXPORT_SYMBOL(ttm_mem_global_free); | ||
463 | 467 | ||
464 | static int ttm_mem_global_reserve(struct ttm_mem_global *glob, | 468 | static int ttm_mem_global_reserve(struct ttm_mem_global *glob, |
465 | struct ttm_mem_zone *single_zone, | 469 | struct ttm_mem_zone *single_zone, |
@@ -533,6 +537,7 @@ int ttm_mem_global_alloc(struct ttm_mem_global *glob, uint64_t memory, | |||
533 | return ttm_mem_global_alloc_zone(glob, NULL, memory, no_wait, | 537 | return ttm_mem_global_alloc_zone(glob, NULL, memory, no_wait, |
534 | interruptible); | 538 | interruptible); |
535 | } | 539 | } |
540 | EXPORT_SYMBOL(ttm_mem_global_alloc); | ||
536 | 541 | ||
537 | int ttm_mem_global_alloc_page(struct ttm_mem_global *glob, | 542 | int ttm_mem_global_alloc_page(struct ttm_mem_global *glob, |
538 | struct page *page, | 543 | struct page *page, |
@@ -588,3 +593,4 @@ size_t ttm_round_pot(size_t size) | |||
588 | } | 593 | } |
589 | return 0; | 594 | return 0; |
590 | } | 595 | } |
596 | EXPORT_SYMBOL(ttm_round_pot); | ||