diff options
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_ring.c')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_ring.c | 46 |
1 files changed, 10 insertions, 36 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c index 18254e1c3e71..9214403ae173 100644 --- a/drivers/gpu/drm/radeon/radeon_ring.c +++ b/drivers/gpu/drm/radeon/radeon_ring.c | |||
@@ -61,7 +61,7 @@ int radeon_ib_get(struct radeon_device *rdev, int ring, | |||
61 | struct radeon_ib *ib, struct radeon_vm *vm, | 61 | struct radeon_ib *ib, struct radeon_vm *vm, |
62 | unsigned size) | 62 | unsigned size) |
63 | { | 63 | { |
64 | int i, r; | 64 | int r; |
65 | 65 | ||
66 | r = radeon_sa_bo_new(rdev, &rdev->ring_tmp_bo, &ib->sa_bo, size, 256, true); | 66 | r = radeon_sa_bo_new(rdev, &rdev->ring_tmp_bo, &ib->sa_bo, size, 256, true); |
67 | if (r) { | 67 | if (r) { |
@@ -87,8 +87,6 @@ int radeon_ib_get(struct radeon_device *rdev, int ring, | |||
87 | ib->gpu_addr = radeon_sa_bo_gpu_addr(ib->sa_bo); | 87 | ib->gpu_addr = radeon_sa_bo_gpu_addr(ib->sa_bo); |
88 | } | 88 | } |
89 | ib->is_const_ib = false; | 89 | ib->is_const_ib = false; |
90 | for (i = 0; i < RADEON_NUM_RINGS; ++i) | ||
91 | ib->sync_to[i] = NULL; | ||
92 | 90 | ||
93 | return 0; | 91 | return 0; |
94 | } | 92 | } |
@@ -109,25 +107,6 @@ void radeon_ib_free(struct radeon_device *rdev, struct radeon_ib *ib) | |||
109 | } | 107 | } |
110 | 108 | ||
111 | /** | 109 | /** |
112 | * radeon_ib_sync_to - sync to fence before executing the IB | ||
113 | * | ||
114 | * @ib: IB object to add fence to | ||
115 | * @fence: fence to sync to | ||
116 | * | ||
117 | * Sync to the fence before executing the IB | ||
118 | */ | ||
119 | void radeon_ib_sync_to(struct radeon_ib *ib, struct radeon_fence *fence) | ||
120 | { | ||
121 | struct radeon_fence *other; | ||
122 | |||
123 | if (!fence) | ||
124 | return; | ||
125 | |||
126 | other = ib->sync_to[fence->ring]; | ||
127 | ib->sync_to[fence->ring] = radeon_fence_later(fence, other); | ||
128 | } | ||
129 | |||
130 | /** | ||
131 | * radeon_ib_schedule - schedule an IB (Indirect Buffer) on the ring | 110 | * radeon_ib_schedule - schedule an IB (Indirect Buffer) on the ring |
132 | * | 111 | * |
133 | * @rdev: radeon_device pointer | 112 | * @rdev: radeon_device pointer |
@@ -151,8 +130,7 @@ int radeon_ib_schedule(struct radeon_device *rdev, struct radeon_ib *ib, | |||
151 | struct radeon_ib *const_ib) | 130 | struct radeon_ib *const_ib) |
152 | { | 131 | { |
153 | struct radeon_ring *ring = &rdev->ring[ib->ring]; | 132 | struct radeon_ring *ring = &rdev->ring[ib->ring]; |
154 | bool need_sync = false; | 133 | int r = 0; |
155 | int i, r = 0; | ||
156 | 134 | ||
157 | if (!ib->length_dw || !ring->ready) { | 135 | if (!ib->length_dw || !ring->ready) { |
158 | /* TODO: Nothings in the ib we should report. */ | 136 | /* TODO: Nothings in the ib we should report. */ |
@@ -166,19 +144,15 @@ int radeon_ib_schedule(struct radeon_device *rdev, struct radeon_ib *ib, | |||
166 | dev_err(rdev->dev, "scheduling IB failed (%d).\n", r); | 144 | dev_err(rdev->dev, "scheduling IB failed (%d).\n", r); |
167 | return r; | 145 | return r; |
168 | } | 146 | } |
169 | for (i = 0; i < RADEON_NUM_RINGS; ++i) { | 147 | |
170 | struct radeon_fence *fence = ib->sync_to[i]; | 148 | /* sync with other rings */ |
171 | if (radeon_fence_need_sync(fence, ib->ring)) { | 149 | r = radeon_semaphore_sync_rings(rdev, ib->semaphore, ib->ring); |
172 | need_sync = true; | 150 | if (r) { |
173 | radeon_semaphore_sync_rings(rdev, ib->semaphore, | 151 | dev_err(rdev->dev, "failed to sync rings (%d)\n", r); |
174 | fence->ring, ib->ring); | 152 | radeon_ring_unlock_undo(rdev, ring); |
175 | radeon_fence_note_sync(fence, ib->ring); | 153 | return r; |
176 | } | ||
177 | } | ||
178 | /* immediately free semaphore when we don't need to sync */ | ||
179 | if (!need_sync) { | ||
180 | radeon_semaphore_free(rdev, &ib->semaphore, NULL); | ||
181 | } | 154 | } |
155 | |||
182 | /* if we can't remember our last VM flush then flush now! */ | 156 | /* if we can't remember our last VM flush then flush now! */ |
183 | /* XXX figure out why we have to flush for every IB */ | 157 | /* XXX figure out why we have to flush for every IB */ |
184 | if (ib->vm /*&& !ib->vm->last_flush*/) { | 158 | if (ib->vm /*&& !ib->vm->last_flush*/) { |