259 Commits

Author SHA1 Message Date
David Herrmann
62a3db3e9c uterm_video: add dummy fbdev backend
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>
2012-03-23 11:46:39 +01:00
David Herrmann
95e434eddb uterm_video: add DRM backend
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>
2012-03-23 11:45:49 +01:00
David Herrmann
8e2af97038 uterm: new video backend
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>
2012-03-23 11:26:04 +01:00
David Herrmann
7eafca0e9f log: rewrite log subsystem
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>
2012-03-23 11:11:46 +01:00
David Herrmann
4790d9f7ab eloop: move prefix to "ev_" instead of "kmscon_"
The long "kmscon_" prefix is horrible so move everything to "ev_" now.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-20 19:08:29 +01:00
David Herrmann
e7e0744e6e eloop: rename from kmscon_ to ev_
We don't need the long kmscon_ prefix so make it shorter.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-20 19:01:28 +01:00
Ran Benita
7b7e8c950d vte: constify global tables
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-20 19:01:04 +01:00
Ran Benita
5811fee0da input: test for LED feature and use it
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>
2012-03-20 19:00:54 +01:00
Ran Benita
6b7265447e input: add features mechanism
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>
2012-03-20 19:00:45 +01:00
Ran Benita
d8cf293c94 build: implicitly include config.h
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>
2012-03-20 19:00:16 +01:00
David Herrmann
1c909c930c Fix copyright year
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>
2012-03-20 18:56:51 +01:00
David Herrmann
32cb165e40 vte: improve docs
Add parser-links to the docs and add summary comment to the vte.c source file.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-20 18:56:32 +01:00
David Herrmann
c343e6cef2 vte: add 8bit C1 7bit equivalents (dummy)
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>
2012-02-29 17:21:53 +01:00
David Herrmann
ea81381be5 vte: add 8-bit C1 code handlers (dummy)
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>
2012-02-29 17:11:25 +01:00
David Herrmann
44fdd29e6c vte: new state machine implementation
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>
2012-02-29 15:25:53 +01:00
David Herrmann
acc32351be kbd_xkb: use new xkbcommon version
The header file moved and the xkb_keycode_t type was introduced.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-27 17:49:15 +01:00
David Herrmann
2b066f173c output: drop drm-master on open() to avoid Xserver bugs
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>
2012-02-05 18:40:31 +01:00
David Herrmann
06286da4ef vte: extend CSI debug message
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>
2012-02-05 16:03:13 +01:00
David Herrmann
cdb3d112a6 vte: implement backspace control
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>
2012-02-05 16:02:21 +01:00
David Herrmann
5f0d151bb7 vte: implement basic cursor movement CSI
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>
2012-02-05 16:01:12 +01:00
David Herrmann
dcfbbc3e1d vte: implement CSI-J
The J CSI is used to erase parts of the screen.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-05 15:56:34 +01:00
David Herrmann
a5a357e012 vte: implement CSI-K
The K CSI is used to erase parts of the current line.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-05 15:52:34 +01:00
David Herrmann
9b058b1f90 vte: implement basic cursor-movement controls
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>
2012-02-05 15:51:10 +01:00
David Herrmann
7c8eb3b108 console: fix bug in buffer-erase helper
We didn't check for NULL line so we got segfaults when erasing empty
lines. Fix this.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-05 15:44:20 +01:00
David Herrmann
d3951da865 console: add helper to erase current position
This helper erases the current cursor position.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-05 15:14:45 +01:00
David Herrmann
b02e8c8332 console: fix pending-wrap bug in erase helpers
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>
2012-02-05 15:11:34 +01:00
David Herrmann
fb6dd53aa8 console: enable auto_wrap by default
vt100 have auto_wrap enabled by default so we should do so, too.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-05 15:10:12 +01:00
David Herrmann
9a5f1df8cd console: fix bug in *_erase_screen()
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>
2012-02-05 15:06:06 +01:00
David Herrmann
5e53cda8f5 console: fix bug in *_move_left()
We must take care of pending-wraps when moving left so we do not miss a
single character.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-05 15:04:43 +01:00
David Herrmann
f0bcc37cee console: add to line movement helpers
Add two helpers to move to the end or home of the current line.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-05 14:36:32 +01:00
David Herrmann
f85244ead9 console: add erase-helpers
Add functions to erase several parts of the screen.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-04 18:31:10 +01:00
Ran Benita
37cb482bbc ring: fix is_empty
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-04 16:30:24 +01:00
David Herrmann
138c0aa5ee console: add function to erase buffer
New function which helps erasing a whole region of the buffer.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-04 16:24:01 +01:00
David Herrmann
d8ff83c5cb console: add basic cursor movements
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>
2012-02-04 15:50:03 +01:00
David Herrmann
466fcc3b06 console: add auto-wrap mode
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>
2012-02-04 15:49:14 +01:00
David Herrmann
497d3840dc console: add *_move_to() function
*_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>
2012-02-04 15:25:44 +01:00
David Herrmann
5a0ba19d91 console: make console wrapper margin aware
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>
2012-02-04 14:49:06 +01:00
David Herrmann
2b8caca91c console: remove *_buffer_newline()
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>
2012-02-04 14:34:33 +01:00
David Herrmann
bff87253a8 console: fix bug in console resizing
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>
2012-02-04 14:32:09 +01:00
David Herrmann
0c7e50433a console: implement proper scrolling
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>
2012-02-03 23:47:09 +01:00
David Herrmann
ff408d6fb9 test_buffer: add margin tests
Modify the buffer test to add margin tests.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-03 18:43:56 +01:00
David Herrmann
b367a9682c console: add margin API
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>
2012-02-03 17:48:35 +01:00
David Herrmann
cd62b330be console: add margin support
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>
2012-02-03 17:47:46 +01:00
David Herrmann
c4a4e796e7 console: rename buffer to scroll-buffer
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>
2012-02-03 15:22:36 +01:00
David Herrmann
d06e28aa05 console: do not fill buffer if not required
We allow NULL lines in the buffer so we no longer have to create empty
lines when writing anywhere in the buffer.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-02 17:52:54 +01:00
David Herrmann
8ed50af667 console: allow NULL lines in buffer
If we see a NULL line inside the buffer we assume the line is empty.
That is, we now longer abort the drawing but continue with the next
line.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-02 17:44:54 +01:00
David Herrmann
ebef2a016b console: allow to push empty lines to scrollback buffer
When pushing a line=NULL to the scrollback buffer we now assume that the
line was empty and we allocate a new empty line. If the allocation fails
we simply drop that line.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-02 17:41:43 +01:00
David Herrmann
af3a1f3e50 console: move kmscon_console_rotate to *_newline
We do no rotation so rename the function to the more appropriate name
kmscon_console_newline.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-02 17:01:54 +01:00
David Herrmann
09e15d84e8 console: add function to clear scrollback buffer
The new function can be used by the UI to clear the current scrollback
buffer to free resources or whatever. It will also be used by the CSI
handler to reset the console.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-02 16:47:43 +01:00
David Herrmann
3560ae8eb1 console: add function to set max scrollback buffer size
The maximum scrollback-buffer size can now be changed on the fly. We
also reduce the current buffer size to the new size so we do not need to
clear the console to flush the scrollback buffer.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-02 16:43:15 +01:00