diff options
author | Christian König <christian.koenig@amd.com> | 2016-02-16 11:39:39 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-03-08 11:01:48 -0500 |
commit | 364beb2cc45247e980a097e53d0932e143873333 (patch) | |
tree | 01aa4a62683d8d35a5c7908b1774e02bbb62dcf3 | |
parent | 257bf15a4b9795f8b352beb6e72a7e3e5aab8d27 (diff) |
drm/amdgpu: return the common fence from amdgpu_fence_emit
Try to avoid using the hardware specific fences even more.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu.h | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 27 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 7 |
3 files changed, 19 insertions, 19 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index 3e4ec56919c7..128eba604f97 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h | |||
@@ -429,7 +429,7 @@ int amdgpu_fence_driver_start_ring(struct amdgpu_ring *ring, | |||
429 | unsigned irq_type); | 429 | unsigned irq_type); |
430 | void amdgpu_fence_driver_suspend(struct amdgpu_device *adev); | 430 | void amdgpu_fence_driver_suspend(struct amdgpu_device *adev); |
431 | void amdgpu_fence_driver_resume(struct amdgpu_device *adev); | 431 | void amdgpu_fence_driver_resume(struct amdgpu_device *adev); |
432 | int amdgpu_fence_emit(struct amdgpu_ring *ring, struct amdgpu_fence **fence); | 432 | int amdgpu_fence_emit(struct amdgpu_ring *ring, struct fence **fence); |
433 | void amdgpu_fence_process(struct amdgpu_ring *ring); | 433 | void amdgpu_fence_process(struct amdgpu_ring *ring); |
434 | int amdgpu_fence_wait_next(struct amdgpu_ring *ring); | 434 | int amdgpu_fence_wait_next(struct amdgpu_ring *ring); |
435 | int amdgpu_fence_wait_empty(struct amdgpu_ring *ring); | 435 | int amdgpu_fence_wait_empty(struct amdgpu_ring *ring); |
@@ -766,7 +766,7 @@ struct amdgpu_ib { | |||
766 | uint32_t length_dw; | 766 | uint32_t length_dw; |
767 | uint64_t gpu_addr; | 767 | uint64_t gpu_addr; |
768 | uint32_t *ptr; | 768 | uint32_t *ptr; |
769 | struct amdgpu_fence *fence; | 769 | struct fence *fence; |
770 | struct amdgpu_user_fence *user; | 770 | struct amdgpu_user_fence *user; |
771 | struct amdgpu_vm *vm; | 771 | struct amdgpu_vm *vm; |
772 | unsigned vm_id; | 772 | unsigned vm_id; |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c index d94b13ac290f..83599f2a0387 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | |||
@@ -91,28 +91,29 @@ static u32 amdgpu_fence_read(struct amdgpu_ring *ring) | |||
91 | * amdgpu_fence_emit - emit a fence on the requested ring | 91 | * amdgpu_fence_emit - emit a fence on the requested ring |
92 | * | 92 | * |
93 | * @ring: ring the fence is associated with | 93 | * @ring: ring the fence is associated with |
94 | * @fence: amdgpu fence object | 94 | * @f: resulting fence object |
95 | * | 95 | * |
96 | * Emits a fence command on the requested ring (all asics). | 96 | * Emits a fence command on the requested ring (all asics). |
97 | * Returns 0 on success, -ENOMEM on failure. | 97 | * Returns 0 on success, -ENOMEM on failure. |
98 | */ | 98 | */ |
99 | int amdgpu_fence_emit(struct amdgpu_ring *ring, struct amdgpu_fence **fence) | 99 | int amdgpu_fence_emit(struct amdgpu_ring *ring, struct fence **f) |
100 | { | 100 | { |
101 | struct amdgpu_device *adev = ring->adev; | 101 | struct amdgpu_device *adev = ring->adev; |
102 | struct amdgpu_fence *fence; | ||
102 | 103 | ||
103 | *fence = kmem_cache_alloc(amdgpu_fence_slab, GFP_KERNEL); | 104 | fence = kmem_cache_alloc(amdgpu_fence_slab, GFP_KERNEL); |
104 | if ((*fence) == NULL) { | 105 | if (fence == NULL) |
105 | return -ENOMEM; | 106 | return -ENOMEM; |
106 | } | 107 | |
107 | (*fence)->seq = ++ring->fence_drv.sync_seq; | 108 | fence->seq = ++ring->fence_drv.sync_seq; |
108 | (*fence)->ring = ring; | 109 | fence->ring = ring; |
109 | fence_init(&(*fence)->base, &amdgpu_fence_ops, | 110 | fence_init(&fence->base, &amdgpu_fence_ops, |
110 | &ring->fence_drv.fence_queue.lock, | 111 | &ring->fence_drv.fence_queue.lock, |
111 | adev->fence_context + ring->idx, | 112 | adev->fence_context + ring->idx, |
112 | (*fence)->seq); | 113 | fence->seq); |
113 | amdgpu_ring_emit_fence(ring, ring->fence_drv.gpu_addr, | 114 | amdgpu_ring_emit_fence(ring, ring->fence_drv.gpu_addr, |
114 | (*fence)->seq, | 115 | fence->seq, AMDGPU_FENCE_FLAG_INT); |
115 | AMDGPU_FENCE_FLAG_INT); | 116 | *f = &fence->base; |
116 | return 0; | 117 | return 0; |
117 | } | 118 | } |
118 | 119 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c index 9550247b030d..979c445f8096 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | |||
@@ -90,9 +90,8 @@ int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm *vm, | |||
90 | */ | 90 | */ |
91 | void amdgpu_ib_free(struct amdgpu_device *adev, struct amdgpu_ib *ib) | 91 | void amdgpu_ib_free(struct amdgpu_device *adev, struct amdgpu_ib *ib) |
92 | { | 92 | { |
93 | amdgpu_sa_bo_free(adev, &ib->sa_bo, &ib->fence->base); | 93 | amdgpu_sa_bo_free(adev, &ib->sa_bo, ib->fence); |
94 | if (ib->fence) | 94 | fence_put(ib->fence); |
95 | fence_put(&ib->fence->base); | ||
96 | } | 95 | } |
97 | 96 | ||
98 | /** | 97 | /** |
@@ -198,7 +197,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, | |||
198 | } | 197 | } |
199 | 198 | ||
200 | if (f) | 199 | if (f) |
201 | *f = fence_get(&ib->fence->base); | 200 | *f = fence_get(ib->fence); |
202 | 201 | ||
203 | amdgpu_ring_commit(ring); | 202 | amdgpu_ring_commit(ring); |
204 | return 0; | 203 | return 0; |