summaryrefslogtreecommitdiff
path: root/sys/dev/pci/drm
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2014-07-06 08:16:37 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2014-07-06 08:16:37 +0000
commiteac53c5340efc8606d50e288bc0e796e4b0d4582 (patch)
tree26bd9544241e45640fc0021caf8ac4260a2182a7 /sys/dev/pci/drm
parentad787152dcec1faa6c6030262390b38447d63861 (diff)
drm/radeon: also try GART for CPU accessed buffers
From Christian Koenig 72568eb7e4e40096fd80c7c8abd04ac630e45bb9 in ubuntu 3.8 544092596e8ac269f70e70961b5e9381909c9b1e in mainline linux
Diffstat (limited to 'sys/dev/pci/drm')
-rw-r--r--sys/dev/pci/drm/radeon/radeon_object.c40
1 files changed, 24 insertions, 16 deletions
diff --git a/sys/dev/pci/drm/radeon/radeon_object.c b/sys/dev/pci/drm/radeon/radeon_object.c
index 8bf28c47964..37c8ab3ec0f 100644
--- a/sys/dev/pci/drm/radeon/radeon_object.c
+++ b/sys/dev/pci/drm/radeon/radeon_object.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radeon_object.c,v 1.3 2013/11/07 05:33:05 jsg Exp $ */
+/* $OpenBSD: radeon_object.c,v 1.4 2014/07/06 08:16:36 jsg Exp $ */
/*
* Copyright 2009 Jerome Glisse.
* All Rights Reserved.
@@ -599,22 +599,30 @@ int radeon_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
rbo = container_of(bo, struct radeon_bo, tbo);
radeon_bo_check_tiling(rbo, 0, 0);
rdev = rbo->rdev;
- if (bo->mem.mem_type == TTM_PL_VRAM) {
- size = bo->mem.num_pages << PAGE_SHIFT;
- offset = bo->mem.start << PAGE_SHIFT;
- if ((offset + size) > rdev->mc.visible_vram_size) {
- /* hurrah the memory is not visible ! */
- radeon_ttm_placement_from_domain(rbo, RADEON_GEM_DOMAIN_VRAM);
- rbo->placement.lpfn = rdev->mc.visible_vram_size >> PAGE_SHIFT;
- r = ttm_bo_validate(bo, &rbo->placement, false, false);
- if (unlikely(r != 0))
- return r;
- offset = bo->mem.start << PAGE_SHIFT;
- /* this should not happen */
- if ((offset + size) > rdev->mc.visible_vram_size)
- return -EINVAL;
- }
+ if (bo->mem.mem_type != TTM_PL_VRAM)
+ return 0;
+
+ size = bo->mem.num_pages << PAGE_SHIFT;
+ offset = bo->mem.start << PAGE_SHIFT;
+ if ((offset + size) <= rdev->mc.visible_vram_size)
+ return 0;
+
+ /* hurrah the memory is not visible ! */
+ radeon_ttm_placement_from_domain(rbo, RADEON_GEM_DOMAIN_VRAM);
+ rbo->placement.lpfn = rdev->mc.visible_vram_size >> PAGE_SHIFT;
+ r = ttm_bo_validate(bo, &rbo->placement, false, false);
+ if (unlikely(r == -ENOMEM)) {
+ radeon_ttm_placement_from_domain(rbo, RADEON_GEM_DOMAIN_GTT);
+ return ttm_bo_validate(bo, &rbo->placement, false, false);
+ } else if (unlikely(r != 0)) {
+ return r;
}
+
+ offset = bo->mem.start << PAGE_SHIFT;
+ /* this should never happen */
+ if ((offset + size) > rdev->mc.visible_vram_size)
+ return -EINVAL;
+
return 0;
}