platform/upstream/kmscon.git
11 years agoseat: remove bogus debug statements
David Herrmann [Sun, 11 Nov 2012 11:17:11 +0000 (12:17 +0100)]
seat: remove bogus debug statements

These shouldn't be pushed into the public repository. Sorry.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotest_vt: add --switchvt option
David Herrmann [Sun, 11 Nov 2012 10:39:38 +0000 (11:39 +0100)]
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>
11 years agotest_vt: add --vt=<path> option
David Herrmann [Sun, 11 Nov 2012 10:37:17 +0000 (11:37 +0100)]
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>
11 years agotest_vt: remove trailing newline in log-message
David Herrmann [Sun, 11 Nov 2012 10:36:38 +0000 (11:36 +0100)]
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>
11 years agotest_vt: use a dummy input-object
David Herrmann [Sun, 11 Nov 2012 10:35:15 +0000 (11:35 +0100)]
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>
11 years agouterm: vt: fix not overwriting 'ret' in error paths
David Herrmann [Sun, 11 Nov 2012 10:33:19 +0000 (11:33 +0100)]
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>
11 years agouterm: vt: do not modify TTY settings
David Herrmann [Sat, 10 Nov 2012 17:11:16 +0000 (18:11 +0100)]
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>
11 years agoseat: allow sessions to notify seat when deactivating
David Herrmann [Sat, 10 Nov 2012 15:57:04 +0000 (16:57 +0100)]
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>
11 years agoseat: implement delayed session switching
David Herrmann [Sat, 10 Nov 2012 15:46:58 +0000 (16:46 +0100)]
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>
11 years agoshl: dlist: fix *_but_one() loops to allow "start == head"
David Herrmann [Sat, 10 Nov 2012 15:42:42 +0000 (16:42 +0100)]
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>
11 years agotext: gltex: use bold fonts
David Herrmann [Thu, 8 Nov 2012 13:16:28 +0000 (14:16 +0100)]
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>
11 years agotext: bblit: use bold fonts
David Herrmann [Thu, 8 Nov 2012 12:59:10 +0000 (13:59 +0100)]
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>
11 years agotext: bbulk: implement bold-char renderer
David Herrmann [Thu, 8 Nov 2012 12:56:09 +0000 (13:56 +0100)]
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>
11 years agoterminal: allocate bold fonts
David Herrmann [Thu, 8 Nov 2012 12:55:04 +0000 (13:55 +0100)]
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>
11 years agotext: add bold font as separate font object
David Herrmann [Thu, 8 Nov 2012 12:40:37 +0000 (13:40 +0100)]
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>
11 years agoAdd kmscon@.service
Matthew Monaco [Mon, 5 Nov 2012 04:30:42 +0000 (21:30 -0700)]
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>
11 years agouterm: input: uxkb: properly handle changed keyboard state on wake up
Ran Benita [Mon, 29 Oct 2012 19:52:54 +0000 (21:52 +0200)]
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>
11 years agouterm: input: don't test device capability in wakeup_dev
Ran Benita [Mon, 29 Oct 2012 20:00:16 +0000 (22:00 +0200)]
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>
11 years agouterm: vt: avoid blocking SIGUSR1/2 twice
David Herrmann [Mon, 5 Nov 2012 13:52:25 +0000 (14:52 +0100)]
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>
11 years agouterm: vt: keep graphics mode during VT switch
David Herrmann [Mon, 5 Nov 2012 13:47:38 +0000 (14:47 +0100)]
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>
11 years agouterm: vt: add fake_open/close() helpers
David Herrmann [Mon, 5 Nov 2012 13:45:22 +0000 (14:45 +0100)]
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>
11 years agouterm: vt: allow VT-deactivation to fail
David Herrmann [Mon, 5 Nov 2012 13:18:41 +0000 (14:18 +0100)]
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>
11 years agoseat: clean up session-callback function type
David Herrmann [Fri, 2 Nov 2012 17:25:49 +0000 (18:25 +0100)]
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>
11 years agocdev: implement KDSKBMODE/KDGKBMODE ioctls
David Herrmann [Mon, 29 Oct 2012 20:08:15 +0000 (21:08 +0100)]
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>
11 years agocdev: implement KDSETMODE/KDGETMODE ioctl stubs
David Herrmann [Mon, 29 Oct 2012 19:49:41 +0000 (20:49 +0100)]
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>
11 years agocdev: implement basic ioctl() stubs
David Herrmann [Mon, 29 Oct 2012 19:35:36 +0000 (20:35 +0100)]
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>
11 years agoshl: ring: add shl_ring_flush() helper
David Herrmann [Mon, 29 Oct 2012 19:34:52 +0000 (20:34 +0100)]
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>
11 years agobuild: fix typo in configure.ac regarding cdev-sessions
David Herrmann [Mon, 29 Oct 2012 19:34:03 +0000 (20:34 +0100)]
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>
11 years agokmscon: enable --all-gpus by default
David Herrmann [Mon, 29 Oct 2012 17:29:52 +0000 (18:29 +0100)]
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>
11 years agouterm: monitor: put systemd-layer into separate file
David Herrmann [Mon, 29 Oct 2012 17:09:35 +0000 (18:09 +0100)]
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>
11 years agouterm: vt: fix real VTs when opening the currently active VT
David Herrmann [Sun, 28 Oct 2012 16:38:28 +0000 (17:38 +0100)]
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>
11 years agouterm: drm: fix device-detection if no master is active
David Herrmann [Sun, 28 Oct 2012 16:37:18 +0000 (17:37 +0100)]
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>
11 years agouterm: vt: put input devices asleep when inactive
David Herrmann [Sun, 28 Oct 2012 15:56:50 +0000 (16:56 +0100)]
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>
11 years agouterm: input: fix stopping key-repeat when going asleep
David Herrmann [Sun, 28 Oct 2012 15:54:07 +0000 (16:54 +0100)]
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>
11 years agouterm: vt: fix race by blocking signals before setting them
David Herrmann [Sun, 28 Oct 2012 15:17:18 +0000 (16:17 +0100)]
uterm: vt: fix race by blocking signals before setting them

We must block the signals before setting the signal handlers to avoid
retrieving them asynchronously.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: drm: clear new buffers after allocation
David Herrmann [Sun, 28 Oct 2012 15:11:06 +0000 (16:11 +0100)]
uterm: drm: clear new buffers after allocation

Framebuffers are not guaranteed to be cleared after we allocate them.
Therefore, clear them as all the other uterm-video backends do.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: change default grab for "sesison-close" to "BackSpace"
David Herrmann [Sun, 28 Oct 2012 15:06:26 +0000 (16:06 +0100)]
kmscon: change default grab for "sesison-close" to "BackSpace"

Session management should be done with global keys. This allows us to use
the known "w", "t", "n" keys for "close", "new tab", "new window" etc.
functionality later.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: add --video-devices option
David Herrmann [Sun, 28 Oct 2012 15:02:28 +0000 (16:02 +0100)]
kmscon: add --video-devices option

If all the auto-detection logic of kmscon still does something you don't
want, you can now use this list to override all this logic with a
statically configured white-list.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoshl: add shl_string_list_is() helper
David Herrmann [Sun, 28 Oct 2012 15:01:47 +0000 (16:01 +0100)]
shl: add shl_string_list_is() helper

This helper tests whether a string-list has only a single entry and
compares this with the given entry.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: monitor: mark vesafb devices as primary
David Herrmann [Sun, 28 Oct 2012 14:40:56 +0000 (15:40 +0100)]
uterm: monitor: mark vesafb devices as primary

VESA VGA devices are platform devices so they are always primary.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: remove deprecated /etc/kmscon.conf support
David Herrmann [Sun, 28 Oct 2012 14:23:09 +0000 (15:23 +0100)]
kmscon: remove deprecated /etc/kmscon.conf support

This was supported for backwards-compatibility, but is no longer
supported. Use the new /etc/kmscon/kmscon.conf files.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: replace --fbdev/--dumb with --drm/--hwaccel
David Herrmann [Sun, 28 Oct 2012 14:20:20 +0000 (15:20 +0100)]
kmscon: replace --fbdev/--dumb with --drm/--hwaccel

The old options were quite stupid and low-level. It doesn't make sense to
require users to understand "--dumb" (besides, it sounds wrong).

Therefore, two new options replace the old options:
 --drm: Enabled by default. If true, kmscon uses primary DRM devices and
        avoids primary fbdev devices. If false, kmscon uses no DRM devices
        at all but uses primary fbdev devices now.
 --hwaccel: Disabled by default. If true, kmscon tries to
            hardware-accelerate any rendering if available. This can also
            affect fbdev or other devices in the future.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: add uterm_video_available() helper
David Herrmann [Sun, 28 Oct 2012 13:29:59 +0000 (14:29 +0100)]
uterm: add uterm_video_available() helper

This helper provides information whether a given backend is available and
even whether kernel-runtime support is available for this backend.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: enable DRM helpers with UTERM_VIDEO_DUMB
David Herrmann [Sun, 28 Oct 2012 13:22:19 +0000 (14:22 +0100)]
uterm: enable DRM helpers with UTERM_VIDEO_DUMB

The DRM helpers can actually also be used with dumb-displays so provide it
in both cases.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoNEWS: add kmscon-6 entries
David Herrmann [Sat, 27 Oct 2012 17:22:56 +0000 (19:22 +0200)]
NEWS: add kmscon-6 entries

Add entries for all main features since kmscon-5.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: fix --fbdev implying --all-gpus
David Herrmann [Sat, 27 Oct 2012 17:21:56 +0000 (19:21 +0200)]
kmscon: fix --fbdev implying --all-gpus

We currently have no code that sets PRIMARY flags for fbdev devices so
this logic does not make sense with --fbdev. Hence, imply --all-gpus when
--fbdev is set.

Reported-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: add --xkb-model option
David Herrmann [Sat, 27 Oct 2012 17:00:43 +0000 (19:00 +0200)]
kmscon: add --xkb-model option

This option now allows the user to change the XkbModel from the command
line or configuration file.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: input: allow passing "model" for keyboard descs
David Herrmann [Sat, 27 Oct 2012 16:55:21 +0000 (18:55 +0200)]
uterm: input: allow passing "model" for keyboard descs

We set the model to a system-default, which means, we are hosed if the
system-default is not what the user expects. Therefore, allow setting the
model via internal APIs.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: turn --switchvt on by default
David Herrmann [Sat, 27 Oct 2012 16:50:50 +0000 (18:50 +0200)]
kmscon: turn --switchvt on by default

We really _want_ this so turn it on by default. Especially for fake-VTs,
this really should be turned on all the time.
Use --no-switchvt to disable it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoconf: fix CONF_OPTION_BOOL warnings
David Herrmann [Sat, 27 Oct 2012 16:50:03 +0000 (18:50 +0200)]
conf: fix CONF_OPTION_BOOL warnings

We need to cast the boolean to void* to avoid warnings when using "true"
as default value instead of "false" (which evaluates to 0 => NULL).

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agobuild: fix "make check" build failures
David Herrmann [Sat, 27 Oct 2012 16:32:43 +0000 (18:32 +0200)]
build: fix "make check" build failures

I forgot again to keep these up to date. The conf-layer updates broke them
horribly. However, we now build them correctly without kmscon-core by
including all required layers directly.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotsm_vte: don't interpret Pause, it hangs the VTE
Ran Benita [Sat, 27 Oct 2012 10:11:23 +0000 (12:11 +0200)]
tsm_vte: don't interpret Pause, it hangs the VTE

Pressing the 'Pause/Break' key causes the VTE to hang with no apparent
way to recover (from within kmscon). It must turn on some software flow
control, XON/XOFF or whatever.
We might want to do something with this key, but certainly not *that*.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotsm_vte: don't send sequence for Scroll_Lock
Ran Benita [Sat, 27 Oct 2012 09:50:52 +0000 (11:50 +0200)]
tsm_vte: don't send sequence for Scroll_Lock

This value should not be sent to the application; currently pressing
Scroll Lock does some weird character transposing, which I believe to be
completely accidental.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotsm_vte: bind non-numlock'ed keypad keys correctly
Ran Benita [Fri, 26 Oct 2012 16:40:05 +0000 (18:40 +0200)]
tsm_vte: bind non-numlock'ed keypad keys correctly

When a user presses on the 4 key on the keypad with NumLock off, the
expected behavior is to move left. This commit fixes all of the main
keypad keys to act like their counterparts (though KP_Begin is not
bound to anything).
This is also what xterm does, as far as I can tell:
http://anonscm.debian.org/gitweb/?p=pkg-xorg/app/xterm.git;a=blob;f=input.c;h=f049078ed672c1da5adc169e85dc458b0fffc100;hb=HEAD#l984

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm_input_uxkb: update leds to match keyboard state
Ran Benita [Fri, 26 Oct 2012 16:14:32 +0000 (18:14 +0200)]
uterm_input_uxkb: update leds to match keyboard state

Upon device wakeup or led state changes, we update the keyboard LEDs to
match the new xkb state.

This means that every kmscon instance retains its own LED state, in the
users eyes. In other words, if you had Num Lock set on one kmscon, switched
to an X VT where it's off, and come back, then Num Lock will be set as
when you left. This is what X server, linux VT, etc. do.

Note that since we need to write the LED events to the evdev devices, we
need to open them RDWR. But since we don't really care what happens to
that write(), that's fine.

Also note that this means NumLock is off by default, which might be
annoying. We need to think how to get some 'setleds' or 'numlockx'
equivalent functionality.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm_input: change device 'feature' to device 'capability'
Ran Benita [Fri, 26 Oct 2012 15:38:19 +0000 (17:38 +0200)]
uterm_input: change device 'feature' to device 'capability'

'capability' seems to be the common terminology for this, and it sounds
better - so use it.

We also move the enum definition to the header, because otherwise the
'capabilities' field there doesn't make sense.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm_input: remove supporting code for updating LED state
Ran Benita [Fri, 26 Oct 2012 15:08:01 +0000 (17:08 +0200)]
uterm_input: remove supporting code for updating LED state

Before we transitioned to xkbcommon, we had some code that, upon
returning from a VT-switch, looked at the evdev led state and updated
the keyboard modifier state accordingly. So if we returned and NumLock
was on, we adjusted ourselves to that. That was pretty cute.

xkbcommon however doesn't support updating the state by LEDs like that.
Normally, the state of the LEDs is derived from the modifiers; going the
other way is tricky, error-prone and not used much. What we should be
doing is updating the LEDs according to *our* state.

This commit does the part of removing the unused dead code.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoxkb: use system defaults instead of "us" for layout
Ran Benita [Tue, 23 Oct 2012 18:59:27 +0000 (20:59 +0200)]
xkb: use system defaults instead of "us" for layout

libxkbcommon has a configure option to set the default values for the
RMLVO's (if they are passed as NULL or "" - we use "" so it'd be safe to
print). If they are not specified there, it's just "us" like we currently
do have. But if they are specified, we should most likely defer to it.

We do the same for the model field, instead of hardcoding "evdev". The
rules field remains hardcoded to "evdev", because we rely on it when
doing the evdev scancode-to-keycode +8 mapping.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoxkb: don't use deprecated libxkbcommon symbols
Ran Benita [Tue, 23 Oct 2012 18:29:39 +0000 (20:29 +0200)]
xkb: don't use deprecated libxkbcommon symbols

Now that libxkbcommon had a release, that has some API breakage (in
particular to xkb_keysym_from_name), we should update our code against
it and advise users to just use the xkbcommon release.

This should not happen anymore, for the foreseeable future at least.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: add --primary-gpu-only and --all-gpus options
David Herrmann [Sat, 27 Oct 2012 16:00:27 +0000 (18:00 +0200)]
kmscon: add --primary-gpu-only and --all-gpus options

By default, kmscon now only uses primary und auxiliary displays. All
uncategorized displays are ignored. This fixes problems with dual-GPU
systems.

--primary-gpu-only makes kmscon not use any auxiliary displays. --all-gpus
makes kmscon also use uncategorized displays.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: monitor: mark auxiliary devices
David Herrmann [Sat, 27 Oct 2012 15:46:48 +0000 (17:46 +0200)]
uterm: monitor: mark auxiliary devices

We now mark auxiliary displays specially so applications know which
devices can be used independently. We currently only mark USB devices as
such but this can be extended in the future for more devices.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: monitor: report primary GPUs to caller
David Herrmann [Sat, 27 Oct 2012 11:55:54 +0000 (13:55 +0200)]
uterm: monitor: report primary GPUs to caller

We check every DRM GPU now whether it matches the primary PCI GPU. If it
does, we set a new UTERM_MONITOR_PRIMARY flag for the device.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: monitor: add "dev_flags" field to event-structure
David Herrmann [Sat, 27 Oct 2012 11:41:23 +0000 (13:41 +0200)]
uterm: monitor: add "dev_flags" field to event-structure

Instead of using different types we now use flags. This is more
appropriate and will allow us more easily to add new flags.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: add PCI primary GPU detection
David Herrmann [Sat, 27 Oct 2012 11:25:44 +0000 (13:25 +0200)]
uterm: add PCI primary GPU detection

We used to simply probe every GPU that is reported by the kernel. However,
if a system has multiple GPUs that share display controllers, we cannot
use both simultaneously. Unfortunately, the kernel currently does not
notify us about this. Hence, we use some heuristics to determine which GPU
is the boot-gpu/primary-gpu.

This only adds the detection logic, it does not modify any code to use
this detection at all.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: add character-device session dummy
David Herrmann [Fri, 26 Oct 2012 16:08:35 +0000 (18:08 +0200)]
kmscon: add character-device session dummy

If libfuse is available then kmscon is built with a new session type: cdev
This session creates a fake TTY char-dev via CUSE (which itself uses FUSE)
which then can be used by user-space as if it were a real VT.

This is still incomplete and does only support basic I/O, yet. But it
shows in what direction this is going.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoshl: ring: provide offset parameter for shl_ring_peek()
David Herrmann [Thu, 25 Oct 2012 12:47:32 +0000 (14:47 +0200)]
shl: ring: provide offset parameter for shl_ring_peek()

If we want to fill a whole buffer, we actually might have to read more
data than just the data from the beginning. Therefore, provide an offset
so we can read from multiple pages.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: fix session-include fallbacks
David Herrmann [Wed, 24 Oct 2012 16:52:54 +0000 (18:52 +0200)]
kmscon: fix session-include fallbacks

We must provide safe fallbacks if the register-functions are not provided
as they are not compiled into kmscon.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agowlt: toolkit: update to new wayland-0.99 API
David Herrmann [Wed, 24 Oct 2012 15:01:44 +0000 (17:01 +0200)]
wlt: toolkit: update to new wayland-0.99 API

The wayland-0.99 API changed some bits. This updates wlt-toolkit to work
with the new API.

There are still some bugs that need to be fixed, however, it builds fine
and runs perfectly well on weston. The last flickering/tearing bugs have a
low priority, currently. They can be fixed when kmscon-6 is done.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoeloop: fix ev_fd_update() to do nothing if the mask does not change
David Herrmann [Wed, 24 Oct 2012 15:00:48 +0000 (17:00 +0200)]
eloop: fix ev_fd_update() to do nothing if the mask does not change

If the new mask is equal to the old mask, we shouldn't change anything.
This improves performance and avoids syscalls when they aren't needed.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoconf: try to give better hints if keysyms were mistyped
David Herrmann [Wed, 24 Oct 2012 13:46:19 +0000 (15:46 +0200)]
conf: try to give better hints if keysyms were mistyped

We can now check keysym names on case-insensitive basis. We can use this
to try to give hints to the user what they probably meant when mistyping a
keysym name.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoREADME: remove xkbcommon references
David Herrmann [Wed, 24 Oct 2012 13:45:21 +0000 (15:45 +0200)]
README: remove xkbcommon references

xkbcommon now has seen a public release (0.2.0) and we have a hard
dependency on it. No more config-fiddling. You must provide xkbcommon to
make kmscon work!

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoconf: fix using new xkbcommon-0.2.0 API
David Herrmann [Wed, 24 Oct 2012 13:25:23 +0000 (15:25 +0200)]
conf: fix using new xkbcommon-0.2.0 API

The xkbcommon API was changed for 0.2.0 release. But now it should be
stable so we hopefully fixed it for the last time.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: rework --login handling
David Herrmann [Tue, 23 Oct 2012 11:22:06 +0000 (13:22 +0200)]
kmscon: rework --login handling

We implement --login as special type now. This allows us to correctly
parse it in configuration files.
We also replace the default value by /bin/login.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: simplify --vt handling
David Herrmann [Tue, 23 Oct 2012 11:21:27 +0000 (13:21 +0200)]
kmscon: simplify --vt handling

We can reuse all the conf_string.* functions and do not have to implement
them ourself.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoseat: fix closing dummy sessions
David Herrmann [Tue, 23 Oct 2012 11:18:42 +0000 (13:18 +0200)]
seat: fix closing dummy sessions

We must reset the "dummy" pointer when unregistering dummy sessions,
otherwise, we will get NULL pointer derefs.
This also prevents keyboard-input from closing dummy sessions.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoshl: misc: add shl_dup_array_size() helper
David Herrmann [Tue, 23 Oct 2012 10:32:37 +0000 (12:32 +0200)]
shl: misc: add shl_dup_array_size() helper

This is the same as shl_dup_array() but the source might not be NULL
terminated so it takes a "size" argument.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agobuild: fix typo in wlterm dependency checking
David Herrmann [Tue, 23 Oct 2012 10:06:55 +0000 (12:06 +0200)]
build: fix typo in wlterm dependency checking

This is just two small typos/copy-paste-errors that didn't get checked
earlier.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoconf: simplify helper macros
David Herrmann [Tue, 23 Oct 2012 10:05:42 +0000 (12:05 +0200)]
conf: simplify helper macros

Instead of using "NULL, NULL, NULL, " in every macro, we now provide a
*_FULL variant which allows setting these. All other macros simply set
these to NULL by default.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoconf: call aftercheck after config-file parsing is done
David Herrmann [Tue, 23 Oct 2012 09:45:43 +0000 (11:45 +0200)]
conf: call aftercheck after config-file parsing is done

We need to call afterchecks after any parsing we do. To signal that there
are no extra-arguments, we pass argv==NULL.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoconf: add "file" callback
David Herrmann [Tue, 23 Oct 2012 09:41:34 +0000 (11:41 +0200)]
conf: add "file" callback

The "file" callback is used to parse configuration files. If it is not
given, the string is parsed via "parse".

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoMerge branch 'github/master'
David Herrmann [Tue, 23 Oct 2012 09:39:24 +0000 (11:39 +0200)]
Merge branch 'github/master'

Merge upstream development into the config-rework.

11 years agobuild: add proper dependency checking to configure.ac
David Herrmann [Tue, 23 Oct 2012 09:35:49 +0000 (11:35 +0200)]
build: add proper dependency checking to configure.ac

We build several tools inside of this repository and we need to make sure
all dependencies are met. Furthermore, we must make sure that default
values are recognized even on dependencies.
Hence, this reworks the whole configure.ac handling and does some renaming
of the constants that are used all over the source.

We need to test this some more weeks, but it should finally be a proper
autotools handling that we can release with kmscon-6.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: dumb: clear buffer on allocation
David Herrmann [Mon, 22 Oct 2012 12:00:39 +0000 (14:00 +0200)]
uterm: dumb: clear buffer on allocation

DRM buffers are not guaranteed to be cleared after allocation. This is to
boost performance for small buffers that are allocated and freed often.
However, for render-buffers we can clear them without loosing any
performance as they are allocated once and then only freed on shutdown.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: use local configs instead of global kmscon_conf
David Herrmann [Fri, 19 Oct 2012 15:18:58 +0000 (17:18 +0200)]
kmscon: use local configs instead of global kmscon_conf

We now have the ability to pass on local configurations so we no longer
need the global kmscon_conf.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoconf: add option-copy callback
David Herrmann [Fri, 19 Oct 2012 14:40:34 +0000 (16:40 +0200)]
conf: add option-copy callback

We allow options to specify "aftercheck" callbacks but do not call them
during a copy. Therefore, we need a way to copy side-effects. As we cannot
do that generically, we now allow each option to specify such a callback.

We use it for the "all_seats" and "argv" parameters in kmscon.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoconf: fix overwriting locked options during copy
David Herrmann [Fri, 19 Oct 2012 14:19:26 +0000 (16:19 +0200)]
conf: fix overwriting locked options during copy

If we copy entries into another context, we must not overwrite locked
entries. Furthermore, if we copy a locked entry, we must also copy that
lock.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: implement per-seat configuration
David Herrmann [Fri, 19 Oct 2012 14:15:34 +0000 (16:15 +0200)]
kmscon: implement per-seat configuration

Sorry for the huge commit, but this reworks the whole configuration
handler. We now provide conf_ctx contexts which contain a pointer to the
backing storage and the config-options that are used.

It is also possible to copy config-options now. So we can use the
main-config as default value for seat-configurations.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: video: drm: do not set EGL_DISPLAY
David Herrmann [Thu, 18 Oct 2012 16:57:47 +0000 (18:57 +0200)]
uterm: video: drm: do not set EGL_DISPLAY

EGL_DISPLAY is a no-op and we probably want to set EGL_PLATFORM. However,
it doesn't make any sense to set it, because EGL should be able to
properly detect the platform.
If this doesn't work on your machine, you should really try fixing your
environment before forcing this. If there are corner cases where this
doesn't work, you should file a bug against mesa.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: make configuration-parser modular
David Herrmann [Thu, 18 Oct 2012 13:58:34 +0000 (15:58 +0200)]
kmscon: make configuration-parser modular

This allows changing the backing-memory of a kmscon-config object. This
way, we can parse the same options into a per-seat config object.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: add helpers to access kmscon_conf
David Herrmann [Thu, 18 Oct 2012 13:10:42 +0000 (15:10 +0200)]
kmscon: add helpers to access kmscon_conf

We are about to introduce per-seat-configuration so we need some helper
macros that will later select the right configuration that we read from.

These helpers simply hook into the kmscon-config and return the correct
value.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: drop all configs and use new /etc/kmscon/kmscon.conf
David Herrmann [Thu, 18 Oct 2012 12:48:09 +0000 (14:48 +0200)]
kmscon: drop all configs and use new /etc/kmscon/kmscon.conf

This drops all config-file support except for the new
/etc/kmscon/kmscon.conf. For backwards-compatibility, we still parse
/etc/kmscon.conf but this will be removed soon.

We want to add one kmscon-config for each seat so you can have different
configurations per seat. These will all be put into /etc/kmscon/ so we
need this directory.

We also drop ~/.kmscon.conf. This was never really useful as kmscon is a
system daemon and should not be used with user-configuration files.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoconf: introduce conf_parse_file_f()
David Herrmann [Thu, 18 Oct 2012 12:10:48 +0000 (14:10 +0200)]
conf: introduce conf_parse_file_f()

This new helper allows easily parsing arbitrary filenames. It does the
same as conf_parse_file() but allows giving filenames in printf format.

The other parsers are slightly adjusted so they can be more easily reused
by other projects.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: reorganize configuration items
David Herrmann [Thu, 18 Oct 2012 11:45:49 +0000 (13:45 +0200)]
kmscon: reorganize configuration items

This just rearranges all options so they are logically grouped and in the
same order at all places. It also changes the internal variable for
"--fbdev" from "use_fbdev" to "fbdev" so all variables have the same name
as the option-names.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: add --session-max parameter
David Herrmann [Thu, 18 Oct 2012 11:28:10 +0000 (13:28 +0200)]
kmscon: add --session-max parameter

This parameter allows to limit the maximum number of sessions to a sane
limit. Otherwise, a user could DOS a systemd by opening as many session as
they want.
This can be set to 0 to drop that limit, however, this is not recommended.
Instead, if you want an ability to add more sessions than that limit, you
should implement a flag to register_session() that overwrites the limit.
This can then be used by a safe way to register new sessions.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoseat: use dummy session
David Herrmann [Thu, 18 Oct 2012 11:15:41 +0000 (13:15 +0200)]
seat: use dummy session

This makes the seat implementation register one dummy session as fallback.
This session isn't switched to except if no other session is available.
Furthermore, if the dummy is active and a new session is registered, it is
automatically activated.

External applications should never know of this dummy session. It's a
kmscon internal fallback so we can draw the screen even if there is no
other session available.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: add dummy session type
David Herrmann [Thu, 18 Oct 2012 11:14:16 +0000 (13:14 +0200)]
kmscon: add dummy session type

The dummy session is a very simply session implementation that simply
draws a black background. It will be used by each seat as fallback if no
other session is available. If we didn't do that, we wouldn't be able to
guarantee that the screen is cleared after a session is unregistered.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoseat: add keyboard grabs to close sessions and start new terminals
David Herrmann [Thu, 18 Oct 2012 09:50:57 +0000 (11:50 +0200)]
seat: add keyboard grabs to close sessions and start new terminals

You can now use ctrl+alt+w to close the current session and
ctrl+alt+Return to start a new terminal (if it is built-in).

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoseat: fix sending all displays to newly created sessions
David Herrmann [Thu, 18 Oct 2012 09:48:30 +0000 (11:48 +0200)]
seat: fix sending all displays to newly created sessions

We used to create all sessions that listen to displays during startup.
Therefore, all displays were kind of "hotplugged". However, we must also
send already existing displays to new sessions so we can create them
during runtime just fine.

This simply calls the session-callback during session-registration so you
must be fine getting the session callback when calling
kmscon_session_register().

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: input: fix resetting key-repeat timer during key-press
David Herrmann [Mon, 15 Oct 2012 20:59:31 +0000 (22:59 +0200)]
uterm: input: fix resetting key-repeat timer during key-press

We currently do not reset the key-repeat-delay when key-presses are
changed fast enough to fall into the repeat-rate range. Therefore, we
might get spurios key-repeats, even though the key itself wasn't held for
repeat-delay milliseconds.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoseat: fix staying alive if compositor-registration fails
David Herrmann [Mon, 15 Oct 2012 20:53:55 +0000 (22:53 +0200)]
seat: fix staying alive if compositor-registration fails

If the compositor cannot be created, we now still stay alive and allow
other sessions to work. However, the terminal session is still required as
it is considered to be crucial.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>