drm/amdgpu: remove begin_job/finish_job
authorChristian König <christian.koenig@amd.com>
Wed, 18 May 2016 11:00:38 +0000 (13:00 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 7 Jul 2016 18:50:50 +0000 (14:50 -0400)
Completely pointless and confusing to use a callback
to call into the same code file.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Monk.Liu <monk.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
drivers/gpu/drm/amd/scheduler/gpu_scheduler.h
drivers/gpu/drm/amd/scheduler/sched_fence.c

index f0dafa514fe48f785b5dbf53cc3367e214732414..001030b6822ba0a90acc74a507c7e1c55b847ccf 100644 (file)
@@ -193,6 +193,4 @@ err:
 const struct amd_sched_backend_ops amdgpu_sched_ops = {
        .dependency = amdgpu_job_dependency,
        .run_job = amdgpu_job_run,
-       .begin_job = amd_sched_job_begin,
-       .finish_job = amd_sched_job_finish,
 };
index f5ac01db287bda7b2e2bc0894db05b8510979bff..821bc89bd057e3e4af4c03275119d082b2c055da 100644 (file)
@@ -329,7 +329,7 @@ static void amd_sched_free_job(struct fence *f, struct fence_cb *cb) {
 /* job_finish is called after hw fence signaled, and
  * the job had already been deleted from ring_mirror_list
  */
-void amd_sched_job_finish(struct amd_sched_job *s_job)
+static void amd_sched_job_finish(struct amd_sched_job *s_job)
 {
        struct amd_sched_job *next;
        struct amd_gpu_scheduler *sched = s_job->sched;
@@ -351,7 +351,7 @@ void amd_sched_job_finish(struct amd_sched_job *s_job)
        }
 }
 
-void amd_sched_job_begin(struct amd_sched_job *s_job)
+static void amd_sched_job_begin(struct amd_sched_job *s_job)
 {
        struct amd_gpu_scheduler *sched = s_job->sched;
 
@@ -461,7 +461,7 @@ static void amd_sched_process_job(struct fence *f, struct fence_cb *cb)
        /* remove job from ring_mirror_list */
        spin_lock_irqsave(&sched->job_list_lock, flags);
        list_del_init(&s_fence->s_job->node);
-       sched->ops->finish_job(s_fence->s_job);
+       amd_sched_job_finish(s_fence->s_job);
        spin_unlock_irqrestore(&sched->job_list_lock, flags);
 
        amd_sched_fence_signal(s_fence);
@@ -475,6 +475,7 @@ static int amd_sched_main(void *param)
 {
        struct sched_param sparam = {.sched_priority = 1};
        struct amd_gpu_scheduler *sched = (struct amd_gpu_scheduler *)param;
+       unsigned long flags;
        int r, count;
 
        sched_setscheduler(current, SCHED_FIFO, &sparam);
@@ -499,7 +500,11 @@ static int amd_sched_main(void *param)
                s_fence = sched_job->s_fence;
 
                atomic_inc(&sched->hw_rq_count);
-               amd_sched_job_pre_schedule(sched, sched_job);
+               spin_lock_irqsave(&sched->job_list_lock, flags);
+               list_add_tail(&sched_job->node, &sched->ring_mirror_list);
+               amd_sched_job_begin(sched_job);
+               spin_unlock_irqrestore(&sched->job_list_lock, flags);
+
                fence = sched->ops->run_job(sched_job);
                amd_sched_fence_scheduled(s_fence);
                if (fence) {
index 690ae4b0c67354e0ba63649c67f60e866de56040..69840d7458e6a13f65837b999e2c85abbdf2d85a 100644 (file)
@@ -110,8 +110,6 @@ static inline struct amd_sched_fence *to_amd_sched_fence(struct fence *f)
 struct amd_sched_backend_ops {
        struct fence *(*dependency)(struct amd_sched_job *sched_job);
        struct fence *(*run_job)(struct amd_sched_job *sched_job);
-       void (*begin_job)(struct amd_sched_job *sched_job);
-       void (*finish_job)(struct amd_sched_job *sched_job);
 };
 
 enum amd_sched_priority {
@@ -160,10 +158,6 @@ int amd_sched_job_init(struct amd_sched_job *job,
                       void (*timeout_cb)(struct work_struct *work),
                       void (*free_cb)(struct kref* refcount),
                       void *owner, struct fence **fence);
-void amd_sched_job_pre_schedule(struct amd_gpu_scheduler *sched ,
-                               struct amd_sched_job *s_job);
-void amd_sched_job_finish(struct amd_sched_job *s_job);
-void amd_sched_job_begin(struct amd_sched_job *s_job);
 static inline void amd_sched_job_get(struct amd_sched_job *job)
 {
        if (job)
index 6bdc9b7169d2946744714e233284751071d3aaa1..71931bc4006992b2e5afb48b9fd2f321fa51a2b2 100644 (file)
@@ -58,16 +58,6 @@ void amd_sched_fence_signal(struct amd_sched_fence *fence)
                FENCE_TRACE(&fence->base, "was already signaled\n");
 }
 
-void amd_sched_job_pre_schedule(struct amd_gpu_scheduler *sched ,
-                               struct amd_sched_job *s_job)
-{
-       unsigned long flags;
-       spin_lock_irqsave(&sched->job_list_lock, flags);
-       list_add_tail(&s_job->node, &sched->ring_mirror_list);
-       sched->ops->begin_job(s_job);
-       spin_unlock_irqrestore(&sched->job_list_lock, flags);
-}
-
 void amd_sched_fence_scheduled(struct amd_sched_fence *s_fence)
 {
        struct fence_cb *cur, *tmp;