drm/msm: Fix race condition in msm driver with async layer updates
authorKrishna Manikandan <mkrishn@codeaurora.org>
Fri, 16 Oct 2020 14:10:43 +0000 (19:40 +0530)
committerRob Clark <robdclark@chromium.org>
Sun, 1 Nov 2020 18:11:59 +0000 (10:11 -0800)
commitb3d91800d9ac35014e0349292273a6fa7938d402
tree7df1768f68354c9be9cec39476d139d5a3ac02d2
parent3650b228f83adda7e5ee532e2b90429c03f7b9ec
drm/msm: Fix race condition in msm driver with async layer updates

When there are back to back commits with async cursor update,
there is a case where second commit can program the DPU hw
blocks while first didn't complete flushing config to HW.

Synchronize the compositions such that second commit waits
until first commit flushes the composition.

This change also introduces per crtc commit lock, such that
commits on different crtcs are not blocked by each other.

Changes in v2:
- Use an array of mutexes in kms to handle commit
  lock per crtc. (Rob Clark)

Changes in v3:
- Add wrapper functions to handle lock and unlock of
  commit_lock for each crtc. (Rob Clark)

Signed-off-by: Krishna Manikandan <mkrishn@codeaurora.org>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Rob Clark <robdclark@chromium.org>
drivers/gpu/drm/msm/msm_atomic.c
drivers/gpu/drm/msm/msm_kms.h