[PATCH wayland v2 5/8] client: Fully flush during blocking dispatch
Daniel Stone
daniel at fooishbar.org
Fri Jan 1 08:55:44 PST 2016
Hi,
On 29 December 2015 at 14:24, Jonas Ådahl <jadahl at gmail.com> wrote:
> On Tue, Dec 29, 2015 at 11:07:55AM +0000, Daniel Stone wrote:
>> 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?
Hmm, it should only really be measurable in pathological cases, but
seems like a good thing to do regardless. (And makes reading strace
output a little bit easier ...)
Cheers,
Daniel
More information about the wayland-devel
mailing list