1166 Commits

Author SHA1 Message Date
David Herrmann
7b83d77463 seat: remove "manual input" logic
This really doesn't make sense. We no longer want the applications to be
in charge of VT switches so always force the VT-master to be in control of
the VT-switching logic.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-19 16:07:34 +01:00
David Herrmann
890e34556b seat: allow scheduling dummy session
We always considered the dummy session to be no real session. However,
under special circumstances it might be desirable to schedule the dummy
session (very important for debugging). Therefore, change the logic to
allow scheduling the dummy session.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-19 16:03:57 +01:00
David Herrmann
71e497277d uterm: vt: fix input-device sleep-control
We need to correctly put input devices asleep only if we really disable
the VT. If our callbacks fail and prevent the VT-switch, we must keep the
input devices awake. Otherwise, we will lose control over the
sleep-states.

Also correctly put the device asleep during shutdown.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-19 15:57:35 +01:00
David Herrmann
f460764f9e shl: array: use "const" for source arguments
Use "const" even for void pointers as gcc will complain otherwise. Source
arguments are read-only, anyway, so this doesn't break anything.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-19 13:54:17 +01:00
David Herrmann
ffd431babe seat: be more verbose on asynchronous session switching
Print debug messages when doing asynchronous session switches and handle
EINPROGRESS as special error code.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-19 13:18:53 +01:00
David Herrmann
d7660329e9 seat: fix delayed VT switches
If we switch VT and the current session cannot be put asleep, and later it
notifies us that it went asleep, we should then switch VT and not
reschedule the sessions.

We do this by remembering whether a VT switch is pending. The new
uterm-retry infrastructure allows us to easily repeat VT switches then.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-19 13:13:01 +01:00
David Herrmann
caf4178803 seat: fix calling parent-callbacks on forced sleeping
If we force a seat to go asleep, we should _always_ notify the parent
about this. Otherwise, we might get unexpected results.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-19 13:12:10 +01:00
David Herrmann
080ecfd637 seat: allow sessions to switch between background/foreground
Two new helpers allow sessions to mark them as background and foreground
sessions. This will immediately switch them into the new state.

The internal infrastructure was already available, but we currently always
used foreground sessions.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-19 13:10:51 +01:00
David Herrmann
275692ee70 seat: allow sessions to control VT-switches
A new helper allows sessions to manually handly input events so the core
does no longer perform session/VT switches on their behalf.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-19 13:07:36 +01:00
David Herrmann
6da6e2319a uterm: vt: implement delayed VT-switches
If we cannot immediately perform a VT switch away from our application, we
might want to retry this shortly after. Therefore, we can now call
uterm_vt_retry() which then performs any outstanding VT-switches.

To avoid unexpected behavior, we limit this to a 2-3 second delay.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-19 13:04:15 +01:00
David Herrmann
06eb8d71a7 uterm: vt: do nothing if VT-switch targets our VT
If the user presses some keys to switch VTs and the target VT is our VT
(which is already active in this case), we shouldn't do anything. Calling
VT_ACTIVATE doesn't particularly hurt, but it doesn't get us anything
here so skip it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-19 13:01:57 +01:00
David Herrmann
e1687d5931 uterm: vt: do nothing if target-VT is already active during deactivation
If we deactivate our VT and the target-VT is already active (probably
because we opened the _current_ VT during uterm-vt creation), we shouldn't
do anything but simply close the VT.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-19 13:00:38 +01:00
David Herrmann
75435623e1 seat: fix forwarding errors in seat_pause()
If we force a pause we need to forward the error code. Otherwise, we
cannot properly react on it and print warnings.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-17 20:25:29 +01:00
David Herrmann
527a73120b seat: allow calling go_foreground if already in foreground
If we are asleep and in foreground, go_foreground() should return success
so we can safely unload asynchronous sessions. Otherwise, we wouldn't be
able to handle them properly while being inactive or we would need a whole
bunch of other checks.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-17 20:13:27 +01:00
David Herrmann
c7707560de uterm: vt: do not check SIGUSR1/2 for SI_KERNEL
If we want to run as client under user-space fake-VT implementations like
kmscon-cdev, we need to be able to catch those signals from
userspace-daemons. Therefore, do not check whether the signals were
generated by the kernel.

This doesn't affect security in any way as non-priviledged processes
aren't allowed to send signals, anyway. Moreover, this increases
debugability of VT layers a lot as we can fake these signals now.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-17 19:45:44 +01:00
David Herrmann
0799a4e1fb build: fix wlterm wayland-dependency check
The logic behind this two-layer check is bogus and doesn't work. Merge
both layers so we have a proper dependency-check again. This will make the
error messages less verbose but at least it works again.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-17 19:42:57 +01:00
David Herrmann
64eccac61f seat: remove bogus debug statements
These shouldn't be pushed into the public repository. Sorry.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-11 12:18:00 +01:00
David Herrmann
70cdfa0313 test_vt: add --switchvt option
This has the same effect as for kmscon but is disabled by default.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-11 11:39:38 +01:00
David Herrmann
7eae29e5cb test_vt: add --vt=<path> option
This new option allows specifying a path to the VT that should be used.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-11 11:37:17 +01:00
David Herrmann
6818fe2d32 test_vt: remove trailing newline in log-message
The log-subsystem adds these automatically so we shouldn't use them.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-11 11:36:38 +01:00
David Herrmann
1f87ee4bff test_vt: use a dummy input-object
We cannot allocate VT objects without an associated input object.
Therefore, allocate a dummy device with no input devices assigned to it
and use it for the test-vt object.

Note that this makes switching from/to this VT via command-line
impossible.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-11 11:35:15 +01:00
David Herrmann
b27b3a9a16 uterm: vt: fix not overwriting 'ret' in error paths
We cannot use 'ret' in error paths, otherwise, we might return 0. This
might then cause instabilities as the objects weren't initialized
correctly.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-11 11:33:19 +01:00
David Herrmann
f96870fe90 uterm: vt: do not modify TTY settings
We do not use the TTY for anything except VT functions. Hence, there is no
need to modify the TTY settings before using it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-10 18:11:16 +01:00
David Herrmann
d74a71f70b seat: allow sessions to notify seat when deactivating
If a session is deactivated asynchronously, it can now notify the seat
when it is done. This will then cause a re-schedule of the session list.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-10 16:57:04 +01:00
David Herrmann
4d65024ab5 seat: implement delayed session switching
If we want to allow external programs to control sessions inside of
kmscon, we need to give them some time for session
activation/deactivation. Therefore, the whole session-management is
asynchronous now and allows the session code to return EINPROGRESS or
similar if they need more time.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-10 16:46:58 +01:00
David Herrmann
2fe1d7b0fe shl: dlist: fix *_but_one() loops to allow "start == head"
If we iterate over a non-empty list and pass the same pointer for start
and head, then we will never leave that loop.

It might be unclear why this is supported at all as we can simply use the
shl_dlist_for_each() for that. However, it makes code a lot easier to read
if the user can simply use shl_dlist_for_each_but_one() without checking
whether they passed the same for start and head.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-10 16:42:42 +01:00
David Herrmann
f9e2818b9a text: gltex: use bold fonts
Make the gltex renderer use bold fonts for bold characters. Internally, we
use a separate hashtable to cache all glyph information. As the hash-key
is the unicode ID, we have to use a separate table for bold glyphs. This
doesn't affect performance, though.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-08 14:16:28 +01:00
David Herrmann
7416af5fd9 text: bblit: use bold fonts
This makes the bblit renderer use bold fonts for bold characters.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-08 13:59:10 +01:00
David Herrmann
3ff0992218 text: bbulk: implement bold-char renderer
Instead of always using the regular font, we now use the bold font for
bold characters.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-08 13:56:09 +01:00
David Herrmann
da58968095 terminal: allocate bold fonts
This makes the terminal layer allocate bold fonts (and use normal fonts as
fallback) and pass it to the text layer. This allows the text layer to
actually draw bold characters.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-08 13:55:04 +01:00
David Herrmann
4368500596 text: add bold font as separate font object
We now allow the user to specify the font that is used for bold
characters. If NULL is given, the normal font is used.

The bold font is not used by any renderer backend, yet, but will be hooked
up later.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-08 13:40:37 +01:00
Matthew Monaco
d4a1f69fe3 Add kmscon@.service
This almost certainly can be optimized, but we should be able to mask
getty@.service with kmscon@.service.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-05 17:36:57 +01:00
Ran Benita
75f59c54ba uterm: input: uxkb: properly handle changed keyboard state on wake up
Fix the problems caused by the keyboard state getting out-of-sync with
the xkb_state while the device is asleep (instead of the current hack).
The problem is described in a comment and in the removed FIXME.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-05 15:00:41 +01:00
Ran Benita
a6b3ae861c uterm: input: don't test device capability in wakeup_dev
The current code ignores non-keyboard devices, and various places
implicitly assume that it does. If we ever need finer granularity, we
should review (and probably restructure) the code for that; but for now
this test seems out of place.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-05 14:56:25 +01:00
David Herrmann
a9b12b22ac uterm: vt: avoid blocking SIGUSR1/2 twice
eloop does already block signals that we register callbacks for so we do
not have to block it manually here.
Note that the signal-handlers are registered _before_ doing the backend
initialization so we also avoid the previously fixed race-condition.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-05 14:52:25 +01:00
David Herrmann
614fe3dc81 uterm: vt: keep graphics mode during VT switch
If we open a VT, we assume that we are the only user on it. Therefore, we
put it into graphics mode _once_ and keep it this way. Resetting it to
text mode is useless, as there is no other user and every VT has its own
modes.

This also fixes page-flip issues during VT-switches which caused the
text-mode fbdev layer to claim one vertical-sync for their own page-flip
only for us to override it immediately after it is done.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-05 14:47:38 +01:00
David Herrmann
8e837167c5 uterm: vt: add fake_open/close() helpers
Instead of doing the backend initialization directly in uterm_vt code, we
now use fake_* helpers similar to real_* helpers.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-05 14:45:22 +01:00
David Herrmann
e7c8e7b531 uterm: vt: allow VT-deactivation to fail
If we dispatch VT-deactivation to child-processes, we might allow them to
abort the VT-switch, so the upper layer (uterm_vt) must also allow us to
abort the VT-switch.
During shutdown, we need to force the deactivation to guarantee that a VT
is inactive during shutdown.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-05 14:18:41 +01:00
David Herrmann
68af064040 seat: clean up session-callback function type
We use structures to pass information in all callbacks so we always get 3
arguments: parent, parameters, data
Also change the return type to int so we can catch errors when changing
session stati.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-02 18:25:49 +01:00
David Herrmann
f448fdb3f8 cdev: implement KDSKBMODE/KDGKBMODE ioctls
These ioctls change/retrieve the keyboard mode. We only support K_UNICODE,
K_RAW and K_OFF. Even K_RAW isn't supported fully as it is unclear what it
is supposed to do.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-29 21:08:15 +01:00
David Herrmann
9573302e26 cdev: implement KDSETMODE/KDGETMODE ioctl stubs
These ioctls are used to change from TEXT to GRAPHICS mode. We currently
do not support GRAPHICS mode correctly, but this will be added later.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-29 21:02:57 +01:00
David Herrmann
dd2fea4f96 cdev: implement basic ioctl() stubs
This commit adds stubs for every ioctl() that we need to support so an
xserver can run on this fake VT.
There are a lot more ioctl()s that can be invoked on TTYs and VTs, but we
currently do not intend to support these. If there is an application that
uses these and it makes sense to run it under kmscon, we will add the
needed ioctls.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-29 20:35:36 +01:00
David Herrmann
b626a85206 shl: ring: add shl_ring_flush() helper
This helper flushes all messages from the ring buffer and releases the
memory.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-29 20:34:52 +01:00
David Herrmann
9cc9008866 build: fix typo in configure.ac regarding cdev-sessions
A missing "test" keyword causes bash to fail executing this statement. Fix
this.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-29 20:34:03 +01:00
David Herrmann
61f4a3c29b kmscon: enable --all-gpus by default
Users with multiple GPUs that cannot be used simultaneously should pass
--no-all-gpus if they encounter problems or use --video-devices
explicitly. However, we cannot rely on PRIMARY flags being set for all
kinds of setups. Instead, default behavior should be using all available
GPUs unconditionally (except the safe DRM_BACKED and fbdev PRIMARY logic).

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-29 18:29:52 +01:00
David Herrmann
22e73357ff uterm: monitor: put systemd-layer into separate file
This moves all systemd code into uterm_systemd.[ch]. This removes all the
ugly #ifdef's.

Furthermore, this fixes some hidden bugs in the previous implementation
and makes use of sd_booted() to see whether runtime systemd is really
available.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-29 18:09:35 +01:00
David Herrmann
c827720f48 uterm: vt: fix real VTs when opening the currently active VT
We always assumed that the currently active VT is never the VT we open.
However, this is not true so schedule a VT-activation if this happens.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-28 17:38:28 +01:00
David Herrmann
0eb8d17590 uterm: drm: fix device-detection if no master is active
If we try to detect a device name if no master is active, the
drmGetBusid() call will always return an empty string. Therefore, try to
become drm-master and set the correct interface version before doing this.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-28 17:37:18 +01:00
David Herrmann
150f976b64 uterm: vt: put input devices asleep when inactive
There is no need to keep the input-devices around while another VT is
active.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-28 16:56:50 +01:00
David Herrmann
9fb08904a9 uterm: input: fix stopping key-repeat when going asleep
We need to stop each key-repeat when putting input-devices to sleep.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-28 16:54:07 +01:00