diff options
author | Chunming Zhou <david1.zhou@amd.com> | 2015-08-13 01:04:06 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2015-08-17 16:51:20 -0400 |
commit | 1c8f805af9af445a42b8dbda5f620752996cba44 (patch) | |
tree | 021d68146ce2dba5ed725731b7ff62248195cf42 | |
parent | 6d1d0ef7433caf1df920116bfd445aa698a7f37d (diff) |
drm/amdgpu: fix unnecessary wake up
decrease CPU extra overhead.
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>
-rw-r--r-- | drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | 10 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/scheduler/gpu_scheduler.h | 1 |
2 files changed, 7 insertions, 4 deletions
diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c index 5017c71ba700..3d45ff29eaa8 100644 --- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | |||
@@ -158,7 +158,7 @@ exit: | |||
158 | if (sched->current_entity && (sched->current_entity != tmp)) | 158 | if (sched->current_entity && (sched->current_entity != tmp)) |
159 | wake_entity = sched->current_entity; | 159 | wake_entity = sched->current_entity; |
160 | sched->current_entity = tmp; | 160 | sched->current_entity = tmp; |
161 | if (wake_entity) | 161 | if (wake_entity && wake_entity->need_wakeup) |
162 | wake_up(&wake_entity->wait_queue); | 162 | wake_up(&wake_entity->wait_queue); |
163 | return tmp; | 163 | return tmp; |
164 | } | 164 | } |
@@ -195,6 +195,7 @@ int amd_sched_entity_init(struct amd_gpu_scheduler *sched, | |||
195 | entity->fence_context = fence_context_alloc(1); | 195 | entity->fence_context = fence_context_alloc(1); |
196 | snprintf(name, sizeof(name), "c_entity[%llu]", entity->fence_context); | 196 | snprintf(name, sizeof(name), "c_entity[%llu]", entity->fence_context); |
197 | memcpy(entity->name, name, 20); | 197 | memcpy(entity->name, name, 20); |
198 | entity->need_wakeup = false; | ||
198 | if(kfifo_alloc(&entity->job_queue, | 199 | if(kfifo_alloc(&entity->job_queue, |
199 | jobs * sizeof(void *), | 200 | jobs * sizeof(void *), |
200 | GFP_KERNEL)) | 201 | GFP_KERNEL)) |
@@ -257,7 +258,7 @@ int amd_sched_entity_fini(struct amd_gpu_scheduler *sched, | |||
257 | 258 | ||
258 | if (!is_context_entity_initialized(sched, entity)) | 259 | if (!is_context_entity_initialized(sched, entity)) |
259 | return 0; | 260 | return 0; |
260 | 261 | entity->need_wakeup = true; | |
261 | /** | 262 | /** |
262 | * The client will not queue more IBs during this fini, consume existing | 263 | * The client will not queue more IBs during this fini, consume existing |
263 | * queued IBs | 264 | * queued IBs |
@@ -323,8 +324,9 @@ int amd_sched_push_job(struct amd_gpu_scheduler *sched, | |||
323 | */ | 324 | */ |
324 | schedule(); | 325 | schedule(); |
325 | } | 326 | } |
326 | 327 | /* first job wake up scheduler */ | |
327 | wake_up_interruptible(&sched->wait_queue); | 328 | if ((kfifo_len(&c_entity->job_queue) / sizeof(void *)) == 1) |
329 | wake_up_interruptible(&sched->wait_queue); | ||
328 | return 0; | 330 | return 0; |
329 | } | 331 | } |
330 | 332 | ||
diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h index 5e35018ad7b8..47823b4a71e0 100644 --- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h +++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h | |||
@@ -54,6 +54,7 @@ struct amd_sched_entity { | |||
54 | bool is_pending; | 54 | bool is_pending; |
55 | uint64_t fence_context; | 55 | uint64_t fence_context; |
56 | char name[20]; | 56 | char name[20]; |
57 | bool need_wakeup; | ||
57 | }; | 58 | }; |
58 | 59 | ||
59 | /** | 60 | /** |