diff options
author | Chunming Zhou <david1.zhou@amd.com> | 2015-08-24 04:59:54 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2015-09-02 12:05:08 -0400 |
commit | 423a9480add9d9afba035d3c2617034d5f766065 (patch) | |
tree | bd7330e4ebbf786cf96802df3cbd04528fa7297f /drivers/gpu/drm/amd | |
parent | e39daf2c63518a8ce92e3ad5caa04097524b3585 (diff) |
drm/amdgpu: re-work sync_resv
sync_resv is to handle both amdgpu_fence and sched_fence.
Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian K?nig <christian.koenig@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c index 69b7d4540c6e..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 | ||
145 | static 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 | ||