From: Jammy Zhou Date: Fri, 31 Jul 2015 09:18:15 +0000 (+0800) Subject: drm/amdgpu: add amd_sched_commit X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f95b7e3e8664fbea4e60f15e7e8a975e4b2b7c3f;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git drm/amdgpu: add amd_sched_commit This function is to update last_emitted_v_seq and wake up the waiters. It should be called by driver in the run_job backend function Signed-off-by: Jammy Zhou Reviewed-by: Christian König Reviewed-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c index 8c01c51aac41..83138a6c54b5 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c @@ -62,9 +62,8 @@ static void amdgpu_sched_run_job(struct amd_gpu_scheduler *sched, if (r) goto err; } - atomic64_set(&c_entity->last_emitted_v_seq, - sched_job->ibs[sched_job->num_ibs - 1].sequence); - wake_up_all(&c_entity->wait_emit); + + amd_sched_emit(c_entity, sched_job->ibs[sched_job->num_ibs - 1].sequence); mutex_unlock(&sched_job->job_lock); return; diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c index 2c4c261ff928..66938f1597bb 100644 --- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c @@ -495,3 +495,15 @@ int amd_sched_destroy(struct amd_gpu_scheduler *sched) return 0; } +/** + * Update emitted sequence and wake up the waiters, called by run_job + * in driver side + * + * @entity The context entity + * @seq The sequence number for the latest emitted job +*/ +void amd_sched_emit(struct amd_context_entity *c_entity, uint64_t seq) +{ + atomic64_set(&c_entity->last_emitted_v_seq, seq); + wake_up_all(&c_entity->wait_emit); +} diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h index 37dd6370bd98..af2afdf2309c 100644 --- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h +++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h @@ -151,4 +151,6 @@ int amd_context_entity_init(struct amd_gpu_scheduler *sched, uint32_t context_id, uint32_t jobs); +void amd_sched_emit(struct amd_context_entity *c_entity, uint64_t seq); + #endif