Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp3645704rwi; Wed, 12 Oct 2022 05:08:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6uDFSVsRCOoJ57iy29QqSlL2YU+cawvOcnyeuMG/DUpRs504VF8MgzfJB2CrGJdsM07Pcc X-Received: by 2002:a17:907:a47:b0:780:6883:2a37 with SMTP id be7-20020a1709070a4700b0078068832a37mr22344234ejc.219.1665576480156; Wed, 12 Oct 2022 05:08:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665576480; cv=none; d=google.com; s=arc-20160816; b=aGUEBthrmNjSRtZKTnN5OsQO66331IK3MgIJZVDz/nwJIwnSm5rZ2NQWau6i7HnOp8 xUd/mSSzupUmX/aAa0LI68tPetT+wOX8XlQr/WZuwMUTTsJQ8sSW1mfqrMR7CariE/X9 su73COXW3nbhPL7tDmZCwFbl0Cs34t7x1vlKPot9o0p4gUn64fTIBAGX/QfvLFlNcRbL fjRjBXUj+7YRwerzwBvb56pFTxYGs42wwjN0D/0W34AP1KAE1Mwef+qOyTM0BK6XGL0q HI+6PaRJD3RzWqit9fEQZyVA3Z55MdSO+aQn9f0WkJsJkrsdn4aTO+Hp1F4WopOiH5G3 tLpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=1XkdyIeRY4IMq0+ZynTUYZGZ44yrxyHsX8c9Iqq7+Xo=; b=BWCEUSf5zpNlabTnZr4D1xYRrIRsp8Dddsf0B9mJYknLf7JgZ4DxOrf7RUtHygbpO0 HoL7WCReI5vMz9b289IuAN0mumAc2BmUATfJ49bf93+BxVy27C1E+bWb522Z9f5rDvub ROjIrgnFn78XZ2753MYT+YKnYBBSLISchlq18b6lZAvNHvbqFf2I9kDL2/NHSFLIBzaw V263u2tXZuHowcg3sehj86WWrANRnKZmLcTrJDDGrE1284hur+n4js9Y175A3495gmS6 cNjZynhcpTLwrEgq9Q9sip59d1qHSR62g1vsAWa4M0SZP+Zb2++bZGPP/UKFa9vRSARQ CQew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=X3JIExY8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gn24-20020a1709070d1800b0078b88453306si16572222ejc.285.2022.10.12.05.07.33; Wed, 12 Oct 2022 05:08:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=X3JIExY8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229788AbiJLMDz (ORCPT + 99 others); Wed, 12 Oct 2022 08:03:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229650AbiJLMC6 (ORCPT ); Wed, 12 Oct 2022 08:02:58 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96E71BE2F6; Wed, 12 Oct 2022 05:02:56 -0700 (PDT) Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29C7xP2r008244; Wed, 12 Oct 2022 12:02:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=qcppdkim1; bh=1XkdyIeRY4IMq0+ZynTUYZGZ44yrxyHsX8c9Iqq7+Xo=; b=X3JIExY8GHs7D4CcH1WcRu/g5XKFZqlSz+bBMeBAXrwe70U+ISDqr3wCnLDFrHX9fTud BjX3LHtzlq+otwWQK8c/76NEuZxTxoZ15sU8l5pnp+iwsVqwj63TuwLDdtPWR7gxym0n PEOxgEuDrSgTPqwO1M72ywE9UsAViVcVZd9SEmmurQbXzz4EZvaluvkHj5fMHBzXsL5S qvbEMOMnNdaQSZnimxjvo3IugP4VW66xRc2kL6LRzT/IIM4lPeVIG6iUrqX/NHX10rCC XgM22F1Pq5bkglTu7zZWEOOwQLnysMldQD3hSPqDbI80s8BFi6jF4hijzBq+bnsEkGJ6 sA== Received: from apblrppmta02.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.18.19]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3k5kar1n9x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Oct 2022 12:02:54 +0000 Received: from pps.filterd (APBLRPPMTA02.qualcomm.com [127.0.0.1]) by APBLRPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 29CC2orX027017; Wed, 12 Oct 2022 12:02:50 GMT Received: from pps.reinject (localhost [127.0.0.1]) by APBLRPPMTA02.qualcomm.com (PPS) with ESMTPS id 3k3jpu0t35-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 12 Oct 2022 12:02:50 +0000 Received: from APBLRPPMTA02.qualcomm.com (APBLRPPMTA02.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 29CC2oMK026987; Wed, 12 Oct 2022 12:02:50 GMT Received: from vpolimer-linux.qualcomm.com (vpolimer-linux.qualcomm.com [10.204.67.235]) by APBLRPPMTA02.qualcomm.com (PPS) with ESMTP id 29CC2mwj026876; Wed, 12 Oct 2022 12:02:50 +0000 Received: by vpolimer-linux.qualcomm.com (Postfix, from userid 463814) id 44C053EF1; Wed, 12 Oct 2022 17:32:47 +0530 (IST) From: Vinod Polimera To: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, devicetree@vger.kernel.org Cc: Vinod Polimera , linux-kernel@vger.kernel.org, robdclark@gmail.com, dianders@chromium.org, swboyd@chromium.org, quic_kalyant@quicinc.com, dmitry.baryshkov@linaro.org, quic_khsieh@quicinc.com, quic_vproddut@quicinc.com, quic_bjorande@quicinc.com, quic_aravindh@quicinc.com, quic_abhinavk@quicinc.com, quic_sbillaka@quicinc.com Subject: [PATCH v8 13/15] drm/msm/disp/dpu: wait for extra vsync till timing engine status is disabled Date: Wed, 12 Oct 2022 17:32:37 +0530 Message-Id: <1665576159-3749-14-git-send-email-quic_vpolimer@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1665576159-3749-1-git-send-email-quic_vpolimer@quicinc.com> References: <1665576159-3749-1-git-send-email-quic_vpolimer@quicinc.com> X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: Vq25-kaGDRWXntx_H0u8x0U9jx-Dz-i6 X-Proofpoint-GUID: Vq25-kaGDRWXntx_H0u8x0U9jx-Dz-i6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-12_06,2022-10-12_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1015 phishscore=0 suspectscore=0 adultscore=0 malwarescore=0 impostorscore=0 priorityscore=1501 mlxscore=0 bulkscore=0 lowpriorityscore=0 mlxlogscore=977 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210120079 X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There can be a race between timing gen disable and vblank irq. The wait post timing gen disable may return early but intf disable sequence might not be completed. Ensure that, intf status is disabled before we retire the function. Signed-off-by: Vinod Polimera --- .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c index 2c14646..5a0dc54 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c @@ -525,6 +525,7 @@ static void dpu_encoder_phys_vid_disable(struct dpu_encoder_phys *phys_enc) { unsigned long lock_flags; int ret; + struct intf_status intf_status = {0}; if (!phys_enc->parent || !phys_enc->parent->dev) { DPU_ERROR("invalid encoder/device\n"); @@ -569,6 +570,26 @@ static void dpu_encoder_phys_vid_disable(struct dpu_encoder_phys *phys_enc) } } + if (phys_enc->hw_intf && phys_enc->hw_intf->ops.get_status) + phys_enc->hw_intf->ops.get_status(phys_enc->hw_intf, &intf_status); + + /* + * Wait for a vsync if timing en status is on after timing engine + * is disabled. + */ + if (intf_status.is_en && dpu_encoder_phys_vid_is_master(phys_enc)) { + spin_lock_irqsave(phys_enc->enc_spinlock, lock_flags); + dpu_encoder_phys_inc_pending(phys_enc); + spin_unlock_irqrestore(phys_enc->enc_spinlock, lock_flags); + ret = dpu_encoder_phys_vid_wait_for_vblank(phys_enc); + if (ret) { + atomic_set(&phys_enc->pending_kickoff_cnt, 0); + DRM_ERROR("wait disable failed: id:%u intf:%d ret:%d\n", + DRMID(phys_enc->parent), + phys_enc->hw_intf->idx - INTF_0, ret); + } + } + phys_enc->enable_state = DPU_ENC_DISABLED; } -- 2.7.4