From 9ce2a6a09df3e1b2694c75c3adffc800067f6e5b Mon Sep 17 00:00:00 2001 From: Soutrik Mukhopadhyay Date: Tue, 14 Mar 2023 16:48:06 +0530 Subject: [PATCH] disp: msm: dp: check for atomic phase This change checks for the atomic state and ensures that allocation and deallocation of vcpi slots is prevented in the same phase. Change-Id: I05c87db43eca8ba749ed8a0907dcaf95945dd645 Signed-off-by: Soutrik Mukhopadhyay --- msm/dp/dp_mst_drm.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/msm/dp/dp_mst_drm.c b/msm/dp/dp_mst_drm.c index 155008db..bd2cb14d 100644 --- a/msm/dp/dp_mst_drm.c +++ b/msm/dp/dp_mst_drm.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2018-2021, The Linux Foundation. All rights reserved. */ @@ -1165,6 +1165,7 @@ static int dp_mst_connector_atomic_check(struct drm_connector *connector, void *display, struct drm_atomic_state *state) { int rc = 0, slots, i; + bool vcpi_released = false; struct drm_connector_state *old_conn_state; struct drm_connector_state *new_conn_state; struct drm_crtc *old_crtc; @@ -1239,6 +1240,7 @@ static int dp_mst_connector_atomic_check(struct drm_connector *connector, slots, rc); goto end; } + vcpi_released = true; } bridge_state->num_slots = 0; @@ -1284,6 +1286,15 @@ mode_set: goto end; } + /* + * check if vcpi slots are trying to get allocated in same phase + * as deallocation. If so, go to end to avoid allocation. + */ + if (vcpi_released) { + DP_WARN("skipping allocation since vcpi was released in the same state \n"); + goto end; + } + if (WARN_ON(bridge_state->num_slots)) { rc = -EINVAL; goto end;