drm/amd/display: Lock the CRTC when setting CRC source
authorNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Tue, 20 Aug 2019 17:15:25 +0000 (13:15 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 22 Aug 2019 03:18:32 +0000 (22:18 -0500)
commit452575c5703cd7d0cf285ef7a97de52af9a3d70d
treef8f438fcfe90086e0bcd8297fc94e74c860485d9
parent57638021b711de052df781001bd6fd35804c3646
drm/amd/display: Lock the CRTC when setting CRC source

[Why]
We need to ensure that we're holding the lock on the CRTC when setting
the CRC source since we're modifying the CRTC state directly.

We also need to wait for any outstanding non-blocking commits to finish
so they aren't reading state that's potentially being modified -
non-blocking commits don't hold the CRTC lock while doing commit tail
work.

[How]
Lock the CRTC using its mutex. While holding the lock check if there's
any commit active on the CRTC - if there is, it's non-blocking and
we should wait until it's finished by waiting for hw_done to be
signaled since that's the last point where we touch CRTC state.

Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Reviewed-by: David Francis <David.Francis@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c