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>
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>
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>
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>
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>
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>
The "static" library does not have any dependencies. To avoid compilation
errors, remove this inclusion.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
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>
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>
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>
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>
There were 3 problems with previous version:
- it didn't take into account libgbm cflags (fatal error: gbm.h: No such file or directory)
- it was vulnerable to gbm.h include bugs (gbm.h:259:50: error: unknown type name 'size_t')
- it was checked even when libgbm was not detected
Fix it.
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Defining *_la_CPPFLAGS var in "if...endif" block breaks generation
of Makefile.in - automake assumes it's defined unconditionally and
uses it for building objects.
configure.ac clears all variables if each dependency is disabled so we can
include it unconditionally.
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
These messages should have never been committed, oops. Remove them as they
are really not needed.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Mesa 8.1-devel/9.0-devel stopped exposing EGL_KHR_surfaceless_opengl because
it never actually existed and started exposing EGL_KHR_surfaceless_context.
Check that in addition to EGL_KHR_surfaceless_opengl.
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b50703aea55450e04bcd8154335774786e0f253b
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
CC src/static_gl_math.lo
In file included from src/static_gl_math.c:35:0:
src/static_gl.h:36:23: fatal error: GLES2/gl2.h: No such file or directory
CC src/static_gl_shader.lo
src/static_gl_shader.c:36:23: fatal error: GLES2/gl2.h: No such file or directory
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Instead of redrawing on change, we now use a framerate-timer which
redraws the screen. This timer stays active for 1s after the last redraw
so we do not enable/disable the timer while the console is under heavy
work-load. This still needs to be benchmarked but it seems to work nicely.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
If there is plenty data available, we should read all of it before
returning. Otherwise, we might spend too much time letting the other
subsystems perform actions. This can have the effect, that we render after
each read() on the pty if a redraw takes more time than a single frame.
This is definitely not what we want.
To avoid staying here too long we use a hard-coded maximum. Otherwise, if
the vte layer takes longer than the pty-end writes data to us, we might
stay here forever. This is very unlikely as the VTE layer as no immediate
side-effects that make long computations, but we use it to be on the safe
side.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
OpenGLESv2 doesn't support specifying stride values for textures without
this extension. So allocate a temporary storage when uploading values
which have a default-stride.
This was reported by "towolf / Tobias Wolf" on github:
https://github.com/dvdhrm/kmscon/issues/17
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Upstream mesa renamed gbm_bo_get_pitch() to gbm_bo_get_stride(). As gbm
has not seen an official release, they actually don't care but several
users complained about this. Therefore, we simply add a build-time check
for this. However, this may break when mesa is updated without recompiling
kmscon but that is less intrusive.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This is a weird fix. One would think that this is automatically reset when
calling close() on the fd but, suprise, it's not. So lets reset this
manually, otherwise when we close the VT but our application is still
active, the user will never be able to leave the VT again.
Again a hilarious example why the VT API sucks. Really... Get rid of it.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This actually incorporates the fakevt tool into kmscon. That is, if the
user presses ctrl+mod4+F12, we activate or deactivate the fake VT.
This is for debugging only and needs to be made more configurable. Use it
on your own risk.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
If a single rendering-round prints more than 3 warnings for
unrenderable-glyphs, we suppress these warnings. This is useful for
debugging rendering errors. As sometimes no glyph was renderable and this
caused >80x24 warnings.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Similar to the UI subsystem, we also need to be aware of our current state
inside of the terminal subsystem. We can now avoid rendering graphics when
not awake. This suppresses odd warnings that occured when keeping an
application active and printing in the terminal while the terminal was in
background.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We must wake up the UI system _after_ wakeing up everything else,
otherwise, they might assume everything else is already up.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We need to forward all sleep/awake states to the lower subsystems to avoid
overdoing stuff like rendering an user-input. That is, while being asleep
we shouldn't render and/or do any other user-interaction.
This patch simply adds this logic to the UI subsystem, which, however,
does not to anything useful, yet.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Instead of using a boolean state we now have an integer and a device needs
to be put asleep as often as it was woken up to be put asleep, and vice
versa.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We currently have a very subtle bug when modifiers are pressed while
leaving a terminal but released while entering. The internal state will
not be updated and as xkbcommon does not fix this up, we need to recreate
the state when re-entering the terminal.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This implements Shift+UP/DOWN and Shift+PageUp/PageDown as scrolling keys
for terminals. This will later be made configurable so other
keyboard-shortcuts can be used.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The new sb-size option specifies the size of the scrollback buffer. Use 0
to disable the scrollback-buffer.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
These helpers allow moving around in the scrollback-buffer. Scrolling
bigger portions of the screen is quite slowly as we have to traverse a
list. However, nothing compared to screen-rendering so we can ignore this.
But O(n) is always bad...
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We now return whether the key had any effect. This can be used by the
terminal handler to perform various actions on user-input.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The --dumb option disables hardware-accelerated rendering and instead uses
the dumb-DRM devices.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This adds two options --font-size and --font-name that can be used to
configure which font is used.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The uterm library does not need and must not depend on main.h. Remove the
unneeded inclusion.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This adds two more color-palettes and a mode to choose the used palette.
The "solarized" palettes are from an online project that tries to optimize
color palettes.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This adds a color-palette-pointer to VTE objects so each VTE object can
have a different palette. This allows runtime configuration of terminal
colors.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This new function allows other layers to control the default attribute of
a console. This attribute is used when clearing the screen or when
allocating new cells.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The fakevt helper binary can be used on VT-less systems or seats to make
kmscon activate the fake VT and deactivate it. This way, you can control
when kmscon acquires video devices and when it releases them.
This is a global setting that affects all seats where kmscon is running
except seat0 if it uses real VTs.
This should only be used for debugging. This is really no intended for use
in production.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
/dev/tty may be available even though CONFIG_VT is not set. Therefore,
check for /dev/tty0 instead which is guaranteed to be not available with
CONFIG_VT=n.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We must make sure that the returned value is non-NULL, otherwise we crash
during device-change events for non-DRM-Hotplug events.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This adds a very limited non-multi-seat-capable fake-VT logic. If you use
this in production it will break your multi-seat systems so do not use it
except for debugging.
On SIGUSR1 we activate fake VTs and on SIGUSR2 we deactivate them. The
signals must be sent from a priviledged process. Kernel signals are
ignored.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
If using real linux VTs, we must ignore all signals that are not sent from
the kernel. Otherwise, we might get problems if we reuse SIGUSR for other
functionality.
Note that we already check that we are the active VT before handling
SIGUSR. However, this hardens this check to be more sure that this is
really the signal we want.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>