aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHawking Zhang <Hawking.Zhang@amd.com>2018-08-08 03:16:43 -0400
committerAlex Deucher <alexander.deucher@amd.com>2019-06-20 22:20:17 -0400
commite537c9946115cf5391f417c23d2601ca8582db9c (patch)
treea90e8e7fbacb2c54f8ac5243b1bfa5102c8e1d87
parentcf02b03f7c001c8fdbc8d8e6b71e83d4efe72441 (diff)
drm/amdgpu: acquire available gfx queues
currently, amdgpu will owns the first gfx queue of each pipe they are: me:0 pipe:0 queue:0 me:0 pipe:1 queue:0 Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com> Reviewed-by: Jack Xiao <jack.xiao@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Acked-by: Felix Kuehling <Felix.Kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c24
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h2
2 files changed, 26 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
index 997932ebbb83..855eff834e2a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
@@ -199,6 +199,30 @@ void amdgpu_gfx_compute_queue_acquire(struct amdgpu_device *adev)
199 adev->gfx.num_compute_rings = AMDGPU_MAX_COMPUTE_RINGS; 199 adev->gfx.num_compute_rings = AMDGPU_MAX_COMPUTE_RINGS;
200} 200}
201 201
202void amdgpu_gfx_graphics_queue_acquire(struct amdgpu_device *adev)
203{
204 int i, queue, pipe, me;
205
206 for (i = 0; i < AMDGPU_MAX_GFX_QUEUES; ++i) {
207 queue = i % adev->gfx.me.num_queue_per_pipe;
208 pipe = (i / adev->gfx.me.num_queue_per_pipe)
209 % adev->gfx.me.num_pipe_per_me;
210 me = (i / adev->gfx.me.num_queue_per_pipe)
211 / adev->gfx.me.num_pipe_per_me;
212
213 if (me >= adev->gfx.me.num_me)
214 break;
215 /* policy: amdgpu owns the first queue per pipe at this stage
216 * will extend to mulitple queues per pipe later */
217 if (me == 0 && queue < 1)
218 set_bit(i, adev->gfx.me.queue_bitmap);
219 }
220
221 /* update the number of active graphics rings */
222 adev->gfx.num_gfx_rings =
223 bitmap_weight(adev->gfx.me.queue_bitmap, AMDGPU_MAX_GFX_QUEUES);
224}
225
202static int amdgpu_gfx_kiq_acquire(struct amdgpu_device *adev, 226static int amdgpu_gfx_kiq_acquire(struct amdgpu_device *adev,
203 struct amdgpu_ring *ring) 227 struct amdgpu_ring *ring)
204{ 228{
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
index 68f7d3cf4fa2..1c5d12eae5a6 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
@@ -335,6 +335,8 @@ int amdgpu_gfx_compute_mqd_sw_init(struct amdgpu_device *adev,
335void amdgpu_gfx_compute_mqd_sw_fini(struct amdgpu_device *adev); 335void amdgpu_gfx_compute_mqd_sw_fini(struct amdgpu_device *adev);
336 336
337void amdgpu_gfx_compute_queue_acquire(struct amdgpu_device *adev); 337void amdgpu_gfx_compute_queue_acquire(struct amdgpu_device *adev);
338void amdgpu_gfx_graphics_queue_acquire(struct amdgpu_device *adev);
339
338int amdgpu_gfx_queue_to_bit(struct amdgpu_device *adev, int mec, 340int amdgpu_gfx_queue_to_bit(struct amdgpu_device *adev, int mec,
339 int pipe, int queue); 341 int pipe, int queue);
340void amdgpu_gfx_bit_to_queue(struct amdgpu_device *adev, int bit, 342void amdgpu_gfx_bit_to_queue(struct amdgpu_device *adev, int bit,