diff options
author | Christian König <christian.koenig@amd.com> | 2016-01-18 08:49:45 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-02-10 14:16:52 -0500 |
commit | 046c12c67b15018ab7ed2688a252475d5a8b9db1 (patch) | |
tree | 4ff5af6064cf2a22b84653802cfe79d6bab3ec8c /drivers/gpu/drm/amd | |
parent | ea5e4c87319aad5e196455145078eb8a9e964afb (diff) |
drm/amdgpu: remove sync_to from sync obj v2
Not needed any more without semaphores.
v2: remove unused variables as well
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 44 |
2 files changed, 9 insertions, 36 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index 297b231e4fcc..3e040cb20ebe 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h | |||
@@ -636,7 +636,6 @@ int amdgpu_mode_dumb_mmap(struct drm_file *filp, | |||
636 | * Synchronization | 636 | * Synchronization |
637 | */ | 637 | */ |
638 | struct amdgpu_sync { | 638 | struct amdgpu_sync { |
639 | struct fence *sync_to[AMDGPU_MAX_RINGS]; | ||
640 | DECLARE_HASHTABLE(fences, 4); | 639 | DECLARE_HASHTABLE(fences, 4); |
641 | struct fence *last_vm_update; | 640 | struct fence *last_vm_update; |
642 | }; | 641 | }; |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c index 7f12a4d55c52..1d348f8ae126 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | |||
@@ -46,11 +46,6 @@ struct amdgpu_sync_entry { | |||
46 | */ | 46 | */ |
47 | void amdgpu_sync_create(struct amdgpu_sync *sync) | 47 | void amdgpu_sync_create(struct amdgpu_sync *sync) |
48 | { | 48 | { |
49 | unsigned i; | ||
50 | |||
51 | for (i = 0; i < AMDGPU_MAX_RINGS; ++i) | ||
52 | sync->sync_to[i] = NULL; | ||
53 | |||
54 | hash_init(sync->fences); | 49 | hash_init(sync->fences); |
55 | sync->last_vm_update = NULL; | 50 | sync->last_vm_update = NULL; |
56 | } | 51 | } |
@@ -104,7 +99,6 @@ int amdgpu_sync_fence(struct amdgpu_device *adev, struct amdgpu_sync *sync, | |||
104 | struct fence *f) | 99 | struct fence *f) |
105 | { | 100 | { |
106 | struct amdgpu_sync_entry *e; | 101 | struct amdgpu_sync_entry *e; |
107 | struct amdgpu_fence *fence; | ||
108 | 102 | ||
109 | if (!f) | 103 | if (!f) |
110 | return 0; | 104 | return 0; |
@@ -113,27 +107,20 @@ int amdgpu_sync_fence(struct amdgpu_device *adev, struct amdgpu_sync *sync, | |||
113 | amdgpu_sync_test_owner(f, AMDGPU_FENCE_OWNER_VM)) | 107 | amdgpu_sync_test_owner(f, AMDGPU_FENCE_OWNER_VM)) |
114 | amdgpu_sync_keep_later(&sync->last_vm_update, f); | 108 | amdgpu_sync_keep_later(&sync->last_vm_update, f); |
115 | 109 | ||
116 | fence = to_amdgpu_fence(f); | 110 | hash_for_each_possible(sync->fences, e, node, f->context) { |
117 | if (!fence || fence->ring->adev != adev) { | 111 | if (unlikely(e->fence->context != f->context)) |
118 | hash_for_each_possible(sync->fences, e, node, f->context) { | 112 | continue; |
119 | if (unlikely(e->fence->context != f->context)) | ||
120 | continue; | ||
121 | |||
122 | amdgpu_sync_keep_later(&e->fence, f); | ||
123 | return 0; | ||
124 | } | ||
125 | |||
126 | e = kmalloc(sizeof(struct amdgpu_sync_entry), GFP_KERNEL); | ||
127 | if (!e) | ||
128 | return -ENOMEM; | ||
129 | 113 | ||
130 | hash_add(sync->fences, &e->node, f->context); | 114 | amdgpu_sync_keep_later(&e->fence, f); |
131 | e->fence = fence_get(f); | ||
132 | return 0; | 115 | return 0; |
133 | } | 116 | } |
134 | 117 | ||
135 | amdgpu_sync_keep_later(&sync->sync_to[fence->ring->idx], f); | 118 | e = kmalloc(sizeof(struct amdgpu_sync_entry), GFP_KERNEL); |
119 | if (!e) | ||
120 | return -ENOMEM; | ||
136 | 121 | ||
122 | hash_add(sync->fences, &e->node, f->context); | ||
123 | e->fence = fence_get(f); | ||
137 | return 0; | 124 | return 0; |
138 | } | 125 | } |
139 | 126 | ||
@@ -247,16 +234,6 @@ int amdgpu_sync_wait(struct amdgpu_sync *sync) | |||
247 | kfree(e); | 234 | kfree(e); |
248 | } | 235 | } |
249 | 236 | ||
250 | for (i = 0; i < AMDGPU_MAX_RINGS; ++i) { | ||
251 | struct fence *fence = sync->sync_to[i]; | ||
252 | if (!fence) | ||
253 | continue; | ||
254 | |||
255 | r = fence_wait(fence, false); | ||
256 | if (r) | ||
257 | return r; | ||
258 | } | ||
259 | |||
260 | return 0; | 237 | return 0; |
261 | } | 238 | } |
262 | 239 | ||
@@ -283,8 +260,5 @@ void amdgpu_sync_free(struct amdgpu_device *adev, | |||
283 | kfree(e); | 260 | kfree(e); |
284 | } | 261 | } |
285 | 262 | ||
286 | for (i = 0; i < AMDGPU_MAX_RINGS; ++i) | ||
287 | fence_put(sync->sync_to[i]); | ||
288 | |||
289 | fence_put(sync->last_vm_update); | 263 | fence_put(sync->last_vm_update); |
290 | } | 264 | } |