diff options
author | Monk Liu <Monk.Liu@amd.com> | 2016-03-07 07:49:55 +0300 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-05-02 22:12:59 +0300 |
commit | e686941a32d31d22ce7c8b7faf9cce17816f7c4d (patch) | |
tree | 8715c3287ddb13792ec235411b734caad34c7559 /drivers/gpu/drm/amd/scheduler | |
parent | 03ccf481980f8d3363263e73c64473d8f2779dc0 (diff) | |
download | linux-e686941a32d31d22ce7c8b7faf9cce17816f7c4d.tar.xz |
drm/amdgpu: use sched_job_init to initialize sched_job
Consolidate job initialization in one place rather than
duplicating it in multiple places.
Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/scheduler')
-rw-r--r-- | drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | 17 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/scheduler/gpu_scheduler.h | 5 |
2 files changed, 21 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c index a5ff9458d359..b9d5822bece8 100644 --- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c @@ -335,6 +335,23 @@ void amd_sched_entity_push_job(struct amd_sched_job *sched_job) amd_sched_entity_in(sched_job)); } +/* init a sched_job with basic field */ +int amd_sched_job_init(struct amd_sched_job *job, + struct amd_gpu_scheduler *sched, + struct amd_sched_entity *entity, + void *owner, struct fence **fence) +{ + job->sched = sched; + job->s_entity = entity; + job->s_fence = amd_sched_fence_create(entity, owner); + if (!job->s_fence) + return -ENOMEM; + + if (fence) + *fence = &job->s_fence->base; + return 0; +} + /** * Return ture if we can push more jobs to the hw. */ diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h index 9403145d7bee..74bbec837f58 100644 --- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h +++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h @@ -144,5 +144,8 @@ struct amd_sched_fence *amd_sched_fence_create( struct amd_sched_entity *s_entity, void *owner); void amd_sched_fence_scheduled(struct amd_sched_fence *fence); void amd_sched_fence_signal(struct amd_sched_fence *fence); - +int amd_sched_job_init(struct amd_sched_job *job, + struct amd_gpu_scheduler *sched, + struct amd_sched_entity *entity, + void *owner, struct fence **fence); #endif |