<p dir="ltr"><br>
On Feb 23, 2014 1:45 AM, "Pekka Paalanen" <<a href="mailto:ppaalanen@gmail.com">ppaalanen@gmail.com</a>> wrote:<br>
><br>
> Hi,<br>
><br>
> thanks for all the comments, it's encouraging to see a concensus<br>
> emerging. One reply below...<br>
><br>
> On Sat, 22 Feb 2014 07:50:01 -0600<br>
> Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>> wrote:<br>
><br>
> > On Feb 22, 2014 2:44 AM, "Axel Davy" <<a href="mailto:axel.davy@ens.fr">axel.davy@ens.fr</a>> wrote:<br>
> > ><br>
> > > Hi,<br>
> > ><br>
> > > I like very much the rewording proposed by Pekka.<br>
> > ><br>
> > > But I dislike your proposition to send frame callbacks right away if the<br>
> > attached buffer has been attached for a long time.<br>
> > ><br>
> > > Your argument seems to be that the client may manage to get to the next<br>
> > pageflip if the frame callback is called right away. But with this<br>
> > argument, I don't see why this behaviour would be only for buffers attached<br>
> > long ago (and then we refresh at a higher frequency than the screen refresh)<br>
> > ><br>
> > > Moreover we may say we can always get the two behaviours with client side<br>
> > code:<br>
> > > . If we keep the current behaviour, the client could know it has attached<br>
> > a buffer for a long time (and that the frame callback it had put, was<br>
> > already called), so if it wants to try to hit next pageflip, it could just<br>
> > commit right away with a new attach<br>
> ><br>
> > Yes, this is what they should be doing. The more I think about the frame<br>
> > callback, the more I think that clients should just put one with every new<br>
> > draw and just track whether that one has been released or not.<br>
> ><br>
> > Unfortunately, we have to do something reasonable in the case where the<br>
> > client requests a frame without drawing. I don't want to restrict the<br>
> > server too much on what it does in that case. It may, for instance, be<br>
> > running on some sort of refresh-on-demand hardware and have no concept of<br>
> > "next flip". When the client asks for a frame callback, it is effectively<br>
> > asking when is a good time to repaint. If now is a good time, the server<br>
> > should be allowed to say so.<br>
> ><br>
> > Pekka, one thing I forgot to mention that should probably be added is that<br>
> > we really should guarantee that frame callbacks get fired in the same order<br>
> > they are requested (per surface order, not global order).<br>
><br>
> Ah, ok. That should be easy to implement by just being careful in<br>
> how the callback lists are managed. Can you elaborate on a use case<br>
> where this is especially useful?<br>
><br>
> Recall that frame callbacks never get "discarded", except when the<br>
> surface is destroyed(?). If the update it was part of gets<br>
> overridden, the callbacks simply move on to the new update that<br>
> overwrote the old one, which means that several update's worth of<br>
> callbacks can trigger at the same time. I guess this is somehow<br>
> behind your proposition?</p>
<p dir="ltr">Yes, it is. First off, we may want to use the language "same order as they are committed" instead of "same order as they are requested" to make all frame callbacks on the same commit the same.</p>
<p dir="ltr">I looked at the code and it seems that Weston already does this, so it shouldn't break anything or take any extra work to implement. Really, it's a nice guarantee for the client that takes basically no work to implement in the server. If a client normally throttles on frame callbacks and then has to suddenly repaint or some reason, it may allow it to avoid the extra logic for detecting the old frame callback and throwing it out. I don't know how big of a deal that is because they're all timestamped anyway, but it's kind of nice.</p>
<p dir="ltr">More importantly, it cleans up some of the edge-cases. Most of the time, it's going to be one frame call back per application component per attach. However, this may not always be the case. In particular, it makes the frame+commit case slightly better defined by providing the simple guarantee that the callback from the frame+commit will come after the callback from the last attach.</p>
<p dir="ltr">Maybe that's not a good reason for the aditional server-side requirement, but it just seems to clean things up nicely.<br>
--Jason</p>
<p dir="ltr">><br>
><br>
> Thanks,<br>
> pq<br>
><br>
><br>
> > > . With your proposition the client could always attach (and perhaps<br>
> > +damage) with a frame+commit (even with the old buffer not released), to be<br>
> > sure to get current behaviour.<br>
> ><br>
> > What do you mean by "current behavior"? And why would they want it?<br>
> ><br>
> > ><br>
> > > I don't think having to do an attach with the old buffer is a good idea,<br>
> > and I favor Pekka's proposition.<br>
> ><br>
> > I wasn't arguing against it. :-)<br>
> ><br>
> > ><br>
> > > Axel Davy<br>
> > ><br>
> > > On 22/02/2014, Jason Ekstrand wrote :<br>
> > >><br>
> > >> Pekka,<br>
> > >> Sorry this e-mail took so long to send. Not much time lately. The<br>
> > first time or two I read this suggested re-wording I didn't like it, but<br>
> > now it's starting to grow on me. I still kind of like the idea of "the<br>
> > buffer you sent is now in use, go ahead and send the next one" but I don't<br>
> > know that it's that much better or that it actually changes anything.<br>
> > >><br>
> > >> The big thing I'd like to leave open (and I think your change does) is<br>
> > the following: Suppose a client commits a buffer and then, several seconds<br>
> > later (after the attached buffer was first used), the user does something<br>
> > that causes the client to refresh. If it does a frame+commit without an<br>
> > attach, the server should be able to respond immediately without waiting<br>
> > for another pageflip. This way the client may be able to render in time<br>
> > for the next flip. Sure, the client might be too slow and miss the flip,<br>
> > but that's really no worse than waiting before sending the frame callback.<br>
> > >><br>
> > >> Point is, it should be a compositor decision and I think you made that<br>
> > clear enough.<br>
> > >><br>
> > >> Looks good to me.<br>
> > >> --Jason Ekstrand<br>
> > >><br>
> > >> Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br>
> > >><br>
> > >> On Fri, Feb 21, 2014 at 7:46 AM, Pekka Paalanen <<a href="mailto:ppaalanen@gmail.com">ppaalanen@gmail.com</a>><br>
> > wrote:<br>
> > >>><br>
> > >>> From: Pekka Paalanen <<a href="mailto:pekka.paalanen@collabora.co.uk">pekka.paalanen@collabora.co.uk</a>><br>
> > >>><br>
> > >>> "the callback event will arrive after the next output refresh" is wrong,<br>
> > >>> if you interpret "output refresh" as framebuffer flip or the moment when<br>
> > >>> the new pixels turn into light the first time. Weston has probably never<br>
> > >>> worked this way.<br>
> > >>><br>
> > >>> Weston triggers the frame callbacks when it submits repainting commands<br>
> > >>> to the GPU, which is before the framebuffer flip.<br>
> > >>><br>
> > >>> Strike the incorrect claim, and the rest of the paragraph which no<br>
> > >>> longer offers useful information.<br>
> > >>><br>
> > >>> As a replacement, expand on the "throttling and driving animations"<br>
> > >>> characteristic. The main purpose is to let clients animate at the<br>
> > >>> display refresh rate, while avoiding drawing frames that will never be<br>
> > >>> presented.<br>
> > >>><br>
> > >>> The new claim is that the server should give some time between<br>
> > >>> triggering frame callbacks and repainting itself, for clients to draw<br>
> > >>> and commit. This is somewhat intimate with the repaint scheduling<br>
> > >>> algorithm a compositor uses, but hopefully the right intention.<br>
> > >>><br>
> > >>><br>
> > >>> Another point of this update is to imply, that frame callbacks should<br>
> > >>> not be used to count compositor repaint cycles nor monitor refresh<br>
> > >>> cycles. It has never been guaranteed to work. Removing the mention of<br>
> > >>> frame callback without an attach hopefully discourages such use.<br>
> > >>><br>
> > >>> v2: don't just remove a paragraph, but add useful information about the<br>
> > >>> request's intent.<br>
> > >>><br>
> > >>> Signed-off-by: Pekka Paalanen <<a href="mailto:pekka.paalanen@collabora.co.uk">pekka.paalanen@collabora.co.uk</a>><br>
> > >>> Cc: Axel Davy <<a href="mailto:axel.davy@ens.fr">axel.davy@ens.fr</a>><br>
> > >>> Cc: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br>
> > >>> ---<br>
> > >>> protocol/wayland.xml | 26 ++++++++++++++++++--------<br>
> > >>> 1 file changed, 18 insertions(+), 8 deletions(-)<br>
> > >>><br>
> > >>> diff --git a/protocol/wayland.xml b/protocol/wayland.xml<br>
> > >>> index e1edbe5..6e370ad 100644<br>
> > >>> --- a/protocol/wayland.xml<br>
> > >>> +++ b/protocol/wayland.xml<br>
> > >>> @@ -1059,22 +1059,32 @@<br>
> > >>> </request><br>
> > >>><br>
> > >>> <request name="frame"><br>
> > >>> - <description summary="request repaint feedback"><br>
> > >>> - Request notification when the next frame is displayed. Useful<br>
> > >>> - for throttling redrawing operations, and driving animations.<br>
> > >>> + <description summary="request a frame throttling hint"><br>
> > >>> + Request a notification when it is a good time start drawing a<br>
> > new<br>
> > >>> + frame, by creating a frame callback. This is useful for<br>
> > throttling<br>
> > >>> + redrawing operations, and driving animations.<br>
> > >>> +<br>
> > >>> + When a client is animating on a wl_surface, it can use the<br>
> > 'frame'<br>
> > >>> + request to get notified when it is a good time to draw and<br>
> > commit the<br>
> > >>> + next frame of animation. If the client commits an update<br>
> > earlier than<br>
> > >>> + that, it is likely that some updates will not make it to the<br>
> > display,<br>
> > >>> + and the client is wasting resources by drawing too often.<br>
> > >>> +<br>
> > >>> The frame request will take effect on the next<br>
> > wl_surface.commit.<br>
> > >>> The notification will only be posted for one frame unless<br>
> > >>> requested again.<br>
> > >>><br>
> > >>> + The server must send the notifications so that a client<br>
> > >>> + will not send excessive updates, while still allowing<br>
> > >>> + the highest possible update rate for clients that wait for the<br>
> > reply<br>
> > >>> + before drawing again. The server should give some time for the<br>
> > client<br>
> > >>> + to draw and commit after sending the frame callback events to<br>
> > let them<br>
> > >>> + hit the next output refresh.<br>
> > >>> +<br>
> > >>> A server should avoid signalling the frame callbacks if the<br>
> > >>> surface is not visible in any way, e.g. the surface is<br>
> > off-screen,<br>
> > >>> or completely obscured by other opaque surfaces.<br>
> > >>><br>
> > >>> - A client can request a frame callback even without an attach,<br>
> > >>> - damage, or any other state changes. wl_surface.commit triggers a<br>
> > >>> - display update, so the callback event will arrive after the next<br>
> > >>> - output refresh where the surface is visible.<br>
> > >>> -<br>
> > >>> The object returned by this request will be destroyed by the<br>
> > >>> compositor after the callback is fired and as such the client<br>
> > must not<br>
> > >>> attempt to use it after that point.<br>
> > >>> --<br>
> > >>> 1.8.3.2<br>
> > >>><br>
> > >><br>
> > ><br>
><br>
><br>
> --<br>
> Pekka Paalanen<br>
> <a href="http://www.iki.fi/pq/">http://www.iki.fi/pq/</a><br>
</p>