Rev 5078 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5078 | Rev 5271 | ||
---|---|---|---|
Line 31... | Line 31... | ||
31 | * |
31 | * |
32 | * @rdev: radeon_device pointer |
32 | * @rdev: radeon_device pointer |
33 | * @src_offset: src GPU address |
33 | * @src_offset: src GPU address |
34 | * @dst_offset: dst GPU address |
34 | * @dst_offset: dst GPU address |
35 | * @num_gpu_pages: number of GPU pages to xfer |
35 | * @num_gpu_pages: number of GPU pages to xfer |
36 | * @fence: radeon fence object |
36 | * @resv: reservation object to sync to |
37 | * |
37 | * |
38 | * Copy GPU paging using the DMA engine (r7xx). |
38 | * Copy GPU paging using the DMA engine (r7xx). |
39 | * Used by the radeon ttm implementation to move pages if |
39 | * Used by the radeon ttm implementation to move pages if |
40 | * registered as the asic copy callback. |
40 | * registered as the asic copy callback. |
41 | */ |
41 | */ |
42 | int rv770_copy_dma(struct radeon_device *rdev, |
42 | struct radeon_fence *rv770_copy_dma(struct radeon_device *rdev, |
43 | uint64_t src_offset, uint64_t dst_offset, |
43 | uint64_t src_offset, uint64_t dst_offset, |
44 | unsigned num_gpu_pages, |
44 | unsigned num_gpu_pages, |
45 | struct radeon_fence **fence) |
45 | struct reservation_object *resv) |
46 | { |
46 | { |
47 | struct radeon_semaphore *sem = NULL; |
47 | struct radeon_fence *fence; |
- | 48 | struct radeon_sync sync; |
|
48 | int ring_index = rdev->asic->copy.dma_ring_index; |
49 | int ring_index = rdev->asic->copy.dma_ring_index; |
49 | struct radeon_ring *ring = &rdev->ring[ring_index]; |
50 | struct radeon_ring *ring = &rdev->ring[ring_index]; |
50 | u32 size_in_dw, cur_size_in_dw; |
51 | u32 size_in_dw, cur_size_in_dw; |
51 | int i, num_loops; |
52 | int i, num_loops; |
52 | int r = 0; |
53 | int r = 0; |
Line 53... | Line 54... | ||
53 | 54 | ||
54 | r = radeon_semaphore_create(rdev, &sem); |
- | |
55 | if (r) { |
- | |
56 | DRM_ERROR("radeon: moving bo (%d).\n", r); |
- | |
57 | return r; |
- | |
Line 58... | Line 55... | ||
58 | } |
55 | radeon_sync_create(&sync); |
59 | 56 | ||
60 | size_in_dw = (num_gpu_pages << RADEON_GPU_PAGE_SHIFT) / 4; |
57 | size_in_dw = (num_gpu_pages << RADEON_GPU_PAGE_SHIFT) / 4; |
61 | num_loops = DIV_ROUND_UP(size_in_dw, 0xFFFF); |
58 | num_loops = DIV_ROUND_UP(size_in_dw, 0xFFFF); |
62 | r = radeon_ring_lock(rdev, ring, num_loops * 5 + 8); |
59 | r = radeon_ring_lock(rdev, ring, num_loops * 5 + 8); |
63 | if (r) { |
60 | if (r) { |
64 | DRM_ERROR("radeon: moving bo (%d).\n", r); |
61 | DRM_ERROR("radeon: moving bo (%d).\n", r); |
65 | radeon_semaphore_free(rdev, &sem, NULL); |
62 | radeon_sync_free(rdev, &sync, NULL); |
Line 66... | Line 63... | ||
66 | return r; |
63 | return ERR_PTR(r); |
67 | } |
64 | } |
Line 68... | Line 65... | ||
68 | 65 | ||
69 | radeon_semaphore_sync_to(sem, *fence); |
66 | radeon_sync_resv(rdev, &sync, resv, false); |
70 | radeon_semaphore_sync_rings(rdev, sem, ring->idx); |
67 | radeon_sync_rings(rdev, &sync, ring->idx); |
71 | 68 | ||
Line 81... | Line 78... | ||
81 | radeon_ring_write(ring, upper_32_bits(src_offset) & 0xff); |
78 | radeon_ring_write(ring, upper_32_bits(src_offset) & 0xff); |
82 | src_offset += cur_size_in_dw * 4; |
79 | src_offset += cur_size_in_dw * 4; |
83 | dst_offset += cur_size_in_dw * 4; |
80 | dst_offset += cur_size_in_dw * 4; |
84 | } |
81 | } |
Line 85... | Line 82... | ||
85 | 82 | ||
86 | r = radeon_fence_emit(rdev, fence, ring->idx); |
83 | r = radeon_fence_emit(rdev, &fence, ring->idx); |
87 | if (r) { |
84 | if (r) { |
88 | radeon_ring_unlock_undo(rdev, ring); |
85 | radeon_ring_unlock_undo(rdev, ring); |
89 | radeon_semaphore_free(rdev, &sem, NULL); |
86 | radeon_sync_free(rdev, &sync, NULL); |
90 | return r; |
87 | return ERR_PTR(r); |
Line 91... | Line 88... | ||
91 | } |
88 | } |
92 | 89 | ||
Line 93... | Line 90... | ||
93 | radeon_ring_unlock_commit(rdev, ring, false); |
90 | radeon_ring_unlock_commit(rdev, ring, false); |
94 | radeon_semaphore_free(rdev, &sem, *fence); |
91 | radeon_sync_free(rdev, &sync, fence); |