From: Eric Anholt Subject: Re: How to design a DRM KMS driver exposing 2D compositing? Date: Tue, 12 Aug 2014 09:10:47 -0700 Message-ID: <87k36dg03c.fsf@eliezer.anholt.net> References: <20140811133855.77ab3f93@gmail.com> <20140811120636.GR8727@phenom.ffwll.local> <87fvh3x7yv.fsf@eliezer.anholt.net> <20140811172745.GT10500@phenom.ffwll.local> <20140812114813.3eeb64b8@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0773904981==" Return-path: In-Reply-To: <20140812114813.3eeb64b8@gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Pekka Paalanen , Daniel Vetter Cc: dri-devel List-Id: dri-devel@lists.freedesktop.org --===============0773904981== Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Pekka Paalanen writes: > On Mon, 11 Aug 2014 19:27:45 +0200 > Daniel Vetter wrote: > >> On Mon, Aug 11, 2014 at 10:16:24AM -0700, Eric Anholt wrote: >> > Daniel Vetter writes: >> >=20 >> > > On Mon, Aug 11, 2014 at 01:38:55PM +0300, Pekka Paalanen wrote: >> > >> Hi, >> > >>=20 >> > >> there is some hardware than can do 2D compositing with an arbitrary >> > >> number of planes. I'm not sure what the absolute maximum number of >> > >> planes is, but for the discussion, let's say it is 100. >> > >>=20 >> > >> There are many complicated, dynamic constraints on how many, what s= ize, >> > >> etc. planes can be used at once. A driver would be able to check th= ose >> > >> before kicking the 2D compositing engine. >> > >>=20 >> > >> The 2D compositing engine in the best case (only few planes used) is >> > >> able to composite on the fly in scanout, just like the usual overlay >> > >> hardware blocks in CRTCs. When the composition complexity goes up, = the >> > >> driver can fall back to compositing into a buffer rather than on the >> > >> fly in scanout. This fallback needs to be completely transparent to= the >> > >> user space, implying only additional latency if anything. >> > >>=20 >> > >> These 2D compositing features should be exposed to user space throu= gh a >> > >> standard kernel ABI, hopefully an existing ABI in the very near fut= ure >> > >> like the KMS atomic. >> > > >> > > I presume we're talking about the video core from raspi? Or at least >> > > something similar? >> >=20 >> > Pekka wasn't sure if things were confidential here, but I can say it: >> > Yeah, it's the RPi. >> >=20 >> > While I haven't written code using the compositor interface (I just did >> > enough to shim in a single plane for bringup, and I'm hoping Pekka and >> > company can handle the rest for me :) ), my understanding is that the >> > way you make use of it is that you've got your previous frame loaded up >> > in the HVS (the plane compositor hardware), then when you're asked to >> > put up a new frame that's going to be too hard, you take some >> > complicated chunk of your scene and ask the HVS to use any spare >> > bandwidth it has while it's still scanning out the previous frame in >> > order to composite that piece of new scene into memory. Then, when it= 's >> > done with the offline composite, you ask the HVS to do the next scanout >> > frame using the original scene with the pre-composited temporary buffe= r. >> >=20 >> > I'm pretty comfortable with the idea of having some large number of >> > planes preallocated, and deciding that "nobody could possibly need more >> > than 16" (or whatever). >> >=20 >> > My initial reaction to "we should just punt when we run out of bandwid= th >> > and have a special driver interface for offline composite" was "that's >> > awful, when the kernel could just get the job done immediately, and >> > easily, and it would know exactly what it needed to composite to get >> > things to fit (unlike userspace)". I'm trying to come up with what >> > benefit there would be to having a separate interface for offline >> > composite. I've got 3 things: >> >=20 >> > - Avoids having a potentially long, interruptible wait in the modeset >> > path while the offline composite happens. But I think we have other >> > interruptible waits in that path alreaady. >> >=20 >> > - Userspace could potentially do something else besides use the HVS to >> > get the fallback done. Video would have to use the HVS, to get the >> > same scaling filters applied as the previous frame where things *did* >> > fit, but I guess you could composite some 1:1 RGBA overlays in GL, >> > which would have more BW available to it than what you're borrowing >> > from the previous frame's HVS capacity. >> >=20 >> > - Userspace could potentially use the offline composite interface for >> > things besides just the running-out-of-bandwidth case. Like, it was >> > doing a nicely-filtered downscale of an overlaid video, then the user >> > hit pause and walked away: you could have a timeout that noticed that >> > the complicated scene hadn't changed in a while, and you'd drop from >> > overlays to a HVS-composited single plane to reduce power. >> >=20 >> > The third one is the one I've actually found kind of compelling, and >> > might be switching me from wanting no userspace visibility into the >> > fallback. But I don't have a good feel for how much complexity there = is >> > to our descriptions of planes, and how much poorly-tested interface we= 'd >> > be adding to support this usecase. >>=20 >> Compositor should already do a rough bw guesstimate and if stuff doesn't >> change any more bake the entire scene into a single framebuffer. The exa= ct >> same issue happens on more usual hw with video overlays, too. >>=20 >> Ofc if it turns out that scanning out your yuv planes is less bw then the >> overlay shouldn't be stopped ofc. But imo there's nothing special here f= or >> the rpi. >>=20=20 >> > (Because, honestly, I don't expect the fallbacks to be hit much -- my >> > understanding of the bandwidth equation is that you're mostly counting >> > the number of pixels that have to be read, and clipped-out pixels >> > because somebody's overlaid on top of you don't count unless they're in >> > the same burst read. So unless people are going nuts with blending in >> > overlays, or downscaled video, it's probably not a problem, and >> > something that gets your pixels on the screen at all is sufficient) >>=20 >> Yeah I guess we need to check reality here. If the "we've run out of bw" >> case just never happens then it's pointless to write special code for it. >> And we can always add a limit later for the case where GL is usually >> better and tell userspace that we can't do this many planes. Exact same >> thing with running out of memory bw can happen anywhere else, too. > > I had a chat with Eric last night, and our different views about the > on-line/real-time performance limits of the HVS seem to be due to alpha > blending. > > Eric has not been using alpha blending much or at all, while my > experiments with Weston and DispmanX pretty much always need alpha > blending (e.g. because DispmanX cannot say that only a sub-region of a > buffer needs blending). Eric says alpha blending kills the > performance. Note, I wasn't saying anything about performance. I was just talking about how compositing in X knows that (almost) everything is actually opaque, so I don't have the worries about alpha blending that you apparently do in Weston. --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCAAGBQJT6jyHAAoJELXWKTbR/J7ofE0P/Rz7vVfzjAX20ue1tHmKQzv9 Bbmb6iEoZolrucp/X0oeLaV2RKjj849NYKy/SIohyCAfZEQsLNwIe7Q8smb8yp8E yxpL+Mv1eyJquv3e+GOgb+lDG8my2MgwhR9cQAQcyaw11MGOQ9OfmjBB6k2LrQUg 9zsCG2ve7Y74JCGWllhFXdP7in1QnKW8KDh1yPSiQKZQktxeQVzAx75Yvo8UJxyK /WrIV/HHhzNs5EcGPEXGEBCpH25+dZ+wLDVn9yEX2eU7WBPfKi77sgeisd5z0Gcj 6+ZaHWDA2njXcXA8JbTc0JDXxvvrShYFWWKm2L+b0qy5Rmacss+Pens21SOp0/zw 5AknDq7rPGQUrKNnsHMuvwUFsHSLm/CX5msklgCZFcwKztR55Su89k4AvLtik4c2 ZLfvMpNEpoS/a+5KgbU0h8b7/++Qq9IHKaXJNCAe8jGFIK2pUSvlrGix1BiuX+ci AO43TwdnM8n4Aho8Q/zlxlelfyFBDlTgRIZMfHyYKa5VqvfyZSXUeC+GwTHmjgxi Omi8A5iHcm57pzP/3WtNXR7ng/kOun3DTpEIWvXc/UJIMwoM83gu0WwR2xSrXsaP j8Stu695/370BEs4oQjn14Flr9/7VZ6GZM+QXRcKC6VRWaoit3OM3e3EkYVxH+og /+YAfaq5ULBUO4i6fnF8 =NHYK -----END PGP SIGNATURE----- --=-=-=-- --===============0773904981== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel --===============0773904981==--