Commit 364beb2c authored by Christian König's avatar Christian König Committed by Alex Deucher

drm/amdgpu: return the common fence from amdgpu_fence_emit

Try to avoid using the hardware specific fences even more.
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Reviewed-by: default avatarChunming Zhou <david1.zhou@amd.com>
parent 257bf15a
...@@ -429,7 +429,7 @@ int amdgpu_fence_driver_start_ring(struct amdgpu_ring *ring, ...@@ -429,7 +429,7 @@ int amdgpu_fence_driver_start_ring(struct amdgpu_ring *ring,
unsigned irq_type); unsigned irq_type);
void amdgpu_fence_driver_suspend(struct amdgpu_device *adev); void amdgpu_fence_driver_suspend(struct amdgpu_device *adev);
void amdgpu_fence_driver_resume(struct amdgpu_device *adev); void amdgpu_fence_driver_resume(struct amdgpu_device *adev);
int amdgpu_fence_emit(struct amdgpu_ring *ring, struct amdgpu_fence **fence); int amdgpu_fence_emit(struct amdgpu_ring *ring, struct fence **fence);
void amdgpu_fence_process(struct amdgpu_ring *ring); void amdgpu_fence_process(struct amdgpu_ring *ring);
int amdgpu_fence_wait_next(struct amdgpu_ring *ring); int amdgpu_fence_wait_next(struct amdgpu_ring *ring);
int amdgpu_fence_wait_empty(struct amdgpu_ring *ring); int amdgpu_fence_wait_empty(struct amdgpu_ring *ring);
...@@ -766,7 +766,7 @@ struct amdgpu_ib { ...@@ -766,7 +766,7 @@ struct amdgpu_ib {
uint32_t length_dw; uint32_t length_dw;
uint64_t gpu_addr; uint64_t gpu_addr;
uint32_t *ptr; uint32_t *ptr;
struct amdgpu_fence *fence; struct fence *fence;
struct amdgpu_user_fence *user; struct amdgpu_user_fence *user;
struct amdgpu_vm *vm; struct amdgpu_vm *vm;
unsigned vm_id; unsigned vm_id;
......
...@@ -91,28 +91,29 @@ static u32 amdgpu_fence_read(struct amdgpu_ring *ring) ...@@ -91,28 +91,29 @@ static u32 amdgpu_fence_read(struct amdgpu_ring *ring)
* amdgpu_fence_emit - emit a fence on the requested ring * amdgpu_fence_emit - emit a fence on the requested ring
* *
* @ring: ring the fence is associated with * @ring: ring the fence is associated with
* @fence: amdgpu fence object * @f: resulting fence object
* *
* Emits a fence command on the requested ring (all asics). * Emits a fence command on the requested ring (all asics).
* Returns 0 on success, -ENOMEM on failure. * Returns 0 on success, -ENOMEM on failure.
*/ */
int amdgpu_fence_emit(struct amdgpu_ring *ring, struct amdgpu_fence **fence) int amdgpu_fence_emit(struct amdgpu_ring *ring, struct fence **f)
{ {
struct amdgpu_device *adev = ring->adev; struct amdgpu_device *adev = ring->adev;
struct amdgpu_fence *fence;
*fence = kmem_cache_alloc(amdgpu_fence_slab, GFP_KERNEL); fence = kmem_cache_alloc(amdgpu_fence_slab, GFP_KERNEL);
if ((*fence) == NULL) { if (fence == NULL)
return -ENOMEM; return -ENOMEM;
}
(*fence)->seq = ++ring->fence_drv.sync_seq; fence->seq = ++ring->fence_drv.sync_seq;
(*fence)->ring = ring; fence->ring = ring;
fence_init(&(*fence)->base, &amdgpu_fence_ops, fence_init(&fence->base, &amdgpu_fence_ops,
&ring->fence_drv.fence_queue.lock, &ring->fence_drv.fence_queue.lock,
adev->fence_context + ring->idx, adev->fence_context + ring->idx,
(*fence)->seq); fence->seq);
amdgpu_ring_emit_fence(ring, ring->fence_drv.gpu_addr, amdgpu_ring_emit_fence(ring, ring->fence_drv.gpu_addr,
(*fence)->seq, fence->seq, AMDGPU_FENCE_FLAG_INT);
AMDGPU_FENCE_FLAG_INT); *f = &fence->base;
return 0; return 0;
} }
......
...@@ -90,9 +90,8 @@ int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm *vm, ...@@ -90,9 +90,8 @@ int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm *vm,
*/ */
void amdgpu_ib_free(struct amdgpu_device *adev, struct amdgpu_ib *ib) void amdgpu_ib_free(struct amdgpu_device *adev, struct amdgpu_ib *ib)
{ {
amdgpu_sa_bo_free(adev, &ib->sa_bo, &ib->fence->base); amdgpu_sa_bo_free(adev, &ib->sa_bo, ib->fence);
if (ib->fence) fence_put(ib->fence);
fence_put(&ib->fence->base);
} }
/** /**
...@@ -198,7 +197,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, ...@@ -198,7 +197,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
} }
if (f) if (f)
*f = fence_get(&ib->fence->base); *f = fence_get(ib->fence);
amdgpu_ring_commit(ring); amdgpu_ring_commit(ring);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment