Skip to content

Commit 137f9ce

Browse files
Alan Liualexdeucher
authored andcommitted
drm/amd/display: Fix warning in disabling vblank irq
[Why] During gpu-reset, we toggle vblank irq by calling dc_interrupt_set() instead of amdgpu_irq_get/put() because we don't want to change the irq source's refcount. However, we see the warning when vblank irq is enabled by dc_interrupt_set() during gpu-reset but disabled by amdgpu_irq_put() after gpu-reset. [How] Only in dm_gpureset_toggle_interrupts() we toggle vblank interrupts by calling dc_interrupt_set(). Apart from this we call dm_set_vblank() which uses amdgpu_irq_get/put() to operate vblank irq. Reviewed-by: Bhawanpreet Lakha <bhawanpreet.lakha@amd.com> Acked-by: Tom Chung <chiahsuan.chung@amd.com> Signed-off-by: Alan Liu <haoping.liu@amd.com> Tested-by: Daniel Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 40baba5 commit 137f9ce

File tree

2 files changed

+16
-21
lines changed

2 files changed

+16
-21
lines changed

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2479,20 +2479,25 @@ static void dm_gpureset_toggle_interrupts(struct amdgpu_device *adev,
24792479
if (acrtc && state->stream_status[i].plane_count != 0) {
24802480
irq_source = IRQ_TYPE_PFLIP + acrtc->otg_inst;
24812481
rc = dc_interrupt_set(adev->dm.dc, irq_source, enable) ? 0 : -EBUSY;
2482-
DRM_DEBUG_VBL("crtc %d - vupdate irq %sabling: r=%d\n",
2483-
acrtc->crtc_id, enable ? "en" : "dis", rc);
24842482
if (rc)
24852483
DRM_WARN("Failed to %s pflip interrupts\n",
24862484
enable ? "enable" : "disable");
24872485

24882486
if (enable) {
2489-
rc = amdgpu_dm_crtc_enable_vblank(&acrtc->base);
2490-
if (rc)
2491-
DRM_WARN("Failed to enable vblank interrupts\n");
2492-
} else {
2493-
amdgpu_dm_crtc_disable_vblank(&acrtc->base);
2494-
}
2487+
if (amdgpu_dm_crtc_vrr_active(to_dm_crtc_state(acrtc->base.state)))
2488+
rc = amdgpu_dm_crtc_set_vupdate_irq(&acrtc->base, true);
2489+
} else
2490+
rc = amdgpu_dm_crtc_set_vupdate_irq(&acrtc->base, false);
24952491

2492+
if (rc)
2493+
DRM_WARN("Failed to %sable vupdate interrupt\n", enable ? "en" : "dis");
2494+
2495+
irq_source = IRQ_TYPE_VBLANK + acrtc->otg_inst;
2496+
/* During gpu-reset we disable and then enable vblank irq, so
2497+
* don't use amdgpu_irq_get/put() to avoid refcount change.
2498+
*/
2499+
if (!dc_interrupt_set(adev->dm.dc, irq_source, enable))
2500+
DRM_WARN("Failed to %sable vblank interrupt\n", enable ? "en" : "dis");
24962501
}
24972502
}
24982503

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ static void vblank_control_worker(struct work_struct *work)
146146

147147
static inline int dm_set_vblank(struct drm_crtc *crtc, bool enable)
148148
{
149-
enum dc_irq_source irq_source;
150149
struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
151150
struct amdgpu_device *adev = drm_to_adev(crtc->dev);
152151
struct dm_crtc_state *acrtc_state = to_dm_crtc_state(crtc->state);
@@ -169,18 +168,9 @@ static inline int dm_set_vblank(struct drm_crtc *crtc, bool enable)
169168
if (rc)
170169
return rc;
171170

172-
if (amdgpu_in_reset(adev)) {
173-
irq_source = IRQ_TYPE_VBLANK + acrtc->otg_inst;
174-
/* During gpu-reset we disable and then enable vblank irq, so
175-
* don't use amdgpu_irq_get/put() to avoid refcount change.
176-
*/
177-
if (!dc_interrupt_set(adev->dm.dc, irq_source, enable))
178-
rc = -EBUSY;
179-
} else {
180-
rc = (enable)
181-
? amdgpu_irq_get(adev, &adev->crtc_irq, acrtc->crtc_id)
182-
: amdgpu_irq_put(adev, &adev->crtc_irq, acrtc->crtc_id);
183-
}
171+
rc = (enable)
172+
? amdgpu_irq_get(adev, &adev->crtc_irq, acrtc->crtc_id)
173+
: amdgpu_irq_put(adev, &adev->crtc_irq, acrtc->crtc_id);
184174

185175
if (rc)
186176
return rc;

0 commit comments

Comments
 (0)