docs: add unicode test document

This document contains several special Unicode characters which can be
used to test the terminal font-engine/UTF-8-engine.

Written-by: Theodore Kotz <ted@kotz.us>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
text: font: add unifont font description

The GNU Unifont project provides a bitmap font with a fixed 8x16/16x16
size. The source is encoded as simple hex-file.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
build: add temporary files *~ to gitignore

These files are created by several editors as temporary storage. Ignore
them.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
text: include errno.h in text.h

text.h uses -EOPNOTSUPP so we should include errno.h to avoid compilation
errors.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
text: font: unifont: add genunifont generator

This new generator converts the unifont hex-encoded data into a C-source
file which then can be compiled statically into the kmscon binary. Please
note that the resulting source file is bigger than 100MB and can take
quite a while to compile.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
text: font: add unifont backend

This adds a new Unifont font-backend based on the recently added Unifont
data. The backend is disabled by default for 2 reasons:
  - It takes about 5min to compile and needs >1GB of memory on an Intel
    Atom N450
  - License situation is unclear as it is GPL

Written-by: Ted Kotz <ted@kotz.us>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
gl: shader: do not include uterm.h

The "static" library does not have any dependencies. To avoid compilation
errors, remove this inclusion.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
main: add --render-engine option

This option allows changing the console renderer during runtime. This is
only useful for debugging. The default choice should be best for all
situations.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
build: add GLES2-libraries to kmscon-static

kmscon-static needs these to build properly. Currently, they are pulled in
via uterm but if it is used without uterm the build will fail.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
misc: add timer infrastructure

Timers can be used to measure time-delays with microsecond resolution.
This is heavily used for performance-tests and to improve rendering
performance.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
uterm: video: improve blitting performance

Turns out gcc didn't optimize this trivial math so we do it by hand. This
reduces the number of divisions per color to 1. This increases performance
by like 15%.

As a second optimization, we replace the division with a left shift, that
is, we divide by 256. Technically, this is wrong as we will get slightly
incorrect results. However, this is hardly noticible by human eye so we
can safely use it. This increases performance by like 20% again.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
test_vt: fix using correct uterm API

This still uses the old VT API which now fails as we added a new
parameter. As a side-effect, this test will not work if used on a VT-less
system or on a seat without VTs. But we actually don't care, yet, as any
other VT-replacement isn't really production-ready, yet.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
uterm: video: drm: fix running without gles2 stride support

Similar to the gltex renderer we need to work around the missing stride
support in plain gles2. Most drivers provide it but we cannot rely on it.
Therefore, we simply allocate a temporary buffer for it. This horribly
breaks performance, but the 2D blitting via DRM was never fast, anyway.
Don't use it except for testing and debugging.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
uterm: video: add vectorized blending

Vectorized blending allows pushing multiple blending-requests to the video
hardware at once. This can speed up rendering on 2D devices a lot.
However, the gl-rendering is really just for completeness and shouldn't be
used if performance matters.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
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>
docs: add some pixman-rendering comments

We didn't use pixman for rendering in kmscon. This documents shows some
code how we could do it but also explains why this would not improve
performance.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
uterm: video: greatly enhance performance by special casing

If we special-case the "src == 0" and "src == 0xff" cases, then we can
avoid all the heavy calculations most of the time. This reduces rendering
time by like 50%.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
text: add bbulk renderer

The bbulk renderer is very similar to the bblit renderer but it assembles
a request-buffer of all characters and then pushes these requests via a
vector-call to the video hardware.
This turns out to increase performance slightly as we do not call into the
video subsystem for every characters but only once.

This renderer can reduce performance when used with partial-redraws (which
are not implemented, yet), so we keep the bblit renderer around.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
console: free tab ruler on init-failure

When console initialization fails, we need to free the tab-ruler if it was
allocated.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
console: add --render-timing parameter

This parameter makes the console subsystem print rendering-performance
information to the debug log. This can be used to find rendering
bottlenecks and compare each render-engine.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>