Received: by 2002:a05:7412:f584:b0:e2:908c:2ebd with SMTP id eh4csp1940235rdb; Tue, 5 Sep 2023 09:20:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHQSdHVvowpubrLj7p9DgsXjglZkI71jItKSvNIxfsqAXAsP/vtUl9yMNTe13+fczHNRn9z X-Received: by 2002:aa7:c493:0:b0:52e:585a:e9c with SMTP id m19-20020aa7c493000000b0052e585a0e9cmr279998edq.2.1693930833675; Tue, 05 Sep 2023 09:20:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693930833; cv=none; d=google.com; s=arc-20160816; b=nJ869weK8UVGSaLhvXz/RK33hpycu3gEp3en1TaChVop7l+rNp1YaY6WyUnnim8200 YLRZQa6Ci/XXhy75Ov3idRyqRcxP4h2nkV5z0jAeDXyWTx2LsVyPnN2SWfEKP4iok4Ln KYfpt59RkyfBGKMwCEGtjKT5lUsNOx4n0jG5WugLAOaifnZ8nx6WSoli0c3d2GNm/cJ5 vYcX/ZrFP1AaPKsFX1EO3yFZdE/QAoj0PN9Rn0kMoZRyWs3Z5Y3a0TNlx5x23roqpO64 u6Qjj79cD5mMB5bAF2cevL14RG0379qoHSg5G5/Wdt5wkXrj01/fWqNkyYat14ek+ZwW JS2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=UL5BjwRyGlAOU7e/CVQ6R12cRk3HAxoys/ZzOGvHYPc=; fh=GtRZAdaS6Truc7ym5U8dt+VpcjiToc6Pk4u1oSMToT8=; b=V9GZ9twqE4ssijWLv7WDqgsSyyQWSagnhg5eRHH1z0TAViwnaMC/geWB/F82c+5zBq hpNbIEJ+Mo6ItaHh5en+JIXP/p2Bikc0iywoB0h4mf4j/aJG01o7Gbioi3i38oFJcrF1 m0ycq/iL+8I2gO23KfxslxUYXfXT2K5mXdlKbrR5BMBbxnk/XhJESbzm5MRDU5tUfmqs 32JIBUodzQ/BRxiCV5piN+jUIT1GpidRNLp1Kvyv+74Ozy0bEf1iUVPdI8ogmgOImHe0 g+eAci+bi4R8rbJ6QHa1Leiil7dfhZKMljeCIRAIG5j67EQywiJ8sDeFH85RZwHHVO0h vQzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=K+UIyTax; 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=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c9-20020aa7d609000000b005255885cbc7si7724997edr.280.2023.09.05.09.20.29; Tue, 05 Sep 2023 09:20:33 -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=@chromium.org header.s=google header.b=K+UIyTax; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349878AbjIANnd (ORCPT + 9 others); Fri, 1 Sep 2023 09:43:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349847AbjIANnX (ORCPT ); Fri, 1 Sep 2023 09:43:23 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80E0F10F3 for ; Fri, 1 Sep 2023 06:43:03 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-500cd6261fdso3679565e87.3 for ; Fri, 01 Sep 2023 06:43:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1693575781; x=1694180581; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=UL5BjwRyGlAOU7e/CVQ6R12cRk3HAxoys/ZzOGvHYPc=; b=K+UIyTax9dawm8cboMdYo0+Ko7D1AgtuYBesANNHyIWBQ69YQIjWaZPGbHILWF2sJN xicWzBnroIQl46w8BH0eFqcFcAIqoRQ47eiTUcwcNdOHKP4BB4NSPwdA6LXgoKfDf3bP zfA/YHTBMFXxcGg9LeiWLORc1Nuqgzjublqbw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693575781; x=1694180581; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UL5BjwRyGlAOU7e/CVQ6R12cRk3HAxoys/ZzOGvHYPc=; b=Kelb/lug+zFalQavWrk3fFtxOG1L4AMf2nCJW8p05XFZnehVCbJLLwCEcaiho8trLE vDgefZqQQOyO7TI2AZcaK8vrEqePxZPb1Es8FDZjRpb2tQZlU1KwhAm9HH3mrrFClyfU 4tAyhPHepcsiI9sqYiL1TI13THXwhoRz8SyiFK2vjHtIt83hSvMtQaq6O3WncroYfBwg lQrGrst5dpR7IpMjAMayPnpoBBvrPFyOxyvOWcbZV/eH1TkIGvTImz/BuyBdmmJXSlms nF5IFeA9gIzRFU7up+f6PfRxSKnKCeNwrSaJTlHxmZV4rMaMD66EW0C+FwSHluWAqo1t qkcg== X-Gm-Message-State: AOJu0YzS5e7VenDo+3XPw++CboIvODLPSrB9xttsfSm3ubr3WXOjeZu/ Oi2MBy7KdlzfFGq/Eds1ZeIjZMQeS+vQtVEjwQ0Do38v X-Received: by 2002:a05:6512:3e2a:b0:500:adc6:141d with SMTP id i42-20020a0565123e2a00b00500adc6141dmr2101889lfv.45.1693575780826; Fri, 01 Sep 2023 06:43:00 -0700 (PDT) Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com. [209.85.167.46]) by smtp.gmail.com with ESMTPSA id a13-20020a056512020d00b005007824ad2esm650289lfo.30.2023.09.01.06.43.00 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 01 Sep 2023 06:43:00 -0700 (PDT) Received: by mail-lf1-f46.google.com with SMTP id 2adb3069b0e04-5009687f822so2429e87.0 for ; Fri, 01 Sep 2023 06:43:00 -0700 (PDT) X-Received: by 2002:a19:ac05:0:b0:4ff:d0c0:5d72 with SMTP id g5-20020a19ac05000000b004ffd0c05d72mr109392lfc.0.1693575779560; Fri, 01 Sep 2023 06:42:59 -0700 (PDT) MIME-Version: 1.0 References: <20230804210644.1862287-1-dianders@chromium.org> <20230804140605.RFC.4.I930069a32baab6faf46d6b234f89613b5cec0f14@changeid> In-Reply-To: From: Doug Anderson Date: Fri, 1 Sep 2023 06:42:42 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH 04/10] drm/panel_helper: Introduce drm_panel_helper To: Maxime Ripard Cc: dri-devel@lists.freedesktop.org, Linus Walleij , Daniel Vetter , David Airlie , Maarten Lankhorst , Thomas Zimmermann , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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 1, 2023 at 1:15=E2=80=AFAM Maxime Ripard w= rote: > > On Thu, Aug 31, 2023 at 11:18:49AM -0700, Doug Anderson wrote: > > Hi, > > > > On Thu, Aug 31, 2023 at 12:38=E2=80=AFAM Maxime Ripard wrote: > > > > > > If so, then I think we can implement everything by doing something li= ke: > > > > > > - Implement enable and disable refcounting in panels. > > > drm_panel_prepare and drm_panel_enable would increase it, > > > drm_panel_unprepare and drm_panel_disable would decrease it. > > > > > > - Only actually call the disable and unprepare functions when that > > > refcount goes to 0 in the normal case. > > > > Just to be clear: by refcounting do you mean switching this to actual > > refcount? > > Yes > > > 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. 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. 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. > > 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? 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. -Doug