diff options
author | Chunming Zhou <david1.zhou@amd.com> | 2015-08-05 07:52:14 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2015-08-17 16:51:03 -0400 |
commit | 4cef92670bc908aaa48771fc9c72f4bcfb7d6a35 (patch) | |
tree | 4fbd3338f432f461966bc38a1ade2deb90f0a73f /drivers/gpu/drm/amd/amdgpu | |
parent | 80de5913cf31c86d64547af0715de4822c9b1abe (diff) |
drm/amdgpu: process sched job exactly triggered by fence signal
Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Christian K?nig <christian.koenig@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c | 19 |
2 files changed, 14 insertions, 7 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index 53d70f766afe..423cf91ef652 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h | |||
@@ -404,7 +404,7 @@ struct amdgpu_fence_driver { | |||
404 | 404 | ||
405 | struct amdgpu_fence { | 405 | struct amdgpu_fence { |
406 | struct fence base; | 406 | struct fence base; |
407 | struct fence_cb cb; | 407 | |
408 | /* RB, DMA, etc. */ | 408 | /* RB, DMA, etc. */ |
409 | struct amdgpu_ring *ring; | 409 | struct amdgpu_ring *ring; |
410 | uint64_t seq; | 410 | uint64_t seq; |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c index 0fcf020917d0..71a4a7e4b1ae 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c | |||
@@ -45,19 +45,24 @@ static int amdgpu_sched_prepare_job(struct amd_gpu_scheduler *sched, | |||
45 | 45 | ||
46 | static void amdgpu_fence_sched_cb(struct fence *f, struct fence_cb *cb) | 46 | static void amdgpu_fence_sched_cb(struct fence *f, struct fence_cb *cb) |
47 | { | 47 | { |
48 | struct amdgpu_fence *fence = | 48 | struct amd_sched_job *sched_job = |
49 | container_of(cb, struct amdgpu_fence, cb); | 49 | container_of(cb, struct amd_sched_job, cb); |
50 | amd_sched_isr(fence->ring->scheduler); | 50 | amd_sched_process_job(sched_job); |
51 | } | 51 | } |
52 | 52 | ||
53 | static void amdgpu_sched_run_job(struct amd_gpu_scheduler *sched, | 53 | static void amdgpu_sched_run_job(struct amd_gpu_scheduler *sched, |
54 | struct amd_context_entity *c_entity, | 54 | struct amd_context_entity *c_entity, |
55 | void *job) | 55 | struct amd_sched_job *job) |
56 | { | 56 | { |
57 | int r = 0; | 57 | int r = 0; |
58 | struct amdgpu_cs_parser *sched_job = (struct amdgpu_cs_parser *)job; | 58 | struct amdgpu_cs_parser *sched_job; |
59 | struct amdgpu_fence *fence; | 59 | struct amdgpu_fence *fence; |
60 | 60 | ||
61 | if (!job || !job->job) { | ||
62 | DRM_ERROR("job is null\n"); | ||
63 | return; | ||
64 | } | ||
65 | sched_job = (struct amdgpu_cs_parser *)job->job; | ||
61 | mutex_lock(&sched_job->job_lock); | 66 | mutex_lock(&sched_job->job_lock); |
62 | r = amdgpu_ib_schedule(sched_job->adev, | 67 | r = amdgpu_ib_schedule(sched_job->adev, |
63 | sched_job->num_ibs, | 68 | sched_job->num_ibs, |
@@ -67,8 +72,10 @@ static void amdgpu_sched_run_job(struct amd_gpu_scheduler *sched, | |||
67 | goto err; | 72 | goto err; |
68 | fence = sched_job->ibs[sched_job->num_ibs - 1].fence; | 73 | fence = sched_job->ibs[sched_job->num_ibs - 1].fence; |
69 | if (fence_add_callback(&fence->base, | 74 | if (fence_add_callback(&fence->base, |
70 | &fence->cb, amdgpu_fence_sched_cb)) | 75 | &job->cb, amdgpu_fence_sched_cb)) { |
76 | DRM_ERROR("fence add callback failed\n"); | ||
71 | goto err; | 77 | goto err; |
78 | } | ||
72 | 79 | ||
73 | if (sched_job->run_job) { | 80 | if (sched_job->run_job) { |
74 | r = sched_job->run_job(sched_job); | 81 | r = sched_job->run_job(sched_job); |