<p dir="ltr"><br>
On Feb 23, 2014 1:50 AM, "Pekka Paalanen" <<a href="mailto:ppaalanen@gmail.com">ppaalanen@gmail.com</a>> wrote:<br>
><br>
> On Fri, 21 Feb 2014 21:38:15 -0600<br>
> Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>> wrote:<br>
><br>
> > Pekka,<br>
> > Sorry this e-mail took so long to send.  Not much time lately.  The first<br>
> > time or two I read this suggested re-wording I didn't like it, but now it's<br>
> > starting to grow on me.  I still kind of like the idea of "the buffer you<br>
> > sent is now in use, go ahead and send the next one" but I don't know that<br>
> > it's that much better or that it actually changes anything.<br>
><br>
> Hi,<br>
><br>
> there is a slight difference. If the semantics were written as "the<br>
> update you sent is now applied" which is the same as the buffer<br>
> getting into use, just in different words, then that implies that<br>
> we should be queueing also frame callbacks when an update is queued.</p>
<p dir="ltr">Yes, it does change that a bit.</p>
<p dir="ltr">> I still do not know if it is better to queue frame callbacks or<br>
> not, but my current code does not queue them and it avoids the<br>
> corner case of what to do with the callbacks when a queued update<br>
> gets discarded.</p>
<p dir="ltr">Let's go with that for now.  We can always add frame callback queueing if someone decides it's useful, but we can never take it away once it hits libwayland.  Also, it's not clear what interaction other extensions may have with the frame callback and we don't want to make it more complicated for them if we don't have to.</p>

<p dir="ltr">--Jason Ekstrand</p>
<p dir="ltr">> Thanks,<br>
> pq<br>
><br>
> > The big thing I'd like to leave open (and I think your change does) is the<br>
> > 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>> 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 new<br>
> > > +       frame, by creating a frame callback. This is useful for throttling<br>
> > > +       redrawing operations, and driving animations.<br>
> > > +<br>
> > > +       When a client is animating on a wl_surface, it can use the 'frame'<br>
> > > +       request to get notified when it is a good time to draw and commit<br>
> > > the<br>
> > > +       next frame of animation. If the client commits an update earlier<br>
> > > 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 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 let<br>
> > > 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 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 must<br>
> > > not<br>
> > >         attempt to use it after that point.<br>
> > > --<br>
> > > 1.8.3.2<br>
</p>