diff options
author | Jerome Glisse <jglisse@redhat.com> | 2010-04-09 08:39:24 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2010-04-20 00:12:22 -0400 |
commit | 0a2d50e3a8faaf36cde36920431586090411ea15 (patch) | |
tree | d002e9418728c091a012546f5cc86973fdde70bd /drivers/gpu/drm/radeon/radeon_object.c | |
parent | 82c5da6bf8b55a931b042fb531083863d26c8020 (diff) |
drm/radeon/kms: add support for new fault callback V7
This add the support for the new fault callback and also the
infrastructure for supporting unmappable VRAM.
V2 validate BO with no_wait = true
V3 don't derefence bo->mem.mm_node as it's not NULL only for
VRAM or GTT
V4 update to splitted no_wait ttm change
V5 update to new balanced io_mem_reserve/free change
V6 callback is responsible for iomapping memory
V7 move back iomapping to ttm
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_object.c')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_object.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index 4b441f87f47a..57b3f95c0efa 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c | |||
@@ -498,11 +498,33 @@ void radeon_bo_move_notify(struct ttm_buffer_object *bo, | |||
498 | radeon_bo_check_tiling(rbo, 0, 1); | 498 | radeon_bo_check_tiling(rbo, 0, 1); |
499 | } | 499 | } |
500 | 500 | ||
501 | void radeon_bo_fault_reserve_notify(struct ttm_buffer_object *bo) | 501 | int radeon_bo_fault_reserve_notify(struct ttm_buffer_object *bo) |
502 | { | 502 | { |
503 | struct radeon_device *rdev; | ||
503 | struct radeon_bo *rbo; | 504 | struct radeon_bo *rbo; |
505 | unsigned long offset, size; | ||
506 | int r; | ||
507 | |||
504 | if (!radeon_ttm_bo_is_radeon_bo(bo)) | 508 | if (!radeon_ttm_bo_is_radeon_bo(bo)) |
505 | return; | 509 | return 0; |
506 | rbo = container_of(bo, struct radeon_bo, tbo); | 510 | rbo = container_of(bo, struct radeon_bo, tbo); |
507 | radeon_bo_check_tiling(rbo, 0, 0); | 511 | radeon_bo_check_tiling(rbo, 0, 0); |
512 | rdev = rbo->rdev; | ||
513 | if (bo->mem.mem_type == TTM_PL_VRAM) { | ||
514 | size = bo->mem.num_pages << PAGE_SHIFT; | ||
515 | offset = bo->mem.mm_node->start << PAGE_SHIFT; | ||
516 | if ((offset + size) > rdev->mc.visible_vram_size) { | ||
517 | /* hurrah the memory is not visible ! */ | ||
518 | radeon_ttm_placement_from_domain(rbo, RADEON_GEM_DOMAIN_VRAM); | ||
519 | rbo->placement.lpfn = rdev->mc.visible_vram_size >> PAGE_SHIFT; | ||
520 | r = ttm_bo_validate(bo, &rbo->placement, false, true, false); | ||
521 | if (unlikely(r != 0)) | ||
522 | return r; | ||
523 | offset = bo->mem.mm_node->start << PAGE_SHIFT; | ||
524 | /* this should not happen */ | ||
525 | if ((offset + size) > rdev->mc.visible_vram_size) | ||
526 | return -EINVAL; | ||
527 | } | ||
528 | } | ||
529 | return 0; | ||
508 | } | 530 | } |