Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2607280iof; Wed, 8 Jun 2022 08:23:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwINz5sDYIGbPeANfJ6ISYz+FhD1Q369VXHpdtx2BXJ00uXSPlAitgP6MYb0W1SOeoIymv3 X-Received: by 2002:a05:6a00:a16:b0:518:ffe0:7229 with SMTP id p22-20020a056a000a1600b00518ffe07229mr70426190pfh.49.1654701833345; Wed, 08 Jun 2022 08:23:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654701833; cv=none; d=google.com; s=arc-20160816; b=LXX0Vig/X3h+QynUaByYsS3l7tVhpH7p1IIcmZtoWuUlpZRqSG9WC9ObSJ2x7JzruW Wf8UcK0/66HaKQfBwEMqb9Y7JHLf0rYWxL1X6YoRkSEWDzExB7Cbi/OQ3vuKZMJDQF+w w79iXOVT+ZmpPe3/+eKjin1JvI4CGmsG4td5BPzS55RoS/znWShkoIPTOqPQH8EUVmMW ba4rJTSd7A/I1gUgRb3scSuLnJdoiB8l+JxirjbkohLoPGlL04jBTPvvVOaPhKiQlPDf Jx11SJzAtYSGN0+uoz+4iw2pVcCR4dlZDdPtwsJ2jvXRx3g5hQqJsulhAH2qBPci6Awr P1lg== 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:to:from:date:feedback-id :dkim-signature:dkim-signature; bh=wvfHGDUJj5HTe8KNpI/We7HJo6zHxzE6/zDY7YQE62U=; b=Pzu4msK0KoDdALDQJg2RQbt6WmAau8BLJtvgT8XI/5KOeum1/lbHVCSjEi9hVBMBAG GmyruDcrmYmejVVIoMRzzUuah45/rGEmYksMeeSGFN7FGd938iyUT8nYjz70ayPpnlti shdob7pLXH5pg6mc7OjLrpfRIxMsKTWfEsDN2XiZAJ2oM0nzDbqtnEIOTnUn/S6nDUcH k9CuBcdZtWjMnaNLaqNWfv7lzLHVs4EiECyb/h1YfZncIL7RX/1jZclp7gurTpVeEUTL B6fNspdxUJBHlY+WTh1NrB44nTZx6osJvnaW07C7nXQOFJKUmljsXVHzF+FBCWa+QRO/ WurA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm1 header.b=gjQXF1at; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b="LU/8i0p8"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id q206-20020a632ad7000000b003fb98080549si28366106pgq.762.2022.06.08.08.23.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 08:23:53 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm1 header.b=gjQXF1at; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b="LU/8i0p8"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0C1A53DF14D; Wed, 8 Jun 2022 07:53:14 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241897AbiFHOwX (ORCPT + 99 others); Wed, 8 Jun 2022 10:52:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243743AbiFHOvS (ORCPT ); Wed, 8 Jun 2022 10:51:18 -0400 Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20DA72C6530; Wed, 8 Jun 2022 07:50:12 -0700 (PDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 135225C01D7; Wed, 8 Jun 2022 10:48:51 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Wed, 08 Jun 2022 10:48:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :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=fm1; t=1654699731; x=1654786131; bh=wvfHGDUJj5 HTe8KNpI/We7HJo6zHxzE6/zDY7YQE62U=; b=gjQXF1atg0p2d3bAa3gaA/bP1t MIcmOetW6epvjQL6zhjlxYMCXxPSSuhMSMSjap9/8qE+mkBw4h9ZNKTgV7a0RaZl /SfgjXQZocDn36RpJDFoXpWRf2ee7O4vnq6TDpis57kBZdOeKbf0PEoQB0ojyUuT 23hZ84CHt/9hOUGahKKqSmw/NQsS7YnT+4gncv7hc+X9ecSRixmkCl84oRPBJEj8 amo01RLfXRfiaTCpBlHrL2BlV+e+mIPhRSVnBaAC9eo8isN3ov8tq5TwzgXGi+Nt e0PaR9B0YWFnjgmJrO6ARKDyqAQ9EF5G5ftClY/W8Fgdzojv1r0Uk53I6dow== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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= fm2; t=1654699731; x=1654786131; bh=wvfHGDUJj5HTe8KNpI/We7HJo6zH xzE6/zDY7YQE62U=; b=LU/8i0p8cid4FsmSI7SS17u0V5nOI8l3a236Wusg/0oM UZXwTqWLee9gqeHJf2VqkDphlnpyToDjVAoY9SXoDUC8s8/GrQglyXmjZQKWdWnD maQmBy+xqVVhPxg9aB1zwI0Uo8Qj/Nn+bw3o9L6UP29CzBNJ62toSwBXyIzITq5O rUBXCfutEey5JfCPlQX3W0sJEjw6U+2isCSyi1U2cR6qWp4KdqVXuLH7h9c23FDT y3xSX4cSU+8DfYzRJRBqTzaI5O0wlI0w036LeJ0Bt3EvHV2EtAdBlUuzugSb2ZXV GKsbym/x9JX3zeZomXtm6VfRY+pNRFQrxIxIPJrEMw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedruddtjedgkedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepleekgeehhfdutdeljefgleejffehfffgieejhffgueefhfdtveetgeehieeh gedunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmh grgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 8 Jun 2022 10:48:49 -0400 (EDT) Date: Wed, 8 Jun 2022 16:48:47 +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: <20220608144847.3ibr4buxcbmfj3al@houat> References: <20220413221916.50995-1-samuel@sholland.org> <20220414085018.ayjvscgdkoen5nw5@houat> <20220531085835.grw5nt4vyofis3po@penduick> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="5uxifszvnbelvki3" Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 --5uxifszvnbelvki3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jun 01, 2022 at 02:35:35PM +0200, Daniel Vetter wrote: > On Tue, May 31, 2022 at 10:58:35AM +0200, Maxime Ripard wrote: > > Hi Daniel, > >=20 > > Thanks for your feedback > >=20 > > 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 = blitted > > > > > to the kernel's shadow buffer? When the first frame of the wavefo= rm 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 wai= ting 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 i= t'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) > >=20 > > 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) ? >=20 > In general yes, but there's no guarantee. The only guarante we give for > drivers with vblank counters is that if you receive a vblank event (flip > complete or vblank event) for frame #n, then an immediate flip/atomic > ioctl call will display earliest for frame #n+1. >=20 > Also usually you should be able to hit #n+1, but even today with fun stuff > like self refresh panels getting out of self refresh mode might take a bit > more than a few frames, and so you might end up being late. But otoh if > you just do a page flip loop then on average (after the crtc is fully > resumed) you should be able to update at vrefresh rate exactly. I had more the next item in mind there: if we were to write something in the kernel that would transparently behave like a full-blown KMS driver, but would pipe the commits through a KMS writeback driver before sending them to our SPI panel, we would always be at best two vblanks late. So this would mean that userspace would do a page flip, get a first vblank, but the actual vblank for that commit would be the next one (at best), consistently. > > > - drivers which don't have vblank at all, mostly these are i2c/spi pa= nels > > > or virtual hw and stuff like that. In this case the event simply ha= ppens > > > when the driver is done with refresh/upload, and the frame count sh= ould > > > 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 the= m 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 th= rough > > > > > DRM_FORMAT_R4 (patch 9), which I believe are the "correct" fo= rmats > > > > > 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-monochr= ome > > > > > which is needed for animation/video. Currently this is expose= d with > > > > > a V4L2 platform driver. Can this be inserted into the pipelin= e in a > > > > > way that is transparent to userspace? Or must some userspace = library > > > > > 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 t= his > > > > up though. > > >=20 > > > Yeah I think v4l mem2mem device is the answer for these, and then > > > userspace gets to set it all up. > >=20 > > 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. > >=20 > > 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. > >=20 > > 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. > >=20 > > 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? >=20 > Currently not transparently. Or at least no one has done that, and I'm not > sure that's really a great idea. With big gpus all that stuff is done with > separate command submission to the render side of things, and you can > fully pipeline all that with in/out-fences. >=20 > Doing that in the kms driver side in the kernel feels very wrong to me :-/ So I guess what you're saying is that there's a close to 0% chance of it being accepted if we were to come up with such an architecture? Thanks! Maxime --5uxifszvnbelvki3 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCYqC2zwAKCRDj7w1vZxhR xfFhAQDpMG8318nD1cMM0/HpUu4Jvkjq5pn1/sC4MDW1ViKg7gEAifSRNemz4cgr ZtPYHR4j21YFIDjjzeYl80Rl/2PoBwc= =iUBo -----END PGP SIGNATURE----- --5uxifszvnbelvki3--