diff options
author | Christian König <christian.koenig@amd.com> | 2015-11-03 20:58:50 +0100 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-02-10 14:16:56 -0500 |
commit | 8d0a7cea824a2784150ef7f25a1e88f18a2a8f69 (patch) | |
tree | 488fbe4c708a7db0605571fdae60685fcdbbc4c8 /drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c | |
parent | 165e4e07c2cb91658c444ac4dab49473bfb3847b (diff) | |
download | talos-op-linux-8d0a7cea824a2784150ef7f25a1e88f18a2a8f69.tar.gz talos-op-linux-8d0a7cea824a2784150ef7f25a1e88f18a2a8f69.zip |
drm/amdgpu: grab VMID before submitting job v5
This allows the scheduler to handle the dependencies on ID contention as well.
v2: grab id only once
v3: use a separate lock for the VMIDs
v4: cleanup after semaphore removal
v5: minor coding style change
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@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_sched.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c index dd9fac302e55..b22a95f0571c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c @@ -31,7 +31,31 @@ static struct fence *amdgpu_sched_dependency(struct amd_sched_job *sched_job) { struct amdgpu_job *job = to_amdgpu_job(sched_job); - return amdgpu_sync_get_fence(&job->ibs->sync); + struct amdgpu_sync *sync = &job->ibs->sync; + struct amdgpu_vm *vm = job->ibs->vm; + + struct fence *fence = amdgpu_sync_get_fence(sync); + + if (fence == NULL && vm && !job->ibs->grabbed_vmid) { + struct amdgpu_ring *ring = job->ibs->ring; + struct amdgpu_device *adev = ring->adev; + int r; + + mutex_lock(&adev->vm_manager.lock); + r = amdgpu_vm_grab_id(vm, ring, sync); + if (r) { + DRM_ERROR("Error getting VM ID (%d)\n", r); + } else { + fence = &job->base.s_fence->base; + amdgpu_vm_fence(ring->adev, vm, fence); + job->ibs->grabbed_vmid = true; + } + mutex_unlock(&adev->vm_manager.lock); + + fence = amdgpu_sync_get_fence(sync); + } + + return fence; } static struct fence *amdgpu_sched_run_job(struct amd_sched_job *sched_job) |