aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2015-09-03 23:06:29 -0400
committerDave Airlie <airlied@redhat.com>2015-09-03 23:06:29 -0400
commit99495589aa4de7166af254bc497cdbe133fc24bb (patch)
treed525e957854064f2492976e9beb8a04dddc28143 /drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c
parent879a37d00f1882b1e56a66e626af4194d592d257 (diff)
parentbddf8026386927985ef6d0d11c3ba78f70b76bad (diff)
Merge branch 'drm-next-4.3' of git://people.freedesktop.org/~agd5f/linux into drm-next
More fixes for radeon and amdgpu for 4.3: - Send full DP aux address fixes for radeon and amdgpu - Fix an HDMI display regression for pre-DCE5 parts - UVD suspend fixes for amdgpu - Add an rs480 suspend quirk - Fix bo reserve handling in amdgpu GEM_OP ioctl - GPU scheduler fixes - SDMA optimizations - MEC fix for Fiji * 'drm-next-4.3' of git://people.freedesktop.org/~agd5f/linux: (21 commits) drm/amdgpu: set MEC doorbell range for Fiji drm/amdgpu: implement burst NOP for SDMA drm/amdgpu: add insert_nop ring func and default implementation drm/amdgpu: add amdgpu_get_sdma_instance helper function drm/amdgpu: add AMDGPU_MAX_SDMA_INSTANCES drm/amdgpu: add burst_nop flag for sdma drm/amdgpu: add count field for the SDMA NOP packet v2 drm/amdgpu: use PT for VM sync on unmap drm/amdgpu: make wait_event uninterruptible in push_job drm/amdgpu: fix amdgpu_bo_unreserve order in GEM_OP IOCTL v2 drm/amdgpu: partially revert "modify amdgpu_fence_wait_any() to amdgpu_fence_wait_multiple()" v2 Add radeon suspend/resume quirk for HP Compaq dc5750. drm/amdgpu: re-work sync_resv drm/amdgpu/atom: Send out the full AUX address drm/radeon/native: Send out the full AUX address drm/radeon/atom: Send out the full AUX address drm/amdgpu: use IB for fill_buffer instead of direct command drm/amdgpu: stop trying to suspend UVD sessions v2 drm/amdgpu: add scheduler dependency callback v2 drm/amdgpu: let the scheduler work more with jobs v2 ...
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c46
1 files changed, 40 insertions, 6 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c
index 4fffb2539331..068aeaff7183 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c
@@ -142,6 +142,18 @@ int amdgpu_sync_fence(struct amdgpu_device *adev, struct amdgpu_sync *sync,
142 return 0; 142 return 0;
143} 143}
144 144
145static void *amdgpu_sync_get_owner(struct fence *f)
146{
147 struct amdgpu_fence *a_fence = to_amdgpu_fence(f);
148 struct amd_sched_fence *s_fence = to_amd_sched_fence(f);
149
150 if (s_fence)
151 return s_fence->owner;
152 else if (a_fence)
153 return a_fence->owner;
154 return AMDGPU_FENCE_OWNER_UNDEFINED;
155}
156
145/** 157/**
146 * amdgpu_sync_resv - use the semaphores to sync to a reservation object 158 * amdgpu_sync_resv - use the semaphores to sync to a reservation object
147 * 159 *
@@ -158,7 +170,7 @@ int amdgpu_sync_resv(struct amdgpu_device *adev,
158{ 170{
159 struct reservation_object_list *flist; 171 struct reservation_object_list *flist;
160 struct fence *f; 172 struct fence *f;
161 struct amdgpu_fence *fence; 173 void *fence_owner;
162 unsigned i; 174 unsigned i;
163 int r = 0; 175 int r = 0;
164 176
@@ -176,22 +188,22 @@ int amdgpu_sync_resv(struct amdgpu_device *adev,
176 for (i = 0; i < flist->shared_count; ++i) { 188 for (i = 0; i < flist->shared_count; ++i) {
177 f = rcu_dereference_protected(flist->shared[i], 189 f = rcu_dereference_protected(flist->shared[i],
178 reservation_object_held(resv)); 190 reservation_object_held(resv));
179 fence = f ? to_amdgpu_fence(f) : NULL; 191 if (amdgpu_sync_same_dev(adev, f)) {
180 if (fence && fence->ring->adev == adev) {
181 /* VM updates are only interesting 192 /* VM updates are only interesting
182 * for other VM updates and moves. 193 * for other VM updates and moves.
183 */ 194 */
195 fence_owner = amdgpu_sync_get_owner(f);
184 if ((owner != AMDGPU_FENCE_OWNER_MOVE) && 196 if ((owner != AMDGPU_FENCE_OWNER_MOVE) &&
185 (fence->owner != AMDGPU_FENCE_OWNER_MOVE) && 197 (fence_owner != AMDGPU_FENCE_OWNER_MOVE) &&
186 ((owner == AMDGPU_FENCE_OWNER_VM) != 198 ((owner == AMDGPU_FENCE_OWNER_VM) !=
187 (fence->owner == AMDGPU_FENCE_OWNER_VM))) 199 (fence_owner == AMDGPU_FENCE_OWNER_VM)))
188 continue; 200 continue;
189 201
190 /* Ignore fence from the same owner as 202 /* Ignore fence from the same owner as
191 * long as it isn't undefined. 203 * long as it isn't undefined.
192 */ 204 */
193 if (owner != AMDGPU_FENCE_OWNER_UNDEFINED && 205 if (owner != AMDGPU_FENCE_OWNER_UNDEFINED &&
194 fence->owner == owner) 206 fence_owner == owner)
195 continue; 207 continue;
196 } 208 }
197 209
@@ -202,6 +214,28 @@ int amdgpu_sync_resv(struct amdgpu_device *adev,
202 return r; 214 return r;
203} 215}
204 216
217struct fence *amdgpu_sync_get_fence(struct amdgpu_sync *sync)
218{
219 struct amdgpu_sync_entry *e;
220 struct hlist_node *tmp;
221 struct fence *f;
222 int i;
223
224 hash_for_each_safe(sync->fences, i, tmp, e, node) {
225
226 f = e->fence;
227
228 hash_del(&e->node);
229 kfree(e);
230
231 if (!fence_is_signaled(f))
232 return f;
233
234 fence_put(f);
235 }
236 return NULL;
237}
238
205int amdgpu_sync_wait(struct amdgpu_sync *sync) 239int amdgpu_sync_wait(struct amdgpu_sync *sync)
206{ 240{
207 struct amdgpu_sync_entry *e; 241 struct amdgpu_sync_entry *e;