Commit e39575b9 authored by Nicholas Kazlauskas's avatar Nicholas Kazlauskas Committed by Alex Deucher

drm/amd/display: Fix CRC vblank refs when changing interrupts

[Why]
We only currently drop the vblank reference when the stream is
being removed from the context. We should be dropping it whenever we
disable interrupts and reaquiring it after we re-enable them.

We also never get the extra reference correctly when re-enabling
interrupts, since grabbing the reference has the following condition:

if (!crtc_state->crc_enabled && enable)
        drm_crtc_vblank_get(crtc);

This means that crc_enabled must be *false* in order to grab the extra
reference.

[How]
Always drop the ref whenever we're disabling interrupts.

Only disable CRC capture when the stream is being removed.

Always grab the ref by setting dm_new_crtc_state->crc_enabled = false
before the call to re-enable CRC capture.
Signed-off-by: default avatarNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Reviewed-by: default avatarDavid Francis <David.Francis@amd.com>
Acked-by: default avatarLeo Li <sunpeng.li@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 8ad27806
...@@ -5476,16 +5476,18 @@ static int amdgpu_dm_atomic_commit(struct drm_device *dev, ...@@ -5476,16 +5476,18 @@ static int amdgpu_dm_atomic_commit(struct drm_device *dev,
(!dm_new_crtc_state->interrupts_enabled || (!dm_new_crtc_state->interrupts_enabled ||
drm_atomic_crtc_needs_modeset(new_crtc_state))) { drm_atomic_crtc_needs_modeset(new_crtc_state))) {
/* /*
* If the stream is removed and CRC capture was * Drop the extra vblank reference added by CRC
* enabled on the CRTC the extra vblank reference * capture if applicable.
* needs to be dropped since CRC capture will not
* be re-enabled.
*/ */
if (!dm_new_crtc_state->stream if (dm_new_crtc_state->crc_enabled)
&& dm_new_crtc_state->crc_enabled) {
drm_crtc_vblank_put(crtc); drm_crtc_vblank_put(crtc);
/*
* Only keep CRC capture enabled if there's
* still a stream for the CRTC.
*/
if (!dm_new_crtc_state->stream)
dm_new_crtc_state->crc_enabled = false; dm_new_crtc_state->crc_enabled = false;
}
manage_dm_interrupts(adev, acrtc, false); manage_dm_interrupts(adev, acrtc, false);
} }
...@@ -5737,8 +5739,10 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state) ...@@ -5737,8 +5739,10 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
/* The stream has changed so CRC capture needs to re-enabled. */ /* The stream has changed so CRC capture needs to re-enabled. */
if (dm_new_crtc_state->crc_enabled) if (dm_new_crtc_state->crc_enabled) {
dm_new_crtc_state->crc_enabled = false;
amdgpu_dm_crtc_set_crc_source(crtc, "auto"); amdgpu_dm_crtc_set_crc_source(crtc, "auto");
}
#endif #endif
} }
......
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