Received: by 2002:a05:7412:f584:b0:e2:908c:2ebd with SMTP id eh4csp1942991rdb; Tue, 5 Sep 2023 09:24:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFuCCt0ZQ3wDBA5EWf1pJd2N/T514mMWT3J0j/4rX2LC56dC+rL/fVF4Dm4gcI7LgDNPthC X-Received: by 2002:a2e:8e97:0:b0:2bc:fd50:573a with SMTP id z23-20020a2e8e97000000b002bcfd50573amr224910ljk.6.1693931083983; Tue, 05 Sep 2023 09:24:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693931083; cv=none; d=google.com; s=arc-20160816; b=Yqco2DtrR5gNUqHCKStSHrfTqaWE9JE+C6fdlPEjypjIO85dyR57vN0wVvkpwrx2pm 4/MjJHfLuJajFRDzEY1Z0MHNyeOmmyxusq010CSQt9UcxwDhyprmwxwVXElzqksN23uo ZWHf/4UGMTzMXgEv2kU643+j2JVX+jGwzuv2+odI+upfAJWRwsWFBtnp4yNcQh998yCl nIraTUYBnZReEsuRrdrbySHDZiNvWI1H7y7Qo1pocW88VP3VjUx/LDINhUOpAucZX22g qePnTDH1196UxYhk46xJ4ALVNaE38s6jPYJ2bfmrP0fHE0bXyn4ldwy0zQyv65uuDwOy av0Q== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=UeKK5EZJuIgCkUx5xqRn3CgwQq16K8S9woQmQDDN6JE=; fh=GkaHvC1hcueeMsWD1eEyL8PgTf7zKZ7NUy+EoZl0FP8=; b=iN+OZjPTidmgK8G3w6DZsiZRd2CAlGeLTWIa9wXBusX1tg/HJBCw8DBAMT6qBd9GpR 5c1PDzd2PaDaC814WUpPzsF3Wov0Xy1dxy/cXQZ6T/dDZzhnRMk43izap0nSkmVvEy4S QwK2zCGAw0K2duMw+WXPTuKXgwjoduX9AfJUnq5SpTajsewGEv/SLb+OmgMLDqWRE9RD 1gXz+48TSuwJ8IEGy/hbzsyKoel61LUybkcQR6Hh0WtwSKn8wPtz2yW+uVE9Og4LDm+d shzd2upKYJBZN7k+Hsq3544U24pRTXSuk2xRBfi+Nib5R064ptmmXWi1ssflH8Vp8dlT U1WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hqc96kth; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z21-20020a1709064e1500b009a1a248ae6fsi7973126eju.876.2023.09.05.09.24.38; Tue, 05 Sep 2023 09:24:43 -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=@kernel.org header.s=k20201202 header.b=hqc96kth; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236904AbjIDPdN (ORCPT + 20 others); Mon, 4 Sep 2023 11:33:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231127AbjIDPdN (ORCPT ); Mon, 4 Sep 2023 11:33:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 906B3CC3 for ; Mon, 4 Sep 2023 08:33:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 25C9CB80E70 for ; Mon, 4 Sep 2023 15:33:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 930FEC433C8; Mon, 4 Sep 2023 15:33:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1693841586; bh=UeKK5EZJuIgCkUx5xqRn3CgwQq16K8S9woQmQDDN6JE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hqc96kthJhcdhdl1Rlk0yY3dQ/CFCUPeOHYx4AbJFcC7PnFUzBNnneQRtC7angbjy hJGxyIO2mGHRrfE06mEn86+a6xnB3yfJvZ0PnYD7ZVsr09GZaqxFa4xWBcw7QlSgkx hwyn81J2jeRSRsQ0LGG7K2eHNULCtT3FTpLqj08H94AJjb+5PmfNjcj0qjUHnFzKTF tn3r7Y/MYD8CZu+2tWHhGgVMAWlrWVk05k82P0g168zcfbAf6KwtXS2NJCEHI/7VIz a8kdhPr2AebRaLXr8yC5srMFnOBncil5ozqq77Frwd4WGIZdSXt5P9Wz67VVILRBwe cF9xW2KNlKgBA== Date: Mon, 4 Sep 2023 17:33:03 +0200 From: Maxime Ripard To: Doug Anderson Cc: dri-devel@lists.freedesktop.org, Linus Walleij , Daniel Vetter , David Airlie , Maarten Lankhorst , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 04/10] drm/panel_helper: Introduce drm_panel_helper Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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 Hi, On Fri, Sep 01, 2023 at 06:42:42AM -0700, Doug Anderson wrote: > On Fri, Sep 1, 2023 at 1:15=E2=80=AFAM Maxime Ripard = wrote: > > On Thu, Aug 31, 2023 at 11:18:49AM -0700, Doug Anderson wrote: > > > Today this is explicitly _not_ refcounting, right? It is simply > > > treating double-enables as no-ops and double-disables as no-ops. With > > > our current understanding, the only thing we actually need to guard > > > against is double-disable but at the moment we do guard against both. > > > Specifically we believe the cases that are issues: > > > > > > a) At shutdown/remove time we want to disable the panel, but only if > > > it was enabled (we wouldn't want to call disable if the panel was > > > already off because userspace turned it off). > > > > Yeah, and that's doable with refcounting too. >=20 > I don't understand the benefit of switching to refcounting, though. We > don't ever expect the "prepare" or "enable" function to be called more > than once and all we're guarding against is a double-unprepare and a > double-enable. Switching this to refcounting would make the reader > think that there was a legitimate case for things to be prepared or > enabled twice. As far as I know, there isn't. Sure, eventually we'll want to remove it. I even said it as such here: https://lore.kernel.org/dri-devel/wwzbd7dt5qyimshnd7sbgkf5gxk7tq5dxtrerz76u= w5p6s7tzt@cbiezkfeuqqn/ However, we have a number of panels following various anti-patterns where disable and unprepare would be called multiple times. A boolean would just ignore the second, refcounting would warn over it, and that's what we want. And that's exactly because there isn't a legitimate case for things to be disabled or unprepared twice, but yet many panel driver do it anyway. > In any case, I don't think there's any need to switch this to > refcounting as part of this effort. Someone could, in theory, do it as > a separate patch series. I'm sorry, but I'll insist on getting a solution that will warn panels that call drm_atomic_helper_shutdown or drm_panel_disable/unprepare by hand. It doesn't have to be refcounting though if you have a better idea in mind. > > > The above solves the problem with panels wanting to power sequence > > > themselves at remove() time, but not at shutdown() time. Thus we'd > > > still have a dependency on having all drivers use > > > drm_atomic_helper_shutdown() so that work becomes a dependency. > > > > Does it? I think it can be done in parallel? >=20 > I don't think it can be in parallel. While it makes sense for panels > to call drm_panel_remove() at remove time, it doesn't make sense for > them to call it at shutdown time. That means that the trick of having > the panel get powered off in drm_panel_remove() won't help for > shutdown. For shutdown, which IMO is the more important case, we need > to wait until all drm drivers call drm_atomic_helper_shutdown() > properly. Right, my point was more that drivers that already don't disable the panel in their shutdown implementation will still not do it. And drivers that do will still do it, so there's no regression. We obviously want to tend to having all drivers call drm_atomic_helper_shutdown(), but not having it will not introduce any regression. Maxime