Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp5607728ioo; Wed, 1 Jun 2022 08:50:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7ZMiRUkeN+MRrlt+2nw7gmkcABc6bgR3UWku2rIFs/P78OzDe7PG1i2FL/ej8pKwUdnLm X-Received: by 2002:a17:903:230e:b0:166:3781:1e50 with SMTP id d14-20020a170903230e00b0016637811e50mr136667plh.20.1654098604005; Wed, 01 Jun 2022 08:50:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654098603; cv=none; d=google.com; s=arc-20160816; b=XYjYsvmwks8qN511w1/IhI2Kbtq0E9F86XPzIDbLsvSuvp5iTbttlLDebClJsrY7SS OJmCYt1dGeu81hsm5MzAXGB7dDgI/U+/0OyiMBRbBzsSYqetvBkRVd87Ko9Pm1YN5mxV A4DiEQfsTJ2DRafSm+8rROkFI6MkVZAiLlTITJZvxerUZZOa5ycFF+BTICPhvBs9Atoh ab+Qbm4k9l2cEGUXtONfVXwkS9pdZj6KKGPZGjqVuHu+E+2QpYy2US2qcKIgp6Tbv8SM 3vR7w1vUSRZKhMvQwWGOELH+f3jW8dJSTggV5QUK7M+ns3ZYHWGunzO2Q2sPhaoFEgd1 MNrg== 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:to :from:date:feedback-id:dkim-signature:dkim-signature; bh=oo43um3ROPuCPfC/KF7MzWcIrCP9C5yRfhjmYx4w5Bk=; b=mtiFve+ffX13inc5bF91fEA1svXI2zAILE1B0y0zZBaNDclXK/OPSydc4Mc7yUAPFy 32q5c7+F2oUmv1HtEL0ySq9g3xlagQSTQAuA8ySVJtxiZ6Zo2b2ijZUZhmeLH6YD03X0 JlNAZGtSf0ndWgJvc44ok7hF4N0ZG9Tk8ca3jO1PRV/w0a4xuCdW4vVZW4bOZSzfjbRP d5csSqhSvygiByGnPKgfOzgBi/ifN/5uSn2m2JDJedIoNFruEqNkmWFD4I5jN+W302x8 rNusCCjK0yajdveUCxiMrO6U5thqdUJbAWmYgxE/jhFR1g1AK9gGBg61XEpjJuyph6vr amZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (expired) header.i=@cerno.tech header.s=fm3; dkim=neutral (expired) header.i=@messagingengine.com header.s=fm1; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z18-20020a170903019200b0015ec0b44cd1si3005554plg.199.2022.06.01.08.49.49; Wed, 01 Jun 2022 08:50:03 -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=neutral (expired) header.i=@cerno.tech header.s=fm3; dkim=neutral (expired) header.i=@messagingengine.com header.s=fm1; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245052AbiEaI6t (ORCPT + 99 others); Tue, 31 May 2022 04:58:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233830AbiEaI6r (ORCPT ); Tue, 31 May 2022 04:58:47 -0400 Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44C02BC36; Tue, 31 May 2022 01:58:44 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 163C25C0178; Tue, 31 May 2022 04:58:41 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 31 May 2022 04:58:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1653987521; x= 1654073921; bh=oo43um3ROPuCPfC/KF7MzWcIrCP9C5yRfhjmYx4w5Bk=; b=N hhpvJx3+mrLCx5kBTPw04hgqsM8qeNe20J/ISTHZzSyOiKLuOFtJ8JJOZWZqLw/e g3BfrWbGhC+7dX0J4FszaINTCshzB56lFdN/WFLhJucJ9lZj3g01n6i+JzkHhenF bk6aPcyhNwMmCa+r5DGUG+uMVhih5L0ouOJaN73VUjhNHIshT+IdAK0h30Cu2pD7 thubFBdmtTYAxGZUq2QpRvBsXYyJAsmjc0JTsJZxRnpoM/wGD1BEaE2S+4i5WViF gDEKgP6Vawu+Q6GXH/1JQbi2/QWr4aBu09Lm22pYnHAs0WnToWko/fUXWIjZlrhe X1Nb8XpYLkqoDzAUZSSrw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1653987521; x=1654073921; bh=o o43um3ROPuCPfC/KF7MzWcIrCP9C5yRfhjmYx4w5Bk=; b=iH35DW97Ah1NSmTkb tVz2iBYatAt4nAvefd9g/wzaBT3wtQ5MMi+4dFUm7NzpR6MYCHUJl6qvPS1pYLCK hq0hyiLO+YeIbUv3p4113AzEMc/4UUeDuybshE6UO7lrkHDTw8EhliDO7BIt1685 cm8U2/f7vWlGFggl1pjvKsH3zzxwdfIn7RBhJHVpbANY4D5iBP2Rb6sYzaRTV7D8 rbkgdnN5Ytherw5mWfOPpLcIPAmINdEBW2CksTkcbf/K9H1GVtAo8THWZo31/Msj 78Pwui8jvgAVRwVFny1oG9vMLMTc9IXT4qetkgObXQEREAiMcq6Hrhlvl6Ccj9UV W+CjA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrkeekgddutdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkfhggtggugfgjsehtqhertddttddvnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepgfejtedtjefggfffvdetuedthedtheegheeuteekfeeghfdtteejkeeludeg vddunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmh grgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 31 May 2022 04:58:38 -0400 (EDT) Date: Tue, 31 May 2022 10:58:35 +0200 From: Maxime Ripard To: Samuel Holland , Heiko =?utf-8?Q?St=C3=BCbner?= , Sandy Huang , dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, Alistair Francis , =?utf-8?Q?Ond=C5=99ej?= Jirman , Andreas Kemnade , David Airlie , Geert Uytterhoeven , Krzysztof Kozlowski , Liang Chen , Maarten Lankhorst , Michael Riesch , Nicolas Frattaroli , Peter Geis , Rob Herring , Sam Ravnborg , Thierry Reding , Thomas Zimmermann , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 00/16] drm/rockchip: Rockchip EBC ("E-Book Controller") display driver Message-ID: <20220531085835.grw5nt4vyofis3po@penduick> References: <20220413221916.50995-1-samuel@sholland.org> <20220414085018.ayjvscgdkoen5nw5@houat> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,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 Hi Daniel, Thanks for your feedback On Wed, May 25, 2022 at 07:18:07PM +0200, Daniel Vetter wrote: > > > VBLANK Events and Asynchronous Commits > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > > When should the VBLANK event complete? When the pixels have been blit= ted > > > to the kernel's shadow buffer? When the first frame of the waveform is > > > sent to the panel? When the last frame is sent to the panel? > > >=20 > > > Currently, the driver is taking the first option, letting > > > drm_atomic_helper_fake_vblank() send the VBLANK event without waiting= on > > > the refresh thread. This is the only way I was able to get good > > > performance with existing userspace. > >=20 > > I've been having the same kind of discussions in private lately, so I'm > > interested by the answer as well :) > >=20 > > It would be worth looking into the SPI/I2C panels for this, since it's > > basically the same case. >=20 > So it's maybe a bit misnamed and maybe kerneldocs aren't super clear (pls > help improve them), but there's two modes: >=20 > - drivers which have vblank, which might be somewhat variable (VRR) or > become simulated (self-refresh panels), but otherwise is a more-or-less > regular clock. For this case the atomic commit event must match the > vblank events exactly (frame count and timestamp) Part of my interrogation there is do we have any kind of expectation on whether or not, when we commit, the next vblank is going to be the one matching that commit or we're allowed to defer it by an arbitrary number of frames (provided that the frame count and timestamps are correct) ? > - drivers which don't have vblank at all, mostly these are i2c/spi panels > or virtual hw and stuff like that. In this case the event simply happens > when the driver is done with refresh/upload, and the frame count should > be zero (since it's meaningless). >=20 > Unfortuantely the helper to dtrt has fake_vblank in it's name, maybe > should be renamed to no_vblank or so (the various flags that control it > are a bit better named). >=20 > Again the docs should explain it all, but maybe we should clarify them or > perhaps rename that helper to be more meaningful. >=20 > > > Blitting/Blending in Software > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > > > There are multiple layers to this topic (pun slightly intended): > > > 1) Today's userspace does not expect a grayscale framebuffer. > > > Currently, the driver advertises XRGB8888 and converts to Y4 > > > in software. This seems to match other drivers (e.g. repaper). > > > > > > 2) Ignoring what userspace "wants", the closest existing format is > > > DRM_FORMAT_R8. Geert sent a series[4] adding DRM_FORMAT_R1 through > > > DRM_FORMAT_R4 (patch 9), which I believe are the "correct" formats > > > to use. > > >=20 > > > 3) The RK356x SoCs have an "RGA" hardware block that can do the > > > RGB-to-grayscale conversion, and also RGB-to-dithered-monochrome > > > which is needed for animation/video. Currently this is exposed wi= th > > > a V4L2 platform driver. Can this be inserted into the pipeline in= a > > > way that is transparent to userspace? Or must some userspace libr= ary > > > be responsible for setting up the RGA =3D> EBC pipeline? > >=20 > > I'm very interested in this answer as well :) > >=20 > > I think the current consensus is that it's up to userspace to set this > > up though. >=20 > Yeah I think v4l mem2mem device is the answer for these, and then > userspace gets to set it all up. I think the question wasn't really about where that driver should be, but more about who gets to set it up, and if the kernel could have some component to expose the formats supported by the converter, but whenever a commit is being done pipe that to the v4l2 device before doing a page flip. We have a similar use-case for the RaspberryPi where the hardware codec will produce a framebuffer format that isn't standard. That format is understood by the display pipeline, and it can do writeback. However, some people are using a separate display (like a SPI display supported by tinydrm) and we would still like to be able to output the decoded frames there. Is there some way we could plumb things to "route" that buffer through the writeback engine to perform a format conversion before sending it over to the SPI display automatically? Maxime