提交 a340c7bc 编写于 作者: C Chunming Zhou 提交者: Alex Deucher

drm/amdgpu: add dep_sync for amdgpu job

The fence in dep_sync cannot be optimized.
Signed-off-by: NChunming Zhou <David1.Zhou@amd.com>
Tested and Reviewed-by: Roger.He <Hongbo.He@amd.com>
Reviewed-by: NChristian König <christian.koenig@amd.com>
Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
上级 f8af9332
...@@ -1127,6 +1127,7 @@ struct amdgpu_job { ...@@ -1127,6 +1127,7 @@ struct amdgpu_job {
struct amdgpu_vm *vm; struct amdgpu_vm *vm;
struct amdgpu_ring *ring; struct amdgpu_ring *ring;
struct amdgpu_sync sync; struct amdgpu_sync sync;
struct amdgpu_sync dep_sync;
struct amdgpu_sync sched_sync; struct amdgpu_sync sched_sync;
struct amdgpu_ib *ibs; struct amdgpu_ib *ibs;
struct dma_fence *fence; /* the hw fence */ struct dma_fence *fence; /* the hw fence */
......
...@@ -63,6 +63,7 @@ int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs, ...@@ -63,6 +63,7 @@ int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs,
(*job)->num_ibs = num_ibs; (*job)->num_ibs = num_ibs;
amdgpu_sync_create(&(*job)->sync); amdgpu_sync_create(&(*job)->sync);
amdgpu_sync_create(&(*job)->dep_sync);
amdgpu_sync_create(&(*job)->sched_sync); amdgpu_sync_create(&(*job)->sched_sync);
return 0; return 0;
...@@ -102,6 +103,7 @@ static void amdgpu_job_free_cb(struct amd_sched_job *s_job) ...@@ -102,6 +103,7 @@ static void amdgpu_job_free_cb(struct amd_sched_job *s_job)
dma_fence_put(job->fence); dma_fence_put(job->fence);
amdgpu_sync_free(&job->sync); amdgpu_sync_free(&job->sync);
amdgpu_sync_free(&job->dep_sync);
amdgpu_sync_free(&job->sched_sync); amdgpu_sync_free(&job->sched_sync);
kfree(job); kfree(job);
} }
...@@ -112,6 +114,7 @@ void amdgpu_job_free(struct amdgpu_job *job) ...@@ -112,6 +114,7 @@ void amdgpu_job_free(struct amdgpu_job *job)
dma_fence_put(job->fence); dma_fence_put(job->fence);
amdgpu_sync_free(&job->sync); amdgpu_sync_free(&job->sync);
amdgpu_sync_free(&job->dep_sync);
amdgpu_sync_free(&job->sched_sync); amdgpu_sync_free(&job->sched_sync);
kfree(job); kfree(job);
} }
...@@ -144,9 +147,16 @@ static struct dma_fence *amdgpu_job_dependency(struct amd_sched_job *sched_job) ...@@ -144,9 +147,16 @@ static struct dma_fence *amdgpu_job_dependency(struct amd_sched_job *sched_job)
struct amdgpu_job *job = to_amdgpu_job(sched_job); struct amdgpu_job *job = to_amdgpu_job(sched_job);
struct amdgpu_vm *vm = job->vm; struct amdgpu_vm *vm = job->vm;
struct dma_fence *fence = amdgpu_sync_get_fence(&job->sync); struct dma_fence *fence = amdgpu_sync_get_fence(&job->dep_sync);
int r; int r;
if (amd_sched_dependency_optimized(fence, sched_job->s_entity)) {
r = amdgpu_sync_fence(job->adev, &job->sched_sync, fence);
if (r)
DRM_ERROR("Error adding fence to sync (%d)\n", r);
}
if (!fence)
fence = amdgpu_sync_get_fence(&job->sync);
while (fence == NULL && vm && !job->vm_id) { while (fence == NULL && vm && !job->vm_id) {
struct amdgpu_ring *ring = job->ring; struct amdgpu_ring *ring = job->ring;
...@@ -159,11 +169,6 @@ static struct dma_fence *amdgpu_job_dependency(struct amd_sched_job *sched_job) ...@@ -159,11 +169,6 @@ static struct dma_fence *amdgpu_job_dependency(struct amd_sched_job *sched_job)
fence = amdgpu_sync_get_fence(&job->sync); fence = amdgpu_sync_get_fence(&job->sync);
} }
if (amd_sched_dependency_optimized(fence, sched_job->s_entity)) {
r = amdgpu_sync_fence(job->adev, &job->sched_sync, fence);
if (r)
DRM_ERROR("Error adding fence to sync (%d)\n", r);
}
return fence; return fence;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册