diff options
author | Christian König <christian.koenig@amd.com> | 2016-02-08 11:13:05 (GMT) |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-02-10 19:17:24 (GMT) |
commit | e86f9ceee19ec028ae79a09fe1eaabf315d67969 (patch) | |
tree | 5f9863ae2b5d30ff4dc3579d0395ea486d735d92 /drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | |
parent | 9f2ade33e659250a810e5bdab0c602085792d5b6 (diff) | |
download | linux-e86f9ceee19ec028ae79a09fe1eaabf315d67969.tar.xz |
drm/amdgpu: move sync into job object
No need to keep that for every IB.
Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_job.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c index 6f3e757..0f6719e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c @@ -46,6 +46,8 @@ int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs, (*job)->ibs = (void *)&(*job)[1]; (*job)->num_ibs = num_ibs; + amdgpu_sync_create(&(*job)->sync); + return 0; } @@ -73,6 +75,7 @@ void amdgpu_job_free(struct amdgpu_job *job) amdgpu_ib_free(job->adev, &job->ibs[i]); amdgpu_bo_unref(&job->uf.bo); + amdgpu_sync_free(&job->sync); kfree(job); } @@ -99,23 +102,22 @@ int amdgpu_job_submit(struct amdgpu_job *job, struct amdgpu_ring *ring, static struct fence *amdgpu_job_dependency(struct amd_sched_job *sched_job) { struct amdgpu_job *job = to_amdgpu_job(sched_job); - struct amdgpu_sync *sync = &job->ibs->sync; struct amdgpu_vm *vm = job->ibs->vm; - struct fence *fence = amdgpu_sync_get_fence(sync); + struct fence *fence = amdgpu_sync_get_fence(&job->sync); if (fence == NULL && vm && !job->ibs->grabbed_vmid) { struct amdgpu_ring *ring = job->ring; int r; - r = amdgpu_vm_grab_id(vm, ring, sync, + r = amdgpu_vm_grab_id(vm, ring, &job->sync, &job->base.s_fence->base); if (r) DRM_ERROR("Error getting VM ID (%d)\n", r); else job->ibs->grabbed_vmid = true; - fence = amdgpu_sync_get_fence(sync); + fence = amdgpu_sync_get_fence(&job->sync); } return fence; @@ -132,9 +134,16 @@ static struct fence *amdgpu_job_run(struct amd_sched_job *sched_job) return NULL; } job = to_amdgpu_job(sched_job); + + r = amdgpu_sync_wait(&job->sync); + if (r) { + DRM_ERROR("failed to sync wait (%d)\n", r); + return NULL; + } + trace_amdgpu_sched_run_job(job); - r = amdgpu_ib_schedule(job->ring, job->num_ibs, job->ibs, - job->owner, &fence); + r = amdgpu_ib_schedule(job->ring, job->num_ibs, job->ibs, job->owner, + job->sync.last_vm_update, &fence); if (r) { DRM_ERROR("Error scheduling IBs (%d)\n", r); goto err; |