Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp5037648iog; Wed, 22 Jun 2022 10:38:00 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t3eRffnRAw2O6nQZgMmjNw/2o2/uTP66IjXkgi2qHVYVz76rK4t0FQlnHgNHJwMatSq8fH X-Received: by 2002:a05:6402:50d2:b0:435:8c44:8715 with SMTP id h18-20020a05640250d200b004358c448715mr5340133edb.49.1655919480490; Wed, 22 Jun 2022 10:38:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655919480; cv=none; d=google.com; s=arc-20160816; b=EPzs46TjEtDQCt9z5UlUd5+EHvhF7ogwb6wJSY4QpcfOdWkWBT1FUIFKMIyCthguIK 0Q0FkL/Uptc61bR1iuC680eFdWRJ/x85G9mZ4jcaqQ7k092FotbMAG/Tpr8F155XLhc5 39cq4dmED+IYd/o/Ey5y7ux1yir6YvOr8nfzWDwmXPcqHep9xRtk71AV6jgF7hfT+Hra R4ueI6G/CoXexijmu2qmftRHQvWhJ9q2iXbUdGyRfqWxNjR5d9jI4vvMkWmHLTFwTa3f dIpvVDxCWL1Jm+u00pKPZ0zcLh554KMJTZZtcxkEDa7XVJHGuS/WIPavX1+CzAb8for5 gG6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=+T1Ha1FXIGuZiI7WiovZ/I2vnWbuysSEufGaNGb5xFw=; b=i9QehbjJwNR31nKUaDfzjYZ5pku/AljUW101MxftNBwXlgai3UYTFp/xcOyi74v1Mg Qug30o6yX9C56OxHnFoya7guF3h/ULeF3IxTCb+l6vPjHVWcpR6sVCXSiBzPurK5fuFF qCFVqQ2t5UdMrfEGt3e4kRkWeblWVdulJ10d6SYp6w6yQWM5gzHCeazSYyvjnwGdPtcl qliPB6g8IX3DBWdU8DuUCtJsYE5lzBEMiEHCHi14wf8g81pRxInKwLJpT/QLPAuv75Ry 0x1sQeMszKCz8oNXsF3csmwVUiyVrWTV6O5yqRjSKgwt/CG9e2SLLKe8ZOdJ76jZyuqa YoHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=pokxT3lr; 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 l10-20020a056402254a00b00435c21eec6esi311630edb.391.2022.06.22.10.37.33; Wed, 22 Jun 2022 10:38: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=qcdkim header.b=pokxT3lr; 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 S1359240AbiFVRYc (ORCPT + 99 others); Wed, 22 Jun 2022 13:24:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344588AbiFVRY1 (ORCPT ); Wed, 22 Jun 2022 13:24:27 -0400 Received: from alexa-out-sd-02.qualcomm.com (alexa-out-sd-02.qualcomm.com [199.106.114.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3B5824092 for ; Wed, 22 Jun 2022 10:24:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1655918666; x=1687454666; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=+T1Ha1FXIGuZiI7WiovZ/I2vnWbuysSEufGaNGb5xFw=; b=pokxT3lrHnUNDT8h5pTJ+SrgaSdCyoK8OczhWQA1cRYza5nOAj2JNfrn fvsevM8Xv0q5/uaS6JXy0dqTZY61S83Y5gkRqv4FfT3WSyvBpb7YkUkwi knH2RGn1nJFjPyWBOCR94DUT9RS1vhfrJT4j3KMwr4g2IXKj1rZeVq8EA 8=; Received: from unknown (HELO ironmsg04-sd.qualcomm.com) ([10.53.140.144]) by alexa-out-sd-02.qualcomm.com with ESMTP; 22 Jun 2022 10:24:26 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg04-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2022 10:24:25 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Wed, 22 Jun 2022 10:24:25 -0700 Received: from [10.111.161.199] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Wed, 22 Jun 2022 10:24:23 -0700 Message-ID: Date: Wed, 22 Jun 2022 10:24:21 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.2 Subject: Re: [PATCH] drm/msm/dpu: Increment vsync_cnt before waking up userspace Content-Language: en-US To: Stephen Boyd , Rob Clark , Dmitry Baryshkov CC: , , Sean Paul , , , Mark Yacoub , Jessica Zhang References: <20220622023855.2970913-1-swboyd@chromium.org> From: Abhinav Kumar In-Reply-To: <20220622023855.2970913-1-swboyd@chromium.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On 6/21/2022 7:38 PM, Stephen Boyd wrote: > The 'vsync_cnt' is used to count the number of frames for a crtc. > Unfortunately, we increment the count after waking up userspace via > dpu_crtc_vblank_callback() calling drm_crtc_handle_vblank(). > drm_crtc_handle_vblank() wakes up userspace processes that have called > drm_wait_vblank_ioctl(), and if that ioctl is expecting the count to > increase it won't. > > Increment the count before calling into the drm APIs so that we don't > have to worry about ordering the increment with anything else in drm. > This fixes a software video decode test that fails to see frame counts > increase on Trogdor boards. > > Cc: Mark Yacoub > Cc: Jessica Zhang > Fixes: 885455d6bf82 ("drm/msm: Change dpu_crtc_get_vblank_counter to use vsync count.") > Signed-off-by: Stephen Boyd This is right, we should increment before drm_crtc_handle_vblank() as that will query the vblank counter. This also matches what we do downstream, hence Reviewed-by: Abhinav Kumar One small nit though, shouldnt the fixes tag be 25fdd5933e4c ("drm/msm: Add SDM845 DPU support") This code has been this way since that commit itself. > --- > drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c > index 3a462e327e0e..a1b8c4592943 100644 > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c > @@ -1251,12 +1251,13 @@ static void dpu_encoder_vblank_callback(struct drm_encoder *drm_enc, > DPU_ATRACE_BEGIN("encoder_vblank_callback"); > dpu_enc = to_dpu_encoder_virt(drm_enc); > > + atomic_inc(&phy_enc->vsync_cnt); > + > spin_lock_irqsave(&dpu_enc->enc_spinlock, lock_flags); > if (dpu_enc->crtc) > dpu_crtc_vblank_callback(dpu_enc->crtc); > spin_unlock_irqrestore(&dpu_enc->enc_spinlock, lock_flags); > > - atomic_inc(&phy_enc->vsync_cnt); > DPU_ATRACE_END("encoder_vblank_callback"); > } > > > base-commit: f2906aa863381afb0015a9eb7fefad885d4e5a56