diff options
author | Christian König <christian.koenig@amd.com> | 2015-08-05 22:22:10 +0300 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2015-08-17 23:51:05 +0300 |
commit | 6f0e54a964932d3d5252ac1ff7ab153c984a5d51 (patch) | |
tree | b76540873ccdb18a92e9369943466ba9d8ca67ec /drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c | |
parent | 91404fb20825418fd9ab8e6533bc336e1ffc748e (diff) | |
download | linux-6f0e54a964932d3d5252ac1ff7ab153c984a5d51.tar.xz |
drm/amdgpu: cleanup and fix scheduler fence handling v2
v2: rebased
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com> (v1)
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c index 787b93db6796..039bd1f748f0 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c @@ -43,16 +43,9 @@ static int amdgpu_sched_prepare_job(struct amd_gpu_scheduler *sched, return r; } -static void amdgpu_fence_sched_cb(struct fence *f, struct fence_cb *cb) -{ - struct amd_sched_job *sched_job = - container_of(cb, struct amd_sched_job, cb); - amd_sched_process_job(sched_job); -} - -static void amdgpu_sched_run_job(struct amd_gpu_scheduler *sched, - struct amd_sched_entity *entity, - struct amd_sched_job *job) +static struct fence *amdgpu_sched_run_job(struct amd_gpu_scheduler *sched, + struct amd_sched_entity *entity, + struct amd_sched_job *job) { int r = 0; struct amdgpu_cs_parser *sched_job; @@ -60,7 +53,7 @@ static void amdgpu_sched_run_job(struct amd_gpu_scheduler *sched, if (!job || !job->job) { DRM_ERROR("job is null\n"); - return; + return NULL; } sched_job = (struct amdgpu_cs_parser *)job->job; mutex_lock(&sched_job->job_lock); @@ -70,12 +63,7 @@ static void amdgpu_sched_run_job(struct amd_gpu_scheduler *sched, sched_job->filp); if (r) goto err; - fence = sched_job->ibs[sched_job->num_ibs - 1].fence; - if (fence_add_callback(&fence->base, - &job->cb, amdgpu_fence_sched_cb)) { - DRM_ERROR("fence add callback failed\n"); - goto err; - } + fence = amdgpu_fence_ref(sched_job->ibs[sched_job->num_ibs - 1].fence); if (sched_job->run_job) { r = sched_job->run_job(sched_job); @@ -86,11 +74,13 @@ static void amdgpu_sched_run_job(struct amd_gpu_scheduler *sched, amd_sched_emit(entity, sched_job->ibs[sched_job->num_ibs - 1].sequence); mutex_unlock(&sched_job->job_lock); - return; + return &fence->base; + err: DRM_ERROR("Run job error\n"); mutex_unlock(&sched_job->job_lock); schedule_work(&sched_job->job_work); + return NULL; } static void amdgpu_sched_process_job(struct amd_gpu_scheduler *sched, void *job) |