754 Commits

Author SHA1 Message Date
David Herrmann
7ad970c1f4 build: add build-time check for gbm_bo_get_stride()
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>
2012-08-21 14:38:30 +02:00
David Herrmann
585879281f gl: add gl_err_to_str() helper
This helper converts an GL error into a string for easier debugging.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-20 20:10:29 +02:00
David Herrmann
5dfc12ee6a uterm: vt: fix resetting access control on VT-close
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>
2012-08-20 14:57:39 +02:00
David Herrmann
06d33f6636 uterm: vt: add fake VT via user-input
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>
2012-08-15 09:27:11 +02:00
David Herrmann
7ad2044077 console: suppress multiple warnings
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>
2012-08-15 09:25:55 +02:00
David Herrmann
40ef6f9491 terminal: add wake-up/sleep logic
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>
2012-08-15 09:24:45 +02:00
David Herrmann
2ba0cc5ec2 main: correctly wake up UI subsystem
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>
2012-08-15 09:23:24 +02:00
David Herrmann
dbb589c55b ui: add sleep/awake logic to UI
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>
2012-08-15 08:54:02 +02:00
David Herrmann
d372390734 uterm: input: make sleep-state recursive
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>
2012-08-14 22:57:36 +02:00
David Herrmann
5aade75f3d uterm: uxkb: fix correctly resetting input state
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>
2012-08-14 22:47:34 +02:00
David Herrmann
b697fcd43c terminal: implement basic scrolling-keys
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>
2012-08-14 17:09:42 +02:00
David Herrmann
5a24d624ae terminal: add --sb-size to control scrollback buffer size
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>
2012-08-14 17:08:55 +02:00
David Herrmann
4f57e7b3d2 console: provide scrollback-buffer helpers
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>
2012-08-14 17:02:56 +02:00
David Herrmann
681c9acb4c vte: return status in kmscon_vte_handle_keyboard()
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>
2012-08-14 17:01:55 +02:00
David Herrmann
4f7188337e main: add --dumb option to control uterm devices
The --dumb option disables hardware-accelerated rendering and instead uses
the dumb-DRM devices.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-14 16:34:28 +02:00
David Herrmann
4a034895c8 main: add font options
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>
2012-08-14 16:29:55 +02:00
David Herrmann
572bc3e195 conf: add UINT as new datatype
The "uint" type parses an unsigned integer as argument.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-14 16:23:03 +02:00
David Herrmann
88a2fa1e63 uterm: input: do not include main.h
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>
2012-08-14 16:22:15 +02:00
David Herrmann
227ada42a2 vte: add --palette=XY to choose color palette
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>
2012-08-14 16:08:30 +02:00
David Herrmann
feb29d857c vte: add COLOR_FOREGROUND/BACKGROUND to palette
Instead of hard-coding these values we simply put them into the palette.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-14 15:52:26 +02:00
David Herrmann
d74c94360b vte: make color-palette configurable
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>
2012-08-14 15:47:13 +02:00
David Herrmann
cb178cdc4e console: add function to set default-attribute
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>
2012-08-14 15:44:55 +02:00
David Herrmann
47b1aa3bb9 console: remove kmscon_console_set_bg()
This function is no longer needed so we can safely remove it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-14 15:11:19 +02:00
David Herrmann
e1c591a3ef fakevt: add fakevt helper for VT-less systems
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>
2012-08-12 13:35:18 +02:00
David Herrmann
9bce87d564 uterm: vt: fix checking for /dev/tty0 instead of /dev/tty
/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>
2012-08-12 13:31:19 +02:00
David Herrmann
2841558f7c test_output: add --dev parameter
The --dev parameter is used to specify the device that is used for
testing.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-12 13:30:51 +02:00
David Herrmann
d97fc0baf0 uterm: monitor: fix crash during device hotplug
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>
2012-08-12 13:26:16 +02:00
David Herrmann
f084da1852 uterm: vt: add fake-vt logic for debugging
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>
2012-08-12 11:18:48 +02:00
David Herrmann
4f3cd2eecd uterm: vt: ignore non-kernel signals in real-mode
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>
2012-08-12 10:21:11 +02:00
David Herrmann
4c1da1069d uterm: vt: mark vts as dead during deallocation
To avoid useless checks wether a vt is valid we simply mark it as dead and
centralize the checks in the API entry point.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-12 10:16:55 +02:00
David Herrmann
4029539cd1 uterm: vt: always register signal handlers
This register the SIGUSR1/2 signal handlers even though we are no real VT.
This is needed to implement other fake-VT helpers for systems were real
VTs are not available.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-12 10:11:50 +02:00
David Herrmann
58eb1e85b9 uterm: vt: rename real VTs internally to real_*
Instead of using the old kmscon_vt_* names we now prefix everything that
implements real linux VTs with real_*. An internal flag specifies which
mode the VT is in so we can check whether we are a real VT or a fake one.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-12 10:03:01 +02:00
David Herrmann
1f9867e786 uterm: vt: remove connect_eloop/disconnect_eloop functions
This removes both functions and merges them into the callers. They're
small enough to be directly included.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-12 09:40:49 +02:00
David Herrmann
8752fe33af uterm: vt: merge uterm_vt and kmscon_vt
There is no need to use separate structures so merge both into a unified
uterm_vt.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-12 09:37:58 +02:00
David Herrmann
358b6a4ed1 uterm: vt: remove obsolete kmscon_vt_id
We always open a new VT as there is no need for us to open an existing VT.
Hard-code this behavior but keep the open_tty() backend accepting
VT-numbers just in case we want this some time in the future.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-12 09:23:23 +02:00
David Herrmann
edae24f501 uterm: vt: remove duplicate kmscon_vt_action
This enum is not needed as the uterm-vt code already has enums for
vt-actions. Replace it with UTERM_VT_ACTIVATE/DEACTIVATE.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-12 09:19:36 +02:00
David Herrmann
1101a6b5c3 uterm: vt: move all vt.h/c code into uterm_vt.c
This merges both files so we can reduce the code overhead here. This is
still some very old code that was never correctly merged into new
uterm_vt.c subsystem. This should help doing it now.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-12 09:11:35 +02:00
David Herrmann
891400ad91 uterm: vt: move kmscon_vt_supported() to uterm-vt
Instead of having a global symbol, we simply move the check to uterm-vt
and can remove it from global namespace. Furthermore, we cache the result
so we can reuse it on the VT-master if required.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-12 09:04:54 +02:00
David Herrmann
31188d4c79 main: replace unused --seat argument with --seats
The old --seat argument was no implemented, so replace it with --seats
which accepts a list of seats where kmscon runs on. Each seat is separate
from the others but kmscon allows providing terminal services to multiple
users/seats in a single process sharing resources like fonts and
renderers.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-11 23:42:16 +02:00
David Herrmann
3d2165a4ba conf: add string-list type
The string-list type parses an argument as a list of strings separated
with commas. Empty arguments are accepted and correctly parsed.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-11 23:41:36 +02:00
David Herrmann
e20283217b tests: make all tests use the new conf-parsers
This allows the tests to have their own command-line parsers. Finally!

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-11 22:43:13 +02:00
David Herrmann
0377b96c1a main: add main.h header
Whoops, I missed this in the previous commits. damnit...

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-11 22:42:51 +02:00
David Herrmann
f4b4bc2ee4 uterm: input: pass xkb parameters from outside
Instead of accessing the kmscon configuration from the uterm code, we
should pass it in on creation. Otherwise, uterm depends on main.c which
would be really ugly.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-11 22:41:53 +02:00
David Herrmann
c9ccc70fcb main: move conf_global to kmscon_conf in new header main.h
The main configuration is now limited to kmscon and thus should not use
the conf_* prefix. Move all code to use the new name and introduce the new
main.h header mainly for kmscon.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-11 22:02:46 +02:00
David Herrmann
39be24697a conf: make config functions take conf-options as arguments
This replaces the global conf-options array with a parameter so we can use
the config parsers with different argument-lists.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-11 21:50:41 +02:00
David Herrmann
09e2c17336 conf: make important symbols global
In order to make the conf subsystem more open we need to make all
important symbols visible so others can include them.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-11 21:37:32 +02:00
David Herrmann
c52df82033 conf: add aftercheck logic
The aftercheck logic allows each argument to make adjustments after the
argument-list has been parsed. It is also used to consume remaining
arguments.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-11 21:32:15 +02:00
David Herrmann
ac6078445f conf: be more verbose about wrong arguments
We didn't handle the case that an argument has a parameter but doesn't
need one.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-11 21:11:41 +02:00
David Herrmann
28be382019 conf: make missing arguments or wrong arguments fatal
It is not acceptable to start the applications with wrong parameters. A
typo must be corrected before starting the application so simply fail
loudly on errors.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-11 21:00:03 +02:00
David Herrmann
5c13be3f1d conf: move CONF_HAS_ARG flag to config-types
Whether an option takes an argument or not is definitely a property of the
type and not of the option. Therefore, move the flag to the type structure
and remove it from the option structure.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-11 20:52:17 +02:00