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

drm/amdgpu: add number of hardware submissions to amdgpu_fence_driver_init_ring

Make this a parameter instead of using the global variable directly.
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Reviewed-by: default avatarChunming Zhou <david1.zhou@amd.com>
parent 189e0fb7
...@@ -413,7 +413,8 @@ int amdgpu_fence_driver_init(struct amdgpu_device *adev); ...@@ -413,7 +413,8 @@ int amdgpu_fence_driver_init(struct amdgpu_device *adev);
void amdgpu_fence_driver_fini(struct amdgpu_device *adev); void amdgpu_fence_driver_fini(struct amdgpu_device *adev);
void amdgpu_fence_driver_force_completion(struct amdgpu_device *adev); void amdgpu_fence_driver_force_completion(struct amdgpu_device *adev);
int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring); int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring,
unsigned num_hw_submission);
int amdgpu_fence_driver_start_ring(struct amdgpu_ring *ring, int amdgpu_fence_driver_start_ring(struct amdgpu_ring *ring,
struct amdgpu_irq_src *irq_src, struct amdgpu_irq_src *irq_src,
unsigned irq_type); unsigned irq_type);
......
...@@ -355,15 +355,21 @@ int amdgpu_fence_driver_start_ring(struct amdgpu_ring *ring, ...@@ -355,15 +355,21 @@ int amdgpu_fence_driver_start_ring(struct amdgpu_ring *ring,
* for the requested ring. * for the requested ring.
* *
* @ring: ring to init the fence driver on * @ring: ring to init the fence driver on
* @num_hw_submission: number of entries on the hardware queue
* *
* Init the fence driver for the requested ring (all asics). * Init the fence driver for the requested ring (all asics).
* Helper function for amdgpu_fence_driver_init(). * Helper function for amdgpu_fence_driver_init().
*/ */
int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring) int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring,
unsigned num_hw_submission)
{ {
long timeout; long timeout;
int r; int r;
/* Check that num_hw_submission is a power of two */
if ((num_hw_submission & (num_hw_submission - 1)) != 0)
return -EINVAL;
ring->fence_drv.cpu_addr = NULL; ring->fence_drv.cpu_addr = NULL;
ring->fence_drv.gpu_addr = 0; ring->fence_drv.gpu_addr = 0;
ring->fence_drv.sync_seq = 0; ring->fence_drv.sync_seq = 0;
...@@ -387,7 +393,7 @@ int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring) ...@@ -387,7 +393,7 @@ int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring)
timeout = MAX_SCHEDULE_TIMEOUT; timeout = MAX_SCHEDULE_TIMEOUT;
} }
r = amd_sched_init(&ring->sched, &amdgpu_sched_ops, r = amd_sched_init(&ring->sched, &amdgpu_sched_ops,
amdgpu_sched_hw_submission, num_hw_submission,
timeout, ring->name); timeout, ring->name);
if (r) { if (r) {
DRM_ERROR("Failed to create scheduler on ring %s.\n", DRM_ERROR("Failed to create scheduler on ring %s.\n",
......
...@@ -236,7 +236,8 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring, ...@@ -236,7 +236,8 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,
ring->adev = adev; ring->adev = adev;
ring->idx = adev->num_rings++; ring->idx = adev->num_rings++;
adev->rings[ring->idx] = ring; adev->rings[ring->idx] = ring;
r = amdgpu_fence_driver_init_ring(ring); r = amdgpu_fence_driver_init_ring(ring,
amdgpu_sched_hw_submission);
if (r) if (r)
return r; return r;
} }
......
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