Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp970538rdb; Wed, 1 Nov 2023 07:57:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHmTock9N95VdKe/XvCLZSsl1KRTIUras2k+k7r5+CnhPUavF1F5p/lcyOTkGcqdQlktraH X-Received: by 2002:a17:90b:4acb:b0:280:3650:382a with SMTP id mh11-20020a17090b4acb00b002803650382amr8388392pjb.16.1698850651424; Wed, 01 Nov 2023 07:57:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698850651; cv=none; d=google.com; s=arc-20160816; b=Lfv8jc8KNaTOmbIQaUr3Ujc2q77RPv6DXW9ktrUxt2uPTFe7/auWzx9kSl9YZ6Borg 5hU4SUGSyafRPADO61EMlEnmbJy0X/2aHwYm5qFcDZWSLBtuhEwnM9i1DhqAB/ZCgdhC XkqPAVwq8Rf3h9Best+Xhde2ybbC0IyQVwLmDPzUpP08Ui+6NUo98eMU+trzIGGygNn1 F6BnHnrl5mqUb/ANg81b96YiQScAnVyccgyabHPwxuMbJv6HbTkdFkz7Y11mcauf/goY Bolj8yBbG0IDEPqy2eh2TjtPYnSXN5p2Q6FAXrmw18kT+/bzwZiw2yEHGCIud+VfOi9t p6ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=rIqG3Sus2x1wiuGQPcgCoZmh6kQF/qQEzI4HA0Qd6Ak=; fh=5C3CAkIfBsG8EK8jEaBmpiwV3a9azH+DT0pG9NOmIu4=; b=bfabexRQXcE/M53hNWLlen9rrcR64tttPf4rJ0g4/NDuTqvg+JtfpTOnZQJt+n5FAy nwxQ3Twh/f/E+1ESnxam3fyl5QGI7WtQmNxRdB0qg8QiXMm5/Y7X8tV3flkAHMoTIoyB 92gw/AYKdEKww0w1sPADqSO+BtBrJL2uR3AkvNp1ZsIKenEY6S7n4OT4lBSw2IofmsD8 w+tZxup8sgl9bDfBDhZDi9DXay5glhnVlrk2Jep/CXkOEYqcPwRN5KZVynB4/aM66naP 8/R9dC5JuTRNMsTyAzBQK6g5UyBDwf69NTX+RS5yg2dDYUD/bJcyrJzN8PV14cBzgcwV XjmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=b7mPDl0z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id pi3-20020a17090b1e4300b0028014e223f9si1067235pjb.81.2023.11.01.07.57.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 07:57:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=b7mPDl0z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id B53CC809A7A4; Wed, 1 Nov 2023 07:57:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231634AbjKAO5A (ORCPT + 99 others); Wed, 1 Nov 2023 10:57:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230093AbjKAO47 (ORCPT ); Wed, 1 Nov 2023 10:56:59 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60C63FD for ; Wed, 1 Nov 2023 07:56:53 -0700 (PDT) Received: from pendragon.ideasonboard.com (213-243-189-158.bb.dnainternet.fi [213.243.189.158]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id CF44D8D; Wed, 1 Nov 2023 15:56:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1698850595; bh=5XFw4kIPXXZ2DwgwHP3vUbhDMgLtjcVtiOsJfOvp0J8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=b7mPDl0zzBSqxli5xbl7IZiKaJCRg3QqU6qWhsHDKBU+MY5OBLYRSWD/aKjU9Ki88 PaP01nmHfBQ/1CdNHzbejaKyEBDuR2Ey+js+tiyYGowNsSbEzu8NTB2PoIKcSNjqgW ObZlTG/XgMSzADCVuknTSnvYAq1oWWeI5/4ydigU= Date: Wed, 1 Nov 2023 16:56:58 +0200 From: Laurent Pinchart To: Tomi Valkeinen Cc: Aradhya Bhatia , Devarsh Thakkar , Jyri Sarha , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 10/10] drm/tidss: Fix atomic_flush check Message-ID: <20231101145658.GZ12764@pendragon.ideasonboard.com> References: <20231101-tidss-probe-v1-0-45149e0f9415@ideasonboard.com> <20231101-tidss-probe-v1-10-45149e0f9415@ideasonboard.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20231101-tidss-probe-v1-10-45149e0f9415@ideasonboard.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 01 Nov 2023 07:57:27 -0700 (PDT) Hi Tomi, Thank you for the patch. On Wed, Nov 01, 2023 at 11:17:47AM +0200, Tomi Valkeinen wrote: > tidss_crtc_atomic_flush() checks if the crtc is enabled, and if not, > returns immediately as there's no reason to do any register changes. > > However, the code checks for 'crtc->state->enable', which does not > reflect the actual HW state. We should instead look at the > 'crtc->state->active' flag. > > This causes the tidss_crtc_atomic_flush() to proceed with the flush even > if the active state is false, which then causes us to hit the > WARN_ON(!crtc->state->event) check. > > Fix this by checking the active flag, and while at it, fix the related > debug print which had "active" and "needs modeset" wrong way. > > Signed-off-by: Tomi Valkeinen > --- > drivers/gpu/drm/tidss/tidss_crtc.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/tidss/tidss_crtc.c b/drivers/gpu/drm/tidss/tidss_crtc.c > index 5e5e466f35d1..4c7009a5d643 100644 > --- a/drivers/gpu/drm/tidss/tidss_crtc.c > +++ b/drivers/gpu/drm/tidss/tidss_crtc.c > @@ -169,13 +169,12 @@ static void tidss_crtc_atomic_flush(struct drm_crtc *crtc, > struct tidss_device *tidss = to_tidss(ddev); > unsigned long flags; > > - dev_dbg(ddev->dev, > - "%s: %s enabled %d, needs modeset %d, event %p\n", __func__, > - crtc->name, drm_atomic_crtc_needs_modeset(crtc->state), > - crtc->state->enable, crtc->state->event); > + dev_dbg(ddev->dev, "%s: %s active %d, needs modeset %d, event %p\n", > + __func__, crtc->name, crtc->state->active, > + drm_atomic_crtc_needs_modeset(crtc->state), crtc->state->event); While at it, how about this ? dev_dbg(ddev->dev, "%s: %s is %sactive, %s modeset, event %p\n", __func__, crtc->name, crtc->state->active ? "" : "not ", drm_atomic_crtc_needs_modeset(crtc->state) ? "needs", "doesn't need", crtc->state->event); > > /* There is nothing to do if CRTC is not going to be enabled. */ > - if (!crtc->state->enable) > + if (!crtc->state->active) I think the drm_atomic_helper_commit_planes() helper will handle this if you pass it the DRM_PLANE_COMMIT_ACTIVE_ONLY flag. > return; > > /* -- Regards, Laurent Pinchart