aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/msm/msm_kms.h
diff options
context:
space:
mode:
authorKrishna Manikandan <mkrishn@codeaurora.org>2020-10-16 19:40:43 +0530
committerRob Clark <robdclark@chromium.org>2020-11-01 10:11:59 -0800
commitb3d91800d9ac35014e0349292273a6fa7938d402 (patch)
tree7df1768f68354c9be9cec39476d139d5a3ac02d2 /drivers/gpu/drm/msm/msm_kms.h
parentLinux 5.10-rc1 (diff)
downloadlinux-dev-b3d91800d9ac35014e0349292273a6fa7938d402.tar.xz
linux-dev-b3d91800d9ac35014e0349292273a6fa7938d402.zip
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>
Diffstat (limited to 'drivers/gpu/drm/msm/msm_kms.h')
-rw-r--r--drivers/gpu/drm/msm/msm_kms.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/gpu/drm/msm/msm_kms.h b/drivers/gpu/drm/msm/msm_kms.h
index 1cbef6b200b7..2049847b6642 100644
--- a/drivers/gpu/drm/msm/msm_kms.h
+++ b/drivers/gpu/drm/msm/msm_kms.h
@@ -155,7 +155,7 @@ struct msm_kms {
* For async commit, where ->flush_commit() and later happens
* from the crtc's pending_timer close to end of the frame:
*/
- struct mutex commit_lock;
+ struct mutex commit_lock[MAX_CRTCS];
unsigned pending_crtc_mask;
struct msm_pending_timer pending_timers[MAX_CRTCS];
};
@@ -165,7 +165,9 @@ static inline void msm_kms_init(struct msm_kms *kms,
{
unsigned i;
- mutex_init(&kms->commit_lock);
+ for (i = 0; i < ARRAY_SIZE(kms->commit_lock); i++)
+ mutex_init(&kms->commit_lock[i]);
+
kms->funcs = funcs;
for (i = 0; i < ARRAY_SIZE(kms->pending_timers); i++)