[PATCH wayland v2 5/8] client: Fully flush during blocking dispatch

Jonas Ådahl jadahl at gmail.com
Tue Dec 29 06:24:43 PST 2015


On Tue, Dec 29, 2015 at 11:07:55AM +0000, Daniel Stone wrote:
> Hi Jonas,
> 
> On 29 December 2015 at 02:10, Jonas Ådahl <jadahl at gmail.com> wrote:
> > @@ -1485,27 +1500,28 @@ WL_EXPORT int
> >  wl_display_dispatch_queue(struct wl_display *display,
> >                           struct wl_event_queue *queue)
> >  {
> > -       struct pollfd pfd[2];
> >         int ret;
> >
> >         if (wl_display_prepare_read_queue(display, queue) == -1)
> >                 return wl_display_dispatch_queue_pending(display, queue);
> >
> > +       do {
> > +               if (wl_display_poll(display, POLLOUT) == -1) {
> > +                       wl_display_cancel_read(display);
> > +                       return -1;
> > +               }
> > +
> > +               ret = wl_display_flush(display);
> > +       } while (ret == -1 && errno == EAGAIN);
> 
> Hm, this now unconditionally incurs an extra syscall for the poll.
> Could you please flip those so we try to flush first and then only
> poll if we couldn't complete the flush, avoiding the extra poll for
> the common case of the output buffer not being full?

Sure. Would the performance loss of the extra syscall be measurable you
think or is it just for the sake of having one less syscall?


Jonas

> 
> Cheers,
> Daniel


More information about the wayland-devel mailing list