Define LOG_ENABLE_DEBUG if we enabled debugging. The log subsystem uses
this to enable the log_debug() statements.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Inside a screen object we are independent of the lifetime of the displays
so we need to correctly keep references to them.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The GL subsystem is copied from the old output_context subsystem and now
provides shader and GL-math. It will replace the old output_context subs
soon.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We use GLES2 for drawing. There is currently no reason to provide full GL
inside kmscon as we use the basic operations only.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The fbdev backend is non-functional, but we add it for documentational
purposes. It is not built as part of kmscon.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
uterm_video can work with any backend so we need a DRM backend to get the
same functionality as our previous compositor/output API.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Our old backend was hacked together and hadn't have any structure. This is
a new approach to create the uterm-library inside kmscon. The
uterm-library will contain everything that is needed to run an application
on Linux DRM devices without X11 or Wayland support.
The idea is to move the input subsystem to uterm, too. No other stuff is
currently planned to be included in uterm.
Although uterm is supposed to be a separate library, we do not build it as
such library. We currently include the log-subsystem and the
eloop-handlers in the library so we cannot build it as stand-alone
library. However, we try to keep it separate so if we ever need to export
it, then it should be a one-hour job to do it so.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The new logger is much more powerful, allows online log-filter
modifications and precise debugging. We still avoid heavy file-operations
as we rely on the caller to forward stderr to a log-file and perform
log-rotations. However, we now provide a simple way to perform this
forward inside the application.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Add probing for LEDs in the input devices, and move the ioctl for the
LEDs state from the keyboard backends to the input subsystem itself
(thus not exposing the device's file descriptor unnecessarily).
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit discards the simplistic udev check for the ID_KEYBOARD
property in favor of a more direct "feature" probing. This is done for
the following reasons:
- We will need to use input devices which are not necessarily keyboards,
for example the PC speaker to sound the bell.
- To differentiate between keyboard with certain capabilities, such as
LEDs (indicators). We can then perform actions on devices according to
their feature bits.
- We check directly for what we need, i.e. the ability to send/receive
certain evdev events, without relying on logic in udev. This also
reduces our dependency on udev if we ever want to make it optional.
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
config.h is meant to be around in all files, as it contains stuff like
_GNU_SOURCE, NDEBUG and HAVE_*.
Make these definitions available without needing to #include config.h
every single time.
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Add 2012 to copyright and remove University of Tuebingen from new files as
copyright holder. It will still remain in the old files, though.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Many 8bit C1 codes have 7bit escape sequences as equivalents. This adds handlers
for all of them with comments what they are supposed to do. They are dummies for
now but they will be implemented later.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Add handlers for C1 codes with a description what they are supposed to do. They
are not yet implemented and are no-ops.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This is now a fully vt500-series compliant state machine that parses escape
sequences. See vt100.net/emu for information on this state-machine. This is
written from scratch, though.
It now handles all kind of escape sequences that we every want to support. It
correctly ignores all unsupported ones right now.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The xserver currently crashes if we switch to its VT and it cannot claim
drm-master. This normally does not happen as we drop drm-master on
VT-leave. However, after calling open() on the drm char-dev we are
automatically drm-master so we should drop it right away as our VT is
not guaranteed to be opened at this time.
There is currently no way to call open() on the drm char-dev without
getting drm-master so there is still a short time-period when we have no
active VT but are drm-master. Switching to X in this short time-period
will still kill the X-server but we are not responsible for horrible
X-server bugs so we ignore this 10ms time-span.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Print the CSI command in debug messages so we can better understand what
escape commands were sent.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Add new helper to console subsystem which performs a backspace
operation. We must take care of auto-wrap mode so we cannot simply use
the *_move_left() function.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The A, B, C and D CSIs are used to move the cursor in the scroll-region
without scrolling the buffer when reaching the margins.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This adds support for line-feed and carriage-return controls. The two
special line-feed controls which are not \n do not take care NL-mode so
they must be handled separately.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
When erasing from the cursor position to line/screen end we must include
the current cursor position in the clear-region. We already did this but
missed the fact that there might be a pending-wrap so we might miss the
current position. Fix this.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We must erase the whole screen and not only until the current cursor
position. Probably a copy-paste typo.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Add functions to move the cursor up/down/left/right. We must take care
of integer overflows here as the application may send us arbitrarily big
numbers.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
If auto-wrap mode is enabled we automatically advance the cursor to the
next line if we hit the end of line. Otherwise, we simply continue
overwriting the last character in the line.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
*_move_to() can be used to position the pointer at an arbitrary position
inside the buffer. If in relative-addressing mode, you cannot position
it outside the scroll-region, though.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Keep reference to top-most and bottom-most line of scroll buffer in
console wrapper. The margin_top and margin_bottom indexes are different
from them used in the buffer handler! We use indexes now instead of line
counts. This makes the handling much easier.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This function is no longer needed as we now have proper scrolling
functions. This also adjusts the buffer tests to be more appropriate.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
When resizing the scroll buffer to a bigger size we try to get lines
from the scroll-back buffer into our current buffer. However, we do not
know how many lines we can get so we start filling the bottom of the
buffer and when no more lines are available, we simply move these lines
to the top of the buffer.
However, we didn't clear the bottom of the buffer after that operation
so if the scroll-back buffer is too small to get us enough lines for
resizing, we currently have a corrupted buffer-bottom. This fixes this
bug by simply setting those lines to NULL as anyone would expect.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Add two new functions to rotate the scroll-area of the buffer. We push
lines to the scroll-back buffer if they are pushed out to the top. Lines
pushed out to the bottom are simply freed.
We never take back lines from the scrollback buffer as applications
expect the new lines to be empty.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Allow external subsystems to modify the margin sizes. When setting the
margins we must take care to first perform the shrink operation and then
the grow operations. For instance, if our current top margin is 10 and
the bottom margin is 0 and the application requests to swap the margin
sizes, we should *first* shrink the top margin to 0 and then grow the
bottom margin to 10. Otherwise, we might end up with garbled margins on
a buffer which is smaller than 20 lines.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Margins are a method to stick lines to the top and bottom of a buffer
and ignore them during console-rotations. We keep 3 different buffers,
two static buffers for the top and bottom margin and one buffer for the
scroll region. The scroll region is always big enough to hold all three
buffers even though it does not contain them. This allows us to merge
the margins back to the scroll-buffer very fast without reallocations.
The buffer layout is the top-margin at the top. The scroll region is
below and the bottom margin is at the bottom. If we rotate the buffer,
we do not touch the margins but simply rotate the scroll buffer. This
may corrupt the scroll-back buffer but there is no sane way to implement
this. The original VTs did not support this either.
Even though we have multiple buffers we keep the buffer-fill logic. That
is, the scroll buffer is not always fully filled. However, if we merge
back the bottom buffer to the scroll buffer, we set the scroll buffer to
be fully filled. Otherwise, we would have artifacts at the bottom.
The top margin does not show this behavior as it is not affected by
rotations below the fill-line.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The main buffer of the console buffer is now renamed to scroll-buffer.
This allows us to add other buffers like a margin-buffer to the same
buffer object.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>