Skip to content

Commit bf90945

Browse files
peppsacalexdeucher
authored andcommitted
drm/amdgpu: disable ring_muxer if mcbp is off
Using the ring_muxer without preemption adds overhead for no reason since mcbp cannot be triggered. Moving back to a single queue in this case also helps when high priority app are used: in this case the gpu_scheduler priority handling will work as expected - much better than ring_muxer with its 2 independant schedulers competing for the same hardware queue. This change requires moving amdgpu_device_set_mcbp above amdgpu_device_ip_early_init because we use adev->gfx.mcbp. Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Acked-by: Christian König <christian.koenig@amd.com> Acked-by: Jiadong Zhu <Jiadong.Zhu@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 190145f commit bf90945

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4056,13 +4056,13 @@ int amdgpu_device_init(struct amdgpu_device *adev,
40564056
goto unmap_memory;
40574057
}
40584058

4059+
amdgpu_device_set_mcbp(adev);
4060+
40594061
/* early init functions */
40604062
r = amdgpu_device_ip_early_init(adev);
40614063
if (r)
40624064
goto unmap_memory;
40634065

4064-
amdgpu_device_set_mcbp(adev);
4065-
40664066
/* Get rid of things like offb */
40674067
r = drm_aperture_remove_conflicting_pci_framebuffers(adev->pdev, &amdgpu_kms_driver);
40684068
if (r)

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2080,7 +2080,7 @@ static int gfx_v9_0_sw_init(void *handle)
20802080
ring->doorbell_index = adev->doorbell_index.gfx_ring0 << 1;
20812081

20822082
/* disable scheduler on the real ring */
2083-
ring->no_scheduler = true;
2083+
ring->no_scheduler = adev->gfx.mcbp;
20842084
ring->vm_hub = AMDGPU_GFXHUB(0);
20852085
r = amdgpu_ring_init(adev, ring, 1024, &adev->gfx.eop_irq,
20862086
AMDGPU_CP_IRQ_GFX_ME0_PIPE0_EOP,
@@ -2090,7 +2090,7 @@ static int gfx_v9_0_sw_init(void *handle)
20902090
}
20912091

20922092
/* set up the software rings */
2093-
if (adev->gfx.num_gfx_rings) {
2093+
if (adev->gfx.mcbp && adev->gfx.num_gfx_rings) {
20942094
for (i = 0; i < GFX9_NUM_SW_GFX_RINGS; i++) {
20952095
ring = &adev->gfx.sw_gfx_ring[i];
20962096
ring->ring_obj = NULL;
@@ -2180,7 +2180,7 @@ static int gfx_v9_0_sw_fini(void *handle)
21802180
int i;
21812181
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
21822182

2183-
if (adev->gfx.num_gfx_rings) {
2183+
if (adev->gfx.mcbp && adev->gfx.num_gfx_rings) {
21842184
for (i = 0; i < GFX9_NUM_SW_GFX_RINGS; i++)
21852185
amdgpu_ring_fini(&adev->gfx.sw_gfx_ring[i]);
21862186
amdgpu_ring_mux_fini(&adev->gfx.muxer);
@@ -5899,11 +5899,14 @@ static int gfx_v9_0_eop_irq(struct amdgpu_device *adev,
58995899

59005900
switch (me_id) {
59015901
case 0:
5902-
if (adev->gfx.num_gfx_rings &&
5903-
!amdgpu_mcbp_handle_trailing_fence_irq(&adev->gfx.muxer)) {
5904-
/* Fence signals are handled on the software rings*/
5905-
for (i = 0; i < GFX9_NUM_SW_GFX_RINGS; i++)
5906-
amdgpu_fence_process(&adev->gfx.sw_gfx_ring[i]);
5902+
if (adev->gfx.num_gfx_rings) {
5903+
if (!adev->gfx.mcbp) {
5904+
amdgpu_fence_process(&adev->gfx.gfx_ring[0]);
5905+
} else if (!amdgpu_mcbp_handle_trailing_fence_irq(&adev->gfx.muxer)) {
5906+
/* Fence signals are handled on the software rings*/
5907+
for (i = 0; i < GFX9_NUM_SW_GFX_RINGS; i++)
5908+
amdgpu_fence_process(&adev->gfx.sw_gfx_ring[i]);
5909+
}
59075910
}
59085911
break;
59095912
case 1:
@@ -7038,7 +7041,7 @@ static void gfx_v9_0_set_ring_funcs(struct amdgpu_device *adev)
70387041
for (i = 0; i < adev->gfx.num_gfx_rings; i++)
70397042
adev->gfx.gfx_ring[i].funcs = &gfx_v9_0_ring_funcs_gfx;
70407043

7041-
if (adev->gfx.num_gfx_rings) {
7044+
if (adev->gfx.mcbp && adev->gfx.num_gfx_rings) {
70427045
for (i = 0; i < GFX9_NUM_SW_GFX_RINGS; i++)
70437046
adev->gfx.sw_gfx_ring[i].funcs = &gfx_v9_0_sw_ring_funcs_gfx;
70447047
}

0 commit comments

Comments
 (0)