summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/scheduler
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2018-08-06 12:46:41 +0200
committerAlex Deucher <alexander.deucher@amd.com>2018-08-27 11:10:01 -0500
commite854b61acf775a082d01d828fe3430bab0c4769f (patch)
tree5fe694f81bf9bcb9882a5d03cff0508907816aeb /drivers/gpu/drm/scheduler
parent7febe4bfd5d477eba17f70d4879cb81e9787118e (diff)
drm/scheduler: bind job earlier to scheduler
Update job earlier with the scheduler it is supposed to be scheduled on. Otherwise we could incorrectly optimize dependencies when moving an entity from one scheduler to another. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Nayan Deshmukh <nayan26deshmukh@gmail.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/scheduler')
-rw-r--r--drivers/gpu/drm/scheduler/gpu_scheduler.c4
-rw-r--r--drivers/gpu/drm/scheduler/sched_fence.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/drivers/gpu/drm/scheduler/gpu_scheduler.c b/drivers/gpu/drm/scheduler/gpu_scheduler.c
index 695a9643f046..da2da8d85035 100644
--- a/drivers/gpu/drm/scheduler/gpu_scheduler.c
+++ b/drivers/gpu/drm/scheduler/gpu_scheduler.c
@@ -530,8 +530,6 @@ drm_sched_entity_pop_job(struct drm_sched_entity *entity)
if (!sched_job)
return NULL;
- sched_job->sched = sched;
- sched_job->s_fence->sched = sched;
while ((entity->dependency = sched->ops->dependency(sched_job, entity))) {
if (drm_sched_entity_add_dependency_cb(entity)) {
@@ -582,6 +580,8 @@ void drm_sched_entity_push_job(struct drm_sched_job *sched_job,
spin_unlock(&entity->rq_lock);
}
+ sched_job->sched = entity->rq->sched;
+ sched_job->s_fence->sched = entity->rq->sched;
trace_drm_sched_job(sched_job, entity);
atomic_inc(&entity->rq->sched->num_jobs);
WRITE_ONCE(entity->last_user, current->group_leader);
diff --git a/drivers/gpu/drm/scheduler/sched_fence.c b/drivers/gpu/drm/scheduler/sched_fence.c
index d8d2dff9ea2f..20e4da377890 100644
--- a/drivers/gpu/drm/scheduler/sched_fence.c
+++ b/drivers/gpu/drm/scheduler/sched_fence.c
@@ -161,7 +161,7 @@ struct drm_sched_fence *drm_sched_fence_create(struct drm_sched_entity *entity,
return NULL;
fence->owner = owner;
- fence->sched = entity->rq->sched;
+ fence->sched = NULL;
spin_lock_init(&fence->lock);
seq = atomic_inc_return(&entity->fence_seq);