diff options
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/radeon/r600.c | 44 |
1 files changed, 19 insertions, 25 deletions
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index 60fbb236edfd..3e5703f324bd 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -409,35 +409,29 @@ int r600_mc_init(struct radeon_device *rdev) | |||
409 | rdev->mc.gtt_location = rdev->mc.mc_vram_size; | 409 | rdev->mc.gtt_location = rdev->mc.mc_vram_size; |
410 | } | 410 | } |
411 | } else { | 411 | } else { |
412 | if (rdev->family == CHIP_RS780 || rdev->family == CHIP_RS880) { | 412 | rdev->mc.gtt_size = radeon_gart_size * 1024 * 1024; |
413 | rdev->mc.vram_location = (RREG32(MC_VM_FB_LOCATION) & | 413 | rdev->mc.vram_location = (RREG32(MC_VM_FB_LOCATION) & |
414 | 0xFFFF) << 24; | 414 | 0xFFFF) << 24; |
415 | rdev->mc.gtt_size = radeon_gart_size * 1024 * 1024; | 415 | tmp = rdev->mc.vram_location + rdev->mc.mc_vram_size; |
416 | tmp = rdev->mc.vram_location + rdev->mc.mc_vram_size; | 416 | if ((0xFFFFFFFFUL - tmp) >= rdev->mc.gtt_size) { |
417 | if ((0xFFFFFFFFUL - tmp) >= rdev->mc.gtt_size) { | 417 | /* Enough place after vram */ |
418 | /* Enough place after vram */ | 418 | rdev->mc.gtt_location = tmp; |
419 | rdev->mc.gtt_location = tmp; | 419 | } else if (rdev->mc.vram_location >= rdev->mc.gtt_size) { |
420 | } else if (rdev->mc.vram_location >= rdev->mc.gtt_size) { | 420 | /* Enough place before vram */ |
421 | /* Enough place before vram */ | 421 | rdev->mc.gtt_location = 0; |
422 | } else { | ||
423 | /* Not enough place after or before shrink | ||
424 | * gart size | ||
425 | */ | ||
426 | if (rdev->mc.vram_location > (0xFFFFFFFFUL - tmp)) { | ||
422 | rdev->mc.gtt_location = 0; | 427 | rdev->mc.gtt_location = 0; |
428 | rdev->mc.gtt_size = rdev->mc.vram_location; | ||
423 | } else { | 429 | } else { |
424 | /* Not enough place after or before shrink | 430 | rdev->mc.gtt_location = tmp; |
425 | * gart size | 431 | rdev->mc.gtt_size = 0xFFFFFFFFUL - tmp; |
426 | */ | ||
427 | if (rdev->mc.vram_location > (0xFFFFFFFFUL - tmp)) { | ||
428 | rdev->mc.gtt_location = 0; | ||
429 | rdev->mc.gtt_size = rdev->mc.vram_location; | ||
430 | } else { | ||
431 | rdev->mc.gtt_location = tmp; | ||
432 | rdev->mc.gtt_size = 0xFFFFFFFFUL - tmp; | ||
433 | } | ||
434 | } | 432 | } |
435 | rdev->mc.gtt_location = rdev->mc.mc_vram_size; | ||
436 | } else { | ||
437 | rdev->mc.vram_location = 0x00000000UL; | ||
438 | rdev->mc.gtt_location = rdev->mc.mc_vram_size; | ||
439 | rdev->mc.gtt_size = radeon_gart_size * 1024 * 1024; | ||
440 | } | 433 | } |
434 | rdev->mc.gtt_location = rdev->mc.mc_vram_size; | ||
441 | } | 435 | } |
442 | rdev->mc.vram_start = rdev->mc.vram_location; | 436 | rdev->mc.vram_start = rdev->mc.vram_location; |
443 | rdev->mc.vram_end = rdev->mc.vram_location + rdev->mc.mc_vram_size - 1; | 437 | rdev->mc.vram_end = rdev->mc.vram_location + rdev->mc.mc_vram_size - 1; |