47 n -= rdev->
ring[i].ring_size;
50 if (rdev->
ih.ring_obj)
51 n -= rdev->
ih.ring_size;
54 gtt_obj = kzalloc(n *
sizeof(*gtt_obj),
GFP_KERNEL);
56 DRM_ERROR(
"Failed to allocate %d pointers\n", n);
64 DRM_ERROR(
"Failed to create VRAM object\n");
72 DRM_ERROR(
"Failed to pin VRAM object\n");
75 for (i = 0; i <
n; i++) {
76 void *gtt_map, *vram_map;
77 void **gtt_start, **gtt_end;
78 void **vram_start, **vram_end;
83 DRM_ERROR(
"Failed to create GTT object %d\n", i);
92 DRM_ERROR(
"Failed to pin GTT object %d\n", i);
98 DRM_ERROR(
"Failed to map GTT object %d\n", i);
102 for (gtt_start = gtt_map, gtt_end = gtt_map + size;
105 *gtt_start = gtt_start;
111 DRM_ERROR(
"Failed GTT->VRAM copy %d\n", i);
117 DRM_ERROR(
"Failed to wait for GTT->VRAM fence %d\n", i);
125 DRM_ERROR(
"Failed to map VRAM object after copy %d\n", i);
129 for (gtt_start = gtt_map, gtt_end = gtt_map + size,
130 vram_start = vram_map, vram_end = vram_map + size;
131 vram_start < vram_end;
132 gtt_start++, vram_start++) {
133 if (*vram_start != gtt_start) {
134 DRM_ERROR(
"Incorrect GTT->VRAM copy %d: Got 0x%p, "
135 "expected 0x%p (GTT/VRAM offset "
136 "0x%16llx/0x%16llx)\n",
137 i, *vram_start, gtt_start,
139 (gtt_addr - rdev->
mc.gtt_start +
140 (
void*)gtt_start - gtt_map),
142 (vram_addr - rdev->
mc.vram_start +
143 (
void*)gtt_start - gtt_map));
147 *vram_start = vram_start;
154 DRM_ERROR(
"Failed VRAM->GTT copy %d\n", i);
160 DRM_ERROR(
"Failed to wait for VRAM->GTT fence %d\n", i);
168 DRM_ERROR(
"Failed to map GTT object after copy %d\n", i);
172 for (gtt_start = gtt_map, gtt_end = gtt_map + size,
173 vram_start = vram_map, vram_end = vram_map + size;
175 gtt_start++, vram_start++) {
176 if (*gtt_start != vram_start) {
177 DRM_ERROR(
"Incorrect VRAM->GTT copy %d: Got 0x%p, "
178 "expected 0x%p (VRAM/GTT offset "
179 "0x%16llx/0x%16llx)\n",
180 i, *gtt_start, vram_start,
182 (vram_addr - rdev->
mc.vram_start +
183 (
void*)vram_start - vram_map),
185 (gtt_addr - rdev->
mc.gtt_start +
186 (
void*)vram_start - vram_map));
194 DRM_INFO(
"Tested GTT->VRAM and VRAM->GTT copy for GTT offset 0x%llx\n",
195 gtt_addr - rdev->
mc.gtt_start);
200 if (radeon_bo_is_reserved(vram_obj)) {
202 radeon_bo_unreserve(vram_obj);
207 for (i = 0; i <
n; i++) {
209 if (radeon_bo_is_reserved(gtt_obj[i])) {
211 radeon_bo_unreserve(gtt_obj[i]);
236 DRM_ERROR(
"Failed to create semaphore\n");
242 DRM_ERROR(
"Failed to lock ring A %d\n", ringA->
idx);
248 DRM_ERROR(
"Failed to emit fence 1\n");
255 DRM_ERROR(
"Failed to emit fence 2\n");
264 DRM_ERROR(
"Fence 1 signaled without waiting for semaphore.\n");
270 DRM_ERROR(
"Failed to lock ring B %p\n", ringB);
278 DRM_ERROR(
"Failed to wait for sync fence 1\n");
285 DRM_ERROR(
"Fence 2 signaled without waiting for semaphore.\n");
291 DRM_ERROR(
"Failed to lock ring B %p\n", ringB);
299 DRM_ERROR(
"Failed to wait for sync fence 1\n");
328 DRM_ERROR(
"Failed to create semaphore\n");
334 DRM_ERROR(
"Failed to lock ring A %d\n", ringA->
idx);
340 DRM_ERROR(
"Failed to emit sync fence 1\n");
348 DRM_ERROR(
"Failed to lock ring B %d\n", ringB->
idx);
354 DRM_ERROR(
"Failed to create sync fence 2\n");
363 DRM_ERROR(
"Fence A signaled without waiting for semaphore.\n");
367 DRM_ERROR(
"Fence A signaled without waiting for semaphore.\n");
373 DRM_ERROR(
"Failed to lock ring B %p\n", ringC);
379 for (i = 0; i < 30; ++
i) {
387 if (!sigA && !sigB) {
388 DRM_ERROR(
"Neither fence A nor B has been signaled\n");
390 }
else if (sigA && sigB) {
391 DRM_ERROR(
"Both fence A and B has been signaled\n");
395 DRM_INFO(
"Fence %c was first signaled\n", sigA ?
'A' :
'B');
399 DRM_ERROR(
"Failed to lock ring B %p\n", ringC);
409 DRM_ERROR(
"Failed to wait for sync fence A\n");
414 DRM_ERROR(
"Failed to wait for sync fence B\n");
440 for (j = 0; j <
i; ++
j) {
445 DRM_INFO(
"Testing syncing between rings %d and %d...\n", i, j);
448 DRM_INFO(
"Testing syncing between rings %d and %d...\n", j, i);
451 for (k = 0; k <
j; ++
k) {
456 DRM_INFO(
"Testing syncing between rings %d, %d and %d...\n", i, j, k);
457 radeon_test_ring_sync2(rdev, ringA, ringB, ringC);
459 DRM_INFO(
"Testing syncing between rings %d, %d and %d...\n", i, k, j);
460 radeon_test_ring_sync2(rdev, ringA, ringC, ringB);
462 DRM_INFO(
"Testing syncing between rings %d, %d and %d...\n", j, i, k);
463 radeon_test_ring_sync2(rdev, ringB, ringA, ringC);
465 DRM_INFO(
"Testing syncing between rings %d, %d and %d...\n", j, k, i);
466 radeon_test_ring_sync2(rdev, ringB, ringC, ringA);
468 DRM_INFO(
"Testing syncing between rings %d, %d and %d...\n", k, i, j);
469 radeon_test_ring_sync2(rdev, ringC, ringA, ringB);
471 DRM_INFO(
"Testing syncing between rings %d, %d and %d...\n", k, j, i);
472 radeon_test_ring_sync2(rdev, ringC, ringB, ringA);