It really doesn't make sense to expect an integer here as memcmp() and
friends use an integer, too, but in reversed logic. So use bool to avoid
confusion.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This adds a new drop-in replacement for the glib hashtable implementation.
The hash table can be found at github: github.com/rustyrussel/ccan
It's licensed under the terms of the LGPL and perfect for our
implementation. Please see COPYING for license information.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
If systemd is not used for multi-seat support, we simply fake-add seat
"seat0" and avoid looking for the "seat" tag. However, if devices still
use ID_SEAT, we still parse it but all other devices are taken for seat0
by default.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The previous fix incorrectly registered new signals always to the last
found signal which is definitely incorrect. Therefore, we now correctly
traverse the list and register new signals as new signals.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We need to return "true", not "false" if a mode is unknown. Otherwise, we
will block the VT subsystem.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
When building without DRM we should correctly clear the GBM and EGL flags.
Otherwise, we will be linking them either way.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Gcc warns about an uninitialized variable (which technically is correct).
However, there is really no way this can really happen. But to make gcc
happy (and to enhance code readability) we now depend on !sig whether the
list-search was successful.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Instead of defining them to nothing we now produce real code which
evaluates to "void", though. This allows us to use the macros whereever an
rvalue can be used.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We initialize the variable to "true" to silence gcc warnings that we might
get an uninitialized variable (which we really cannot get here).
Anyway, in the future, if the number of types may increase, the correct
way to deal with unknown types is returning "true" so do this by default
now.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The 'M' CSI mode is used to delete lines. This implements this mode
similar to the "INSERT LINES" CSI.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The IL CSI ('L') is used to insert a given number of lines at the current
cursor position. All lines below are moved down.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This removes the mode where we compiled uterm with OpenGL instead of
OpenGLES2 (it was broken anyway) and makes it fully optional now.
gl_shader.h is no longer compiled if OpenGL is not available and provides
dummy helpers instead.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This helps us moving opengl dependencies into a single source file so we
can easily disable it.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
If the uterm video object fails to initialize the DRM device, then we try
again with the dumb device. Only if both devices fail, we drop the device
and continue.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Nearly all drm drivers provide a GEM/TTM buffer backend called "dumb
buffers". These buffers can simply be mmap'ped like fbdev device so 2D
acceleration is available. This patch adds a backend to uterm-video that
uses these buffers. It is quite similar to the drm backend but removes all
the egl/gl/gles2 dependencies.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Remove all obsolete code and make it more readable. Nearly all features
can now be configured. However, the code doesn't work correctly if udev or
systemd is removed. That will be fixed soon, though.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Move all systemd dependencies into local helper functions so we can easily
make them optional.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
All udev-dependencies are now moved into uterm-monitor. This allows us to
easily make udev optional for hotplug-less systems or emergency setups.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The uterm code was created to allow other applications to easily build new
user-space terminals for linux machines. Therefore, put it into a separate
library and install the header files correctly.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We use the eloop code in several other projects so move it into a shared
library to allow code-sharing.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This is the correct order, as specified in xkb_state_update_key header
comment.
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Support for this was added upstream, we can use it now. This mostly
means that modifiers won't repeat anymore.
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Support for this was added upstream, so we should avoid keeping the
entire conversion table twice in (readonly) memory. The old files are
still used by the dumb backend.
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Move all external sources into this library so we can use them everyone
but also be sure that we can link them statically. We will need this
guarantee later when adding LGPL stuff to libkmscon-static.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
It still used the old name. So convert it to use the more general name as
we are building all documentation into one global document.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We now build all small helpers into a separate small library that can be
linked statically into all our others. That is, we don't need to keep
backwards compatibility or anything inside this library.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Small stuff that is not worth putting into a separate library is no moved
into the "static" library which is statically linked into all our
subsystems.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We often need to return the same message over and over again with the same
return value. Use default log-messages now instead of ignoring the log.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Sometimes, the parent object might not be available so we need to pass in
the log-object directly. Use "d" as prefix for those functions and add
variants for the most oftenly used functions.
If you need more direct variants, add them when you introduce the first
user.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
When creating a new eloop object, we now require an lloop function so we
can perform conditional logging.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Libraries must never log unconditionally. Otherwise, applications are
unable to disable logging and can get confused. This header contains
helpers to implement conditional logging on context objects inside of
libraries.
It is compatible to the log interface in kmscon apart from the runtime
configuration.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The kernel defines 8 severities. Lets be compatible to these numbers so
our API will not have to be changes in the future.
This also causes LOG_ALERT to be added. It is not used, yet, but may be in
the future.
We also change the parameter type of severities to "unsigned int". Enum
variables can change types if new enums are added. We don't want that so
use a fixed type.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We reset all modes but forget to set them on the console object, too. The
AUTO_WRAP mode is the only mode that matters here, so we can ignore the
other modes.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We force EGL_DISPLAY to drm now. Otherwise, we might cause segfaults if
the EGL library tries to use the X11 egl-backend.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The new --fbdev option allows runtime switching between the two backends.
That is, we only use fbdev devices when --fbdev is given. Otherwise, DRM
is used.
Technically, it would also be possible to use both. However, almost every
DRM device does also register an fbdev device for backwards compatibility.
Therefore, we must avoid using both, the DRM and fbdev device of the same
display at the same time. As this would also mean dealing with failures in
one backend and then switching to the other, we avoid this for complexity
reasons. Who needs fbdev and drm simultaneously, anyway?
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The drm video backend does automatically blit the framebuffer on wake-up,
however, the fbdev backend does not. Hence, we automatically redraw on
wake-up in the terminal backend now.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We now enumerate displays on wake-up so we might end up adding a display
twice. This causes the display to be redrawn twice which is nasty so we
avoid it.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Other registered callbacks might get confused if we change the parameters.
Hence, we use a static copy for further actions.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
If OpenGL is not supported, we now allow 2D blitting into the video
framebuffer as alternative to shaders.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
If OpenGL is not supported, we should _not_ return 0. Otherwise, there is
not convenient way to detect this scenario.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We might have missed a display when our handler was not registered, yet.
So enumerate these displays on wakeup so we can be sure that we have all
displays registered with the terminal subsystem.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We currently try activating the OpenGL context when adding a video device
to a seat. However, not all video backends provide OpenGL contexts so
remove this restriction. The terminal subsystem does all this by itself
now.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>