pty: improve application data read-path

The kernel tty buffer is actually too small to buffer data for 20ms, which
is the time a frame may take in kmscon so we can still get 50 fps.
However, profiling showed that we often read multiple times from the pty.
We can optimize this by increasing the buffer to match the tty internal
buffer.

The kernel internal buffering is currently the only performance slowdown
that we have. That is, the data an application writes while we do a single
rendering is more than the kernel can buffer. Therefore, the application
waits until we read from the pty again. We then wait with redrawing until
the next vblank.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
David Herrmann 2012-08-31 20:19:55 +02:00
parent 3386aa955b
commit 69bde6077e

View File

@ -43,8 +43,7 @@
#define LOG_SUBSYSTEM "pty"
/* Match N_TTY_BUF_SIZE from the kernel to read as much as we can. */
#define KMSCON_NREAD 4096
#define KMSCON_NREAD 16384
struct kmscon_pty {
unsigned long ref;
@ -324,7 +323,10 @@ static void pty_input(struct ev_fd *fd, int mask, void *data)
log_err("cannot read from pty: %m");
goto err;
}
} while (len > 0 && --num);
} while (--num && len > 0);
if (!num)
log_debug("cannot read application data fast enough");
}
return;