git://ftp.safe.ca
/
safe
/
jmp
/
linux-2.6
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
drm/radeon/kms: simplify memory controller setup V2
[safe/jmp/linux-2.6]
/
drivers
/
gpu
/
drm
/
radeon
/
radeon_test.c
diff --git
a/drivers/gpu/drm/radeon/radeon_test.c
b/drivers/gpu/drm/radeon/radeon_test.c
index
03c33cf
..
313c96b
100644
(file)
--- a/
drivers/gpu/drm/radeon/radeon_test.c
+++ b/
drivers/gpu/drm/radeon/radeon_test.c
@@
-30,8
+30,8
@@
/* Test BO GTT->VRAM and VRAM->GTT GPU copies across the whole GTT aperture */
void radeon_test_moves(struct radeon_device *rdev)
{
/* Test BO GTT->VRAM and VRAM->GTT GPU copies across the whole GTT aperture */
void radeon_test_moves(struct radeon_device *rdev)
{
- struct radeon_
object
*vram_obj = NULL;
- struct radeon_
object
**gtt_obj = NULL;
+ struct radeon_
bo
*vram_obj = NULL;
+ struct radeon_
bo
**gtt_obj = NULL;
struct radeon_fence *fence = NULL;
uint64_t gtt_addr, vram_addr;
unsigned i, n, size;
struct radeon_fence *fence = NULL;
uint64_t gtt_addr, vram_addr;
unsigned i, n, size;
@@
-42,8
+42,8
@@
void radeon_test_moves(struct radeon_device *rdev)
/* Number of tests =
* (Total GTT - IB pool - writeback page - ring buffer) / test size
*/
/* Number of tests =
* (Total GTT - IB pool - writeback page - ring buffer) / test size
*/
- n = (
rdev->mc.gtt_size - RADEON_IB_POOL_SIZE*64*1024 - 4096
-
- rdev->cp.ring_size) / size;
+ n = (
(u32)(rdev->mc.gtt_size - RADEON_IB_POOL_SIZE*64*1024 - RADEON_GPU_PAGE_SIZE
-
+ rdev->cp.ring_size)
)
/ size;
gtt_obj = kzalloc(n * sizeof(*gtt_obj), GFP_KERNEL);
if (!gtt_obj) {
gtt_obj = kzalloc(n * sizeof(*gtt_obj), GFP_KERNEL);
if (!gtt_obj) {
@@
-52,38
+52,42
@@
void radeon_test_moves(struct radeon_device *rdev)
goto out_cleanup;
}
goto out_cleanup;
}
- r = radeon_
object
_create(rdev, NULL, size, true, RADEON_GEM_DOMAIN_VRAM,
-
false,
&vram_obj);
+ r = radeon_
bo
_create(rdev, NULL, size, true, RADEON_GEM_DOMAIN_VRAM,
+ &vram_obj);
if (r) {
DRM_ERROR("Failed to create VRAM object\n");
goto out_cleanup;
}
if (r) {
DRM_ERROR("Failed to create VRAM object\n");
goto out_cleanup;
}
-
- r = radeon_object_pin(vram_obj, RADEON_GEM_DOMAIN_VRAM, &vram_addr);
+ r = radeon_bo_reserve(vram_obj, false);
+ if (unlikely(r != 0))
+ goto out_cleanup;
+ r = radeon_bo_pin(vram_obj, RADEON_GEM_DOMAIN_VRAM, &vram_addr);
if (r) {
DRM_ERROR("Failed to pin VRAM object\n");
goto out_cleanup;
}
if (r) {
DRM_ERROR("Failed to pin VRAM object\n");
goto out_cleanup;
}
-
for (i = 0; i < n; i++) {
void *gtt_map, *vram_map;
void **gtt_start, **gtt_end;
void **vram_start, **vram_end;
for (i = 0; i < n; i++) {
void *gtt_map, *vram_map;
void **gtt_start, **gtt_end;
void **vram_start, **vram_end;
- r = radeon_
object
_create(rdev, NULL, size, true,
- RADEON_GEM_DOMAIN_GTT,
false,
gtt_obj + i);
+ r = radeon_
bo
_create(rdev, NULL, size, true,
+ RADEON_GEM_DOMAIN_GTT, gtt_obj + i);
if (r) {
DRM_ERROR("Failed to create GTT object %d\n", i);
goto out_cleanup;
}
if (r) {
DRM_ERROR("Failed to create GTT object %d\n", i);
goto out_cleanup;
}
- r = radeon_object_pin(gtt_obj[i], RADEON_GEM_DOMAIN_GTT, >t_addr);
+ r = radeon_bo_reserve(gtt_obj[i], false);
+ if (unlikely(r != 0))
+ goto out_cleanup;
+ r = radeon_bo_pin(gtt_obj[i], RADEON_GEM_DOMAIN_GTT, >t_addr);
if (r) {
DRM_ERROR("Failed to pin GTT object %d\n", i);
goto out_cleanup;
}
if (r) {
DRM_ERROR("Failed to pin GTT object %d\n", i);
goto out_cleanup;
}
- r = radeon_
object
_kmap(gtt_obj[i], >t_map);
+ r = radeon_
bo
_kmap(gtt_obj[i], >t_map);
if (r) {
DRM_ERROR("Failed to map GTT object %d\n", i);
goto out_cleanup;
if (r) {
DRM_ERROR("Failed to map GTT object %d\n", i);
goto out_cleanup;
@@
-94,7
+98,7
@@
void radeon_test_moves(struct radeon_device *rdev)
gtt_start++)
*gtt_start = gtt_start;
gtt_start++)
*gtt_start = gtt_start;
- radeon_
object
_kunmap(gtt_obj[i]);
+ radeon_
bo
_kunmap(gtt_obj[i]);
r = radeon_fence_create(rdev, &fence);
if (r) {
r = radeon_fence_create(rdev, &fence);
if (r) {
@@
-102,7
+106,7
@@
void radeon_test_moves(struct radeon_device *rdev)
goto out_cleanup;
}
goto out_cleanup;
}
- r = radeon_copy(rdev, gtt_addr, vram_addr, size /
4096
, fence);
+ r = radeon_copy(rdev, gtt_addr, vram_addr, size /
RADEON_GPU_PAGE_SIZE
, fence);
if (r) {
DRM_ERROR("Failed GTT->VRAM copy %d\n", i);
goto out_cleanup;
if (r) {
DRM_ERROR("Failed GTT->VRAM copy %d\n", i);
goto out_cleanup;
@@
-116,7
+120,7
@@
void radeon_test_moves(struct radeon_device *rdev)
radeon_fence_unref(&fence);
radeon_fence_unref(&fence);
- r = radeon_
object
_kmap(vram_obj, &vram_map);
+ r = radeon_
bo
_kmap(vram_obj, &vram_map);
if (r) {
DRM_ERROR("Failed to map VRAM object after copy %d\n", i);
goto out_cleanup;
if (r) {
DRM_ERROR("Failed to map VRAM object after copy %d\n", i);
goto out_cleanup;
@@
-131,13
+135,13
@@
void radeon_test_moves(struct radeon_device *rdev)
"expected 0x%p (GTT map 0x%p-0x%p)\n",
i, *vram_start, gtt_start, gtt_map,
gtt_end);
"expected 0x%p (GTT map 0x%p-0x%p)\n",
i, *vram_start, gtt_start, gtt_map,
gtt_end);
- radeon_
object
_kunmap(vram_obj);
+ radeon_
bo
_kunmap(vram_obj);
goto out_cleanup;
}
*vram_start = vram_start;
}
goto out_cleanup;
}
*vram_start = vram_start;
}
- radeon_
object
_kunmap(vram_obj);
+ radeon_
bo
_kunmap(vram_obj);
r = radeon_fence_create(rdev, &fence);
if (r) {
r = radeon_fence_create(rdev, &fence);
if (r) {
@@
-145,7
+149,7
@@
void radeon_test_moves(struct radeon_device *rdev)
goto out_cleanup;
}
goto out_cleanup;
}
- r = radeon_copy(rdev, vram_addr, gtt_addr, size /
4096
, fence);
+ r = radeon_copy(rdev, vram_addr, gtt_addr, size /
RADEON_GPU_PAGE_SIZE
, fence);
if (r) {
DRM_ERROR("Failed VRAM->GTT copy %d\n", i);
goto out_cleanup;
if (r) {
DRM_ERROR("Failed VRAM->GTT copy %d\n", i);
goto out_cleanup;
@@
-159,7
+163,7
@@
void radeon_test_moves(struct radeon_device *rdev)
radeon_fence_unref(&fence);
radeon_fence_unref(&fence);
- r = radeon_
object
_kmap(gtt_obj[i], >t_map);
+ r = radeon_
bo
_kmap(gtt_obj[i], >t_map);
if (r) {
DRM_ERROR("Failed to map GTT object after copy %d\n", i);
goto out_cleanup;
if (r) {
DRM_ERROR("Failed to map GTT object after copy %d\n", i);
goto out_cleanup;
@@
-174,27
+178,33
@@
void radeon_test_moves(struct radeon_device *rdev)
"expected 0x%p (VRAM map 0x%p-0x%p)\n",
i, *gtt_start, vram_start, vram_map,
vram_end);
"expected 0x%p (VRAM map 0x%p-0x%p)\n",
i, *gtt_start, vram_start, vram_map,
vram_end);
- radeon_
object
_kunmap(gtt_obj[i]);
+ radeon_
bo
_kunmap(gtt_obj[i]);
goto out_cleanup;
}
}
goto out_cleanup;
}
}
- radeon_
object
_kunmap(gtt_obj[i]);
+ radeon_
bo
_kunmap(gtt_obj[i]);
DRM_INFO("Tested GTT->VRAM and VRAM->GTT copy for GTT offset 0x%llx\n",
DRM_INFO("Tested GTT->VRAM and VRAM->GTT copy for GTT offset 0x%llx\n",
- gtt_addr - rdev->mc.gtt_
location
);
+ gtt_addr - rdev->mc.gtt_
start
);
}
out_cleanup:
if (vram_obj) {
}
out_cleanup:
if (vram_obj) {
- radeon_object_unpin(vram_obj);
- radeon_object_unref(&vram_obj);
+ if (radeon_bo_is_reserved(vram_obj)) {
+ radeon_bo_unpin(vram_obj);
+ radeon_bo_unreserve(vram_obj);
+ }
+ radeon_bo_unref(&vram_obj);
}
if (gtt_obj) {
for (i = 0; i < n; i++) {
if (gtt_obj[i]) {
}
if (gtt_obj) {
for (i = 0; i < n; i++) {
if (gtt_obj[i]) {
- radeon_object_unpin(gtt_obj[i]);
- radeon_object_unref(>t_obj[i]);
+ if (radeon_bo_is_reserved(gtt_obj[i])) {
+ radeon_bo_unpin(gtt_obj[i]);
+ radeon_bo_unreserve(gtt_obj[i]);
+ }
+ radeon_bo_unref(>t_obj[i]);
}
}
kfree(gtt_obj);
}
}
kfree(gtt_obj);
@@
-206,4
+216,3
@@
out_cleanup:
printk(KERN_WARNING "Error while testing BO move.\n");
}
}
printk(KERN_WARNING "Error while testing BO move.\n");
}
}
-