diff options
author | Chunming Zhou <David1.Zhou@amd.com> | 2017-05-09 03:50:22 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-05-24 17:40:35 -0400 |
commit | df83d1ebc9e304fa3ba4bf79dba76418789a77cf (patch) | |
tree | 150b6da48a391edd59e3f74f1da6f948c3fbac51 /drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | |
parent | a022c54e60222fa192004ed951a658cba7262784 (diff) |
drm/amdgpu: add sched sync for amdgpu job v2
this is an improvement for previous patch, the sched_sync is to store fence
that could be skipped as scheduled, when job is executed, we didn't need
pipeline_sync if all fences in sched_sync are signalled, otherwise insert
pipeline_sync still.
v2: handle error when adding fence to sync failed.
Signed-off-by: Chunming Zhou <David1.Zhou@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com> (v1)
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c index 53d0d21ee26d..631a9f77b973 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | |||
@@ -121,6 +121,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, | |||
121 | { | 121 | { |
122 | struct amdgpu_device *adev = ring->adev; | 122 | struct amdgpu_device *adev = ring->adev; |
123 | struct amdgpu_ib *ib = &ibs[0]; | 123 | struct amdgpu_ib *ib = &ibs[0]; |
124 | struct dma_fence *tmp; | ||
124 | bool skip_preamble, need_ctx_switch; | 125 | bool skip_preamble, need_ctx_switch; |
125 | unsigned patch_offset = ~0; | 126 | unsigned patch_offset = ~0; |
126 | struct amdgpu_vm *vm; | 127 | struct amdgpu_vm *vm; |
@@ -160,8 +161,13 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, | |||
160 | dev_err(adev->dev, "scheduling IB failed (%d).\n", r); | 161 | dev_err(adev->dev, "scheduling IB failed (%d).\n", r); |
161 | return r; | 162 | return r; |
162 | } | 163 | } |
163 | if (ring->funcs->emit_pipeline_sync && job && job->need_pipeline_sync) | 164 | |
165 | if (ring->funcs->emit_pipeline_sync && job && | ||
166 | (tmp = amdgpu_sync_get_fence(&job->sched_sync))) { | ||
167 | job->need_pipeline_sync = true; | ||
164 | amdgpu_ring_emit_pipeline_sync(ring); | 168 | amdgpu_ring_emit_pipeline_sync(ring); |
169 | dma_fence_put(tmp); | ||
170 | } | ||
165 | 171 | ||
166 | if (vm) { | 172 | if (vm) { |
167 | r = amdgpu_vm_flush(ring, job); | 173 | r = amdgpu_vm_flush(ring, job); |