platform/upstream/kmscon.git
12 years agovte/font/console: support basic character attributes
David Herrmann [Mon, 28 May 2012 10:37:12 +0000 (12:37 +0200)]
vte/font/console: support basic character attributes

This adds support for colored and bold characters. This also adds the
infrastrucure for background colors and underlined characters, however,
these are not properly implemented, yet.

The color codes are similar to xterm and optimized on black backgrounds.
So they are not too bright or shiny.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agovte: send correct escape characters on ctrl+KEY input
David Herrmann [Sun, 27 May 2012 14:45:27 +0000 (16:45 +0200)]
vte: send correct escape characters on ctrl+KEY input

This adds support for the ctrl+KEY inputs to send escape sequences to the
child process.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agouterm_input: introduce UTERM_INPUT_HAS_MODS()
David Herrmann [Sun, 27 May 2012 14:43:26 +0000 (16:43 +0200)]
uterm_input: introduce UTERM_INPUT_HAS_MODS()

This is a convenient macro to check whether a given set of modifiers is
enabled on the given input event.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agotest_input: always print keysym
David Herrmann [Sun, 27 May 2012 14:41:19 +0000 (16:41 +0200)]
test_input: always print keysym

Print keysym even if we have a UCS4 representation. This makes debugging
keyboard issues much easier. Also increase buffer size to 32 as there are
many symbols longer than 16 characters.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agovte: print debug message on unknown CSI parameters
David Herrmann [Sun, 27 May 2012 13:21:32 +0000 (15:21 +0200)]
vte: print debug message on unknown CSI parameters

Print a debug message if the CSI-K/J parameters are unknown.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agovte: remove kmscon_vte_bind()
David Herrmann [Sun, 27 May 2012 12:47:11 +0000 (14:47 +0200)]
vte: remove kmscon_vte_bind()

Bind the console at vte creation instead of dynamically during runtime.
There is no need to rebind a console so remove this complexity.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agomain: start ui on each seat
David Herrmann [Sun, 27 May 2012 10:08:49 +0000 (12:08 +0200)]
main: start ui on each seat

We now have a video device for each seat so we only need to launch the UI
when the video device is registered.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agouterm_input: fix increasing refcnt
David Herrmann [Sun, 27 May 2012 10:04:48 +0000 (12:04 +0200)]
uterm_input: fix increasing refcnt

We need to correctly increase the refcnt. We currently increase it only
when it was 0 before due to a very subtle bug as we missed the "return".

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoxkb: add a TODO note to kbd_dev_reset stub
Ran Benita [Sun, 20 May 2012 14:35:10 +0000 (17:35 +0300)]
xkb: add a TODO note to kbd_dev_reset stub

This is a small regression whereby starting kmscon with e.g. Caps Lock
already on, will not be reflected in the modifier mask. It's not
currently possible with xkbcommon.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoxkb: produce key events
Ran Benita [Sun, 20 May 2012 14:26:10 +0000 (17:26 +0300)]
xkb: produce key events

Use the new API in kbd_dev_process_key.
This introduces a regression whereby repeating key events are sent for
modifier keys. This is a currently a limitation in xkbcommon.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoxkb: initialize the xkb objects
Ran Benita [Sun, 20 May 2012 13:29:43 +0000 (16:29 +0300)]
xkb: initialize the xkb objects

The new xkb types correspond quite closely to our own types, which now
become thin wrappers.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoxkb: remove old xkb code and add stubs
Ran Benita [Sun, 20 May 2012 08:53:26 +0000 (11:53 +0300)]
xkb: remove old xkb code and add stubs

The libxkbcommon API as been revamped completely, making all of the
current code redundant and non-working. This commit removes all of the
old xkb_desc handling before using the new API.

After this commit, kmscon will no longer link to against the old
lixkbcommon; please update to a new package or compile from the
"master" branch from:
git://anongit.freedesktop.org/xorg/lib/libxkbcommon

[ This commit also adds a missing kbd_desc_new, which was declared but
not copied over from the old files. ]

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoinput: remove old input subsystem
David Herrmann [Sat, 26 May 2012 12:58:53 +0000 (14:58 +0200)]
input: remove old input subsystem

We are no longer using the old subsystem, so remove it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoReplace old input subsystem with new uterm input
David Herrmann [Sat, 26 May 2012 12:57:08 +0000 (14:57 +0200)]
Replace old input subsystem with new uterm input

Use the new subsystem now throughout the whole code.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agokbd: remove "dev" from kbd_dev_keysym_to_string
Ran Benita [Sun, 20 May 2012 15:15:54 +0000 (18:15 +0300)]
kbd: remove "dev" from kbd_dev_keysym_to_string

Both dumb and xkb don't actually need the kbd_dev for that. The dumb
backend already omits the "dev".

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agomonitor: fix small memory leak
Ran Benita [Sun, 20 May 2012 15:26:51 +0000 (18:26 +0300)]
monitor: fix small memory leak

The members of the array returned from get_all_seats are strdup'd as
well.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agomain: remove old session code
David Herrmann [Sat, 26 May 2012 12:39:25 +0000 (14:39 +0200)]
main: remove old session code

We now run a session on each registered seat so we no longer need the old
session code.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agomain: allocate one VT per seat
David Herrmann [Sat, 26 May 2012 12:34:46 +0000 (14:34 +0200)]
main: allocate one VT per seat

Each session needs a virtual terminal where it operates. Therefore,
allocate one VT per seat so we can react on events on that seat.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agovt: fix calling wrong callbacks
David Herrmann [Sat, 26 May 2012 12:30:38 +0000 (14:30 +0200)]
vt: fix calling wrong callbacks

If we allocate multiple VTs in a single process, then we share the same
signals which are used to acknowledge VT switches. Instead of blindly
calling the user-callbacks, we need to check first which VT is currently
active to forward the signal only if we are the active VT.
Otherwise, all VTs we allocate share a single logical VT.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agomain: poll video devices on hotplug
David Herrmann [Sat, 26 May 2012 11:47:23 +0000 (13:47 +0200)]
main: poll video devices on hotplug

When the monitor notifies us about an hoptplug event, then we need to poll
the current video device. Otherwise, we might miss hotplugged monitors.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agomain: add input device to each seat
David Herrmann [Sat, 26 May 2012 11:44:36 +0000 (13:44 +0200)]
main: add input device to each seat

Each seat now collects all input devices that are associated to that seat.
When multi-session support is added, then we can even share them between
the sessions.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agomain: collect one DRM device per seat
David Herrmann [Sat, 26 May 2012 11:38:23 +0000 (13:38 +0200)]
main: collect one DRM device per seat

We need a single graphics card on a seat to run kmscon. Therefore, wait
for the first DRM device that appears and make it the current graphics
device for the seat. We do not support multiple graphics cards per seat
but this may be added in the future.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agomain: create vt master object
David Herrmann [Sat, 26 May 2012 11:16:23 +0000 (13:16 +0200)]
main: create vt master object

When running multiple sessions on multiple seats, we need to allocate
multiple VTs, too. Therefore, we now create a VT master connection in the
main application which we can later use to allocate new VTs for each
session.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agomain: listen for new seats
David Herrmann [Sat, 26 May 2012 11:14:20 +0000 (13:14 +0200)]
main: listen for new seats

Allocate new seat objects when a new seat occurs and remove them when a
seat goes away.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agomain: use uterm_monitor objects
David Herrmann [Sat, 26 May 2012 11:02:05 +0000 (13:02 +0200)]
main: use uterm_monitor objects

Create a global uterm_monitor object to monitor the system for new seats
and devices.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agouterm_vt: fix correctly passing vt data to callbacks
David Herrmann [Sat, 26 May 2012 05:33:34 +0000 (07:33 +0200)]
uterm_vt: fix correctly passing vt data to callbacks

When emulating the VT layer we need to pass our own data to the internal
callbacks. We currently pass the user data which is really useless here.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agotest_vt: use new uterm vt master
David Herrmann [Sat, 26 May 2012 05:24:47 +0000 (07:24 +0200)]
test_vt: use new uterm vt master

Use uterm vt master to allocate an VT on seat0 for testing purposes.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agouterm: add VT API
David Herrmann [Fri, 25 May 2012 07:45:20 +0000 (09:45 +0200)]
uterm: add VT API

The uterm VT API is designed to support new user-space implementations of
vt-master APIs. If we are on seat0 and CONFIG_VT is enabled, we use the
kernel VT API. In all other cases we currently simply fall back to a
non-op but will implement in the future dbus based APIs or similar to
support VT switching, that is multi-session, on all seats.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agovt: add kmscon_vt_supported() function
David Herrmann [Thu, 24 May 2012 17:14:51 +0000 (19:14 +0200)]
vt: add kmscon_vt_supported() function

If the kernel has CONFIG_VT disabled we should avoid opening VTs and
instead rely on other mechanisms for virtual terminals.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoeloop: fix eloop object never being freed
David Herrmann [Sun, 20 May 2012 20:54:08 +0000 (22:54 +0200)]
eloop: fix eloop object never being freed

We must _never_ take a reference to ourself in a constructor. Otherwise,
the refcnt will be >1 which means if the user calls *_unref() the object
will not get freed.
Therefore, do not add the counter object used for idle sources directly to
the event loop. Instead, add it when the first idle source is registered
and remove it when the last source is removed. This will slightly slow
down performance of idle-sources. However, the whole eloop is not
optimized for speed, yet, so we don't care for now.

Reported-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoeloop: add initial gtk-doc comments
David Herrmann [Sat, 19 May 2012 15:58:08 +0000 (17:58 +0200)]
eloop: add initial gtk-doc comments

Add gtk-doc compatible comments to most of the functions in eloop.c.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoeloop: dynamically reallocate dispatch cache
David Herrmann [Sat, 19 May 2012 11:47:55 +0000 (13:47 +0200)]
eloop: dynamically reallocate dispatch cache

We do not maintain event caches so we must make sure that every event
source gets dispatched. If we call epoll_wait() and our buffer gets
filled everytime, then there might be an event source that does not get
dispatched because it is always above the buffer range. Therefore, we now
dynamically increase the cache size when it once gets filled up.

This gets critical if we handle thousands of clients or fds, however, our
use case is limited to some system resources and hence does not suffer
here.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoeloop: add more comments
David Herrmann [Sat, 19 May 2012 11:33:05 +0000 (13:33 +0200)]
eloop: add more comments

Add comments describing each source and the nesting features.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoeloop: use counter source for idle events
David Herrmann [Sat, 19 May 2012 11:07:12 +0000 (13:07 +0200)]
eloop: use counter source for idle events

epoll has the great feature that the poll object is an fd itself. However,
if we want to use idle-sources, we couldn't add them to the epoll set.
Now, we use a counter source for all idle sources so if we add a single
event-loop as source to another event loop, the idle sources will get
dispatched correctly. Furthermore, we now longer block after handling idle
sources but instead now correctly run idle sources every next round
without sleeping for fd events in between.
Unregister idle sources to avoid hogging the CPU.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoeloop: fix not returning new counter object
David Herrmann [Sat, 19 May 2012 11:05:49 +0000 (13:05 +0200)]
eloop: fix not returning new counter object

We forgot to actually store the pointer to the new counter object in the
\out variable. Fix this now.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoeloop: forward timer HUP and I/O errors to caller
David Herrmann [Sat, 19 May 2012 10:47:08 +0000 (12:47 +0200)]
eloop: forward timer HUP and I/O errors to caller

Similar to counter callbacks we now call timer callbacks with 0 as
argument on errors and disable the timer source.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoeloop: forward EOF and I/O errors of counters to caller
David Herrmann [Sat, 19 May 2012 10:30:05 +0000 (12:30 +0200)]
eloop: forward EOF and I/O errors of counters to caller

Instead of silently dropping read() errors we now disable the counter and
call the user-supplied callback with 0 as argument so they can react on
errors.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoeloop: allow enabling/disabling counter sources
David Herrmann [Sat, 19 May 2012 10:26:55 +0000 (12:26 +0200)]
eloop: allow enabling/disabling counter sources

Similar to fd and timer sources we now also support disabling counter
sources via similar functions.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoeloop: allow enabling/disabling timer sources
David Herrmann [Sat, 19 May 2012 10:24:28 +0000 (12:24 +0200)]
eloop: allow enabling/disabling timer sources

Similar to the fd_enable/disable functions we now also allow the same
operations on timer sources.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoeloop: correctly forward error codes
David Herrmann [Sat, 19 May 2012 10:15:51 +0000 (12:15 +0200)]
eloop: correctly forward error codes

Instead of ignoring epoll errors we should forward them to the caller. The
caller can then still decide to ignore errors.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoeloop: allow enabling/disabling fd sources
David Herrmann [Fri, 18 May 2012 15:35:18 +0000 (17:35 +0200)]
eloop: allow enabling/disabling fd sources

We sometimes want to be able to enable/disable an fd-source without
allocating memory (for a short period, for instance). Therefore, introduce
two new functions to enable and disable an fd source.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agofbdev: add few implementation hints
David Herrmann [Fri, 18 May 2012 14:39:23 +0000 (16:39 +0200)]
fbdev: add few implementation hints

fbdev is still not ready but we add some hints so implmenting it later
will be easier.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoeloop: move callback declarations into correct order
David Herrmann [Fri, 18 May 2012 14:38:51 +0000 (16:38 +0200)]
eloop: move callback declarations into correct order

Use same order as the function definitions.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoeloop: convert idle sources to hooks
David Herrmann [Thu, 17 May 2012 16:35:00 +0000 (18:35 +0200)]
eloop: convert idle sources to hooks

Instead if implementing complex idle sources we now provide a hook so
other subsystems can register callbacks.

This simplifies the code a lot and doesn't drop any major functionality.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoeloop: move code
David Herrmann [Thu, 17 May 2012 16:17:52 +0000 (18:17 +0200)]
eloop: move code

Restructure eloop code. This puts stuff more closely together if it is
related.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoeloop: make timers create fd on initialization
David Herrmann [Thu, 17 May 2012 15:40:14 +0000 (17:40 +0200)]
eloop: make timers create fd on initialization

Similar to other event sources we now initialize internal data on timer
creation instead of when the source is added to the loop.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoeloop: take fd argument for fd-sources at initialization
David Herrmann [Thu, 17 May 2012 15:03:46 +0000 (17:03 +0200)]
eloop: take fd argument for fd-sources at initialization

When creating a new fd-source you must supply the file descriptor
directly. You cannot delay this to the time when you add the fd to the
event loop.

This simplifies the logic and allows much smoother handling in the event
loop core.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoeloop: add counter sources
David Herrmann [Thu, 17 May 2012 14:41:26 +0000 (16:41 +0200)]
eloop: add counter sources

Counter sources are based on the eventfd syscall of linux. Internally, is
uses a 64bit counter which is initialized to 0 and can be increased by the
caller. Whenever the value is non-zero, the fd is marked readable and we
call our callback. We read the 64bit integer (which resets it to 0) and
pass the current value to the callback.

This can be used to implement cross-process notification methods or to
have idle-sources as valid file-descriptors in an epoll set which could be
exported to other applications that are not compliant to our event loop.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoeloop: add ev_fd_is_bound() helper
David Herrmann [Thu, 17 May 2012 14:33:47 +0000 (16:33 +0200)]
eloop: add ev_fd_is_bound() helper

This helper returns true if the fd is bound to an eloop object, otherwise
false is returned.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agotest_output: explicitely activate GL context
David Herrmann [Thu, 17 May 2012 14:31:38 +0000 (16:31 +0200)]
test_output: explicitely activate GL context

We now support multiple GL contexts in uterm so we need to explicitely
enable them before using them.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agofont: fix trailing newline in debug message
David Herrmann [Thu, 17 May 2012 12:44:50 +0000 (14:44 +0200)]
font: fix trailing newline in debug message

log_* appends newline automatically so remove it from the debug message.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agotest_output: fix build failure
David Herrmann [Sat, 5 May 2012 20:49:29 +0000 (22:49 +0200)]
test_output: fix build failure

Use new uterm_video constructor. This requires hard-coding the DRM card
but this is needed until we use the uterm_monitor interface.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agotest_input: use new input API
David Herrmann [Sat, 5 May 2012 20:48:15 +0000 (22:48 +0200)]
test_input: use new input API

Use new uterm_monitor and input API instead.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agouterm_monitor: correctly enumerate input devices
David Herrmann [Sat, 5 May 2012 20:41:23 +0000 (22:41 +0200)]
uterm_monitor: correctly enumerate input devices

We are actually not interested in the main input device but rather in the
evdev interface. However, the evdev interface is a child of the input
device and therefore has no seat values specifies. This patch removes the
scan-filter for seat tags and performs seat matching in user-space by
first finding the parent of the input device.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agouterm_monitor: refresh seats before scanning the system
David Herrmann [Sat, 5 May 2012 20:40:32 +0000 (22:40 +0200)]
uterm_monitor: refresh seats before scanning the system

We currently only scan devices in uterm_monitor_scan() but we should read
the initial seat values before even searching for devices.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agouterm_monitor: initialize list heads correctly
David Herrmann [Sat, 5 May 2012 20:40:01 +0000 (22:40 +0200)]
uterm_monitor: initialize list heads correctly

List heads must be initialized and cannot be set to NULL by default.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agouterm_monitor: add debug messages
David Herrmann [Sat, 5 May 2012 20:39:24 +0000 (22:39 +0200)]
uterm_monitor: add debug messages

Be more verbose about added and removed devices. Otherwise, debugging is
not as easy as it could be.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agouterm_input: fix initializing device list
David Herrmann [Sat, 5 May 2012 20:37:21 +0000 (22:37 +0200)]
uterm_input: fix initializing device list

kmscon_dlist heads must be initialized and cannot be set to NULL by
default!

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agouterm_input_xkb: fix typo
David Herrmann [Sat, 5 May 2012 20:36:23 +0000 (22:36 +0200)]
uterm_input_xkb: fix typo

We renamed kmscon_kbd to kbd_dev but forgot that single function.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agouterm_input: fix typo
David Herrmann [Sat, 5 May 2012 20:35:43 +0000 (22:35 +0200)]
uterm_input: fix typo

The header said *_is_asleep() instead of *_is_awake().

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agouterm_input: add xkb backend
David Herrmann [Sat, 5 May 2012 19:30:06 +0000 (21:30 +0200)]
uterm_input: add xkb backend

This mainly copies the kbd_xkb.c backend into the uterm library.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agouterm_input: use new kbd API
David Herrmann [Sat, 5 May 2012 19:15:57 +0000 (21:15 +0200)]
uterm_input: use new kbd API

Use the uterm internal kbd API instead of the kmscon kbd API.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agouterm_input: add kbd API
David Herrmann [Sat, 5 May 2012 19:14:38 +0000 (21:14 +0200)]
uterm_input: add kbd API

Internally, we use a new kbd API to handle keyboard related stuff in
uterm. It is a reimplementation of the old kbd_dumb.c backend.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agouterm_input: add input layer to uterm
David Herrmann [Sat, 5 May 2012 18:33:27 +0000 (20:33 +0200)]
uterm_input: add input layer to uterm

This is a rewrite of the input layer but integrated into uterm. It has the
same functionality but is tightly bound to the concepts behind uterm and
will soon supercede the old implementation.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agouterm_monitor: add input device support
David Herrmann [Sat, 5 May 2012 16:21:58 +0000 (18:21 +0200)]
uterm_monitor: add input device support

To allow moving all input handling to uterm, too, we need to detect input
devices in the uterm-monitor like all other devices, too.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agouterm_video: remove hotplug awareness
David Herrmann [Sat, 5 May 2012 15:39:46 +0000 (17:39 +0200)]
uterm_video: remove hotplug awareness

To introduce the new uterm-monitor object we need to remove all the udev
handling from uterm_video. To not break "git bisect" we now remove all the
udev code from uterm_video and uterm_video_drm and make kmscon use the
static /dev/dri/card0 interface for now.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agouterm_video_drm: include xf86drmMode.h again
David Herrmann [Sat, 5 May 2012 15:24:23 +0000 (17:24 +0200)]
uterm_video_drm: include xf86drmMode.h again

Upstream mesa fixed the missing header protection of xf86drmMode.h so we
can include it again.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agouterm_monitor: add system monitor for full seat support
David Herrmann [Sat, 5 May 2012 15:16:13 +0000 (17:16 +0200)]
uterm_monitor: add system monitor for full seat support

The new uterm_monitor watches the system for seat-changes and puts all
devices under the correct seat. This allows to run kmscon on multiple
seats in a single process. It now also correctly handles seat-changes,
that is, devices that are reattached to a different seat on runtime.

It is not integrated into the kmscon source, yet, but will soon be.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agomisc: add safe list iterator
David Herrmann [Sat, 5 May 2012 15:14:28 +0000 (17:14 +0200)]
misc: add safe list iterator

New for-each implementation that keeps a safe pointer to the next element
so you can remove the current element from the list.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoeloop: allow flushing an fd
David Herrmann [Sat, 5 May 2012 15:13:42 +0000 (17:13 +0200)]
eloop: allow flushing an fd

Sometimes one wants to remove all pending events for an fd. The new
ev_eloop_flush_fd() call allows this in a safe way.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agouterm_video: add udev device parameter to video_new()
David Herrmann [Thu, 3 May 2012 17:24:39 +0000 (19:24 +0200)]
uterm_video: add udev device parameter to video_new()

When triggered by seat monitor we need to be able to create uterm_video
objects on a concrete device so enable passing it in.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agobuild: fix build for automake 1.12
David Herrmann [Thu, 3 May 2012 17:05:59 +0000 (19:05 +0200)]
build: fix build for automake 1.12

automake-1.12 complains about missing AC_PROG_AR so add it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agouterm: fix comments
David Herrmann [Thu, 3 May 2012 16:11:40 +0000 (18:11 +0200)]
uterm: fix comments

Update comments to resemble new uterm_video logic.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agouterm_video_drm: return -EINVAL if already activated
David Herrmann [Wed, 25 Apr 2012 16:19:21 +0000 (18:19 +0200)]
uterm_video_drm: return -EINVAL if already activated

If a display is already activated we return EINVAL. Otherwise, the user
might think that the requested mode was activated even though a totally
different mode may be still active.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agouterm_video: allow explicitely activating GL ctx
David Herrmann [Wed, 25 Apr 2012 15:35:03 +0000 (17:35 +0200)]
uterm_video: allow explicitely activating GL ctx

We may have to use multiple GL contexts if we mix DRM and fbdev devices.
Therefore, we need explicit GL-ctx management.
We now allow to explicitely activate a specific GL context. This means,
the user needs to use the right GL context before he creates textures or
similar.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agouterm_video: disable egl context on destruction
David Herrmann [Sun, 22 Apr 2012 15:19:55 +0000 (17:19 +0200)]
uterm_video: disable egl context on destruction

Make sure to reset the egl-context before destroying it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agotest_input: use new test_include.h infrastructure
David Herrmann [Sun, 22 Apr 2012 15:07:11 +0000 (17:07 +0200)]
test_input: use new test_include.h infrastructure

test_input compiles again and uses the same helpers as the other tests do.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agotests: remove unneeded tests
David Herrmann [Sun, 22 Apr 2012 14:57:45 +0000 (16:57 +0200)]
tests: remove unneeded tests

test_buffer and test_terminal no longer compile and are not needed so
remove them.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agotest_vt: use new test_include.h code
David Herrmann [Sun, 22 Apr 2012 14:51:28 +0000 (16:51 +0200)]
test_vt: use new test_include.h code

test_vt now compiles again and uses the new infrastructure.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agotest_console: remove
David Herrmann [Sun, 22 Apr 2012 14:42:25 +0000 (16:42 +0200)]
test_console: remove

This test doesn't compile and is no longer needed. We can now use the
kmscon program or test_terminal for the same functionality.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoconsole: avoid unneeded matrix transformations
David Herrmann [Sun, 22 Apr 2012 14:38:53 +0000 (16:38 +0200)]
console: avoid unneeded matrix transformations

We now assume a screen of -1,-1 to 1,1 instead of 0,0 to 1,1 to avoid
matrix transformations.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agofont_pango: add debug messages
David Herrmann [Sun, 22 Apr 2012 14:38:23 +0000 (16:38 +0200)]
font_pango: add debug messages

Add debug messages so we always know what kind of screen is created.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agogl: disable texture stride support
David Herrmann [Sun, 22 Apr 2012 14:37:43 +0000 (16:37 +0200)]
gl: disable texture stride support

This currently does not work properly so disable it. However, we
definitely need to fix this later.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoeloop: fix memory leak for shared signals
David Herrmann [Sun, 22 Apr 2012 13:47:40 +0000 (15:47 +0200)]
eloop: fix memory leak for shared signals

A shared signal owns an eloop_fd object. This has a reference of its
connected eloop. Therefore, we must free a shared signal to drop a
reference to the connected eloop and cannot postpone this to
eloop-destruction. Otherwise, the eloop will never get destroyed.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoeloop: use kmscon_dlist for shared signals
David Herrmann [Sun, 22 Apr 2012 13:47:00 +0000 (15:47 +0200)]
eloop: use kmscon_dlist for shared signals

Move to new list-implementation instead of the single-linked list. This
allows removal of elements in O(1).

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agomisc: add double-linked list implementation
David Herrmann [Sun, 22 Apr 2012 13:43:00 +0000 (15:43 +0200)]
misc: add double-linked list implementation

This adds a generic double-linked list implementation so we don't have to
write all list-handling over and over again.

The list-type is similar to the kernel list where we use the same type for
heads and entries. This is a _very_ convenient list-type so we copy it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agomisc: add type-safe "offsetof"
David Herrmann [Sun, 22 Apr 2012 13:40:39 +0000 (15:40 +0200)]
misc: add type-safe "offsetof"

This uses the GCC extension "typeof" to implement a type-safe "offsetof"
similar to the implementation in the linux kernel.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agomisc: fix header protection
David Herrmann [Sun, 22 Apr 2012 13:39:57 +0000 (15:39 +0200)]
misc: fix header protection

There was a typo in the macros for header protection.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agomisc: add kmscon_hook_num() helper
David Herrmann [Sun, 15 Apr 2012 12:57:17 +0000 (14:57 +0200)]
misc: add kmscon_hook_num() helper

This helper returns the number of registered callbacks for an hook.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agotest_output: always enable all outputs
David Herrmann [Sat, 14 Apr 2012 17:54:45 +0000 (19:54 +0200)]
test_output: always enable all outputs

Instead of accepting a list of outputs we now enable all outputs when
testing the video subsystem.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agotest_output: run eloop for 5s instead of sleep()
David Herrmann [Sat, 14 Apr 2012 17:49:36 +0000 (19:49 +0200)]
test_output: run eloop for 5s instead of sleep()

The new eloop implementation allows to run the eloop for a fixed amount of
time. Use this instead of sleeping for 5s which would prevent us from
catching signals as the eloop blocks them in favor of signalfd.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agotest_output: use new test_include.h header
David Herrmann [Sat, 14 Apr 2012 17:45:11 +0000 (19:45 +0200)]
test_output: use new test_include.h header

The test_include.h header now provides the basic initialization that will
later be used in all other tests. This allows us to use the same
program-parameters that kmscon uses and makes sure everything is
initialized properly before we run the tests.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agotest_output: remove signal handler
David Herrmann [Sat, 14 Apr 2012 17:35:12 +0000 (19:35 +0200)]
test_output: remove signal handler

It will be replaced by the event loop signal handler.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoconsole: remove old font-factory code
David Herrmann [Sun, 1 Apr 2012 17:31:57 +0000 (19:31 +0200)]
console: remove old font-factory code

Remove the code that is no longer needed due to the new font renderer.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoterminal: use new font backend
David Herrmann [Sun, 1 Apr 2012 17:25:54 +0000 (19:25 +0200)]
terminal: use new font backend

Instead of using the slow old font-factory we now use the new font_screen
object which allows faster software rendering with pango/cairo.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoconsole: remove margin_bottom cache
David Herrmann [Sun, 1 Apr 2012 16:17:45 +0000 (18:17 +0200)]
console: remove margin_bottom cache

margin_bottom was always the last index of the scroll-region, in contrast
to cells->mbottom_y which is the bottom margin size. However, this cache
is inconvenient so this replaces all calls to margin_bottom with a correct
immediate calculation of the bottom margin.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoconsole: remove mtop cache
David Herrmann [Sun, 1 Apr 2012 14:12:02 +0000 (16:12 +0200)]
console: remove mtop cache

We can directly access the buffer now so no need to cache the value.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoconsole: remove cells_x/y cache
David Herrmann [Sun, 1 Apr 2012 13:00:47 +0000 (15:00 +0200)]
console: remove cells_x/y cache

We don't need this anymore as we now have direct access to the buffer
structure.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoconsole: add "fixed_position" option
David Herrmann [Sun, 1 Apr 2012 11:08:27 +0000 (13:08 +0200)]
console: add "fixed_position" option

The fixed_position option allows to explicitely keep the scrollback-buffer
position instead of scrolling on new input. This was already the current
behavior but now we can also scroll on new input if this is set to false.

Also fix up the formatting of the comments and remove old information.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoconsole: remove refcnt of buffer object
David Herrmann [Sun, 1 Apr 2012 10:52:54 +0000 (12:52 +0200)]
console: remove refcnt of buffer object

The buffer object is used internally only and should never be shared.
Hence, we can safely remove the refcnt.

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