Skip to content

Commit b3656b3

Browse files
Ivan Lipskialexdeucher
authored andcommitted
drm/amd/display: Fix incorrect return of vblank enable on unconfigured crtc
[Why&How] Return -EINVAL when userspace asks us to enable vblank on a crtc that is not yet enabled. Suggested-by: Aurabindo Pillai <[email protected]> Reviewed-by: Aurabindo Pillai <[email protected]> Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/1856 Signed-off-by: Ivan Lipski <[email protected]> Signed-off-by: Wayne Lin <[email protected]> Tested-by: Dan Wheeler <[email protected]> Signed-off-by: Alex Deucher <[email protected]> (cherry picked from commit cb57b8cdb072dc37723b6906da1c37ff9cbc2da4) Cc: [email protected]
1 parent 7d08c3b commit b3656b3

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,12 @@ static inline int amdgpu_dm_crtc_set_vblank(struct drm_crtc *crtc, bool enable)
308308
int irq_type;
309309
int rc = 0;
310310

311-
if (acrtc->otg_inst == -1)
312-
goto skip;
311+
if (enable && !acrtc->base.enabled) {
312+
drm_dbg_vbl(crtc->dev,
313+
"Reject vblank enable on unconfigured CRTC %d (enabled=%d)\n",
314+
acrtc->crtc_id, acrtc->base.enabled);
315+
return -EINVAL;
316+
}
313317

314318
irq_type = amdgpu_display_crtc_idx_to_irq_type(adev, acrtc->crtc_id);
315319

@@ -394,7 +398,7 @@ static inline int amdgpu_dm_crtc_set_vblank(struct drm_crtc *crtc, bool enable)
394398
return rc;
395399
}
396400
#endif
397-
skip:
401+
398402
if (amdgpu_in_reset(adev))
399403
return 0;
400404

0 commit comments

Comments
 (0)