1089 Commits

Author SHA1 Message Date
David Herrmann
881026ad31 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>
2012-10-27 13:55:54 +02:00
David Herrmann
9015f3107d 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>
2012-10-27 13:41:23 +02:00
David Herrmann
89e84aa78c 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>
2012-10-27 13:25:44 +02:00
David Herrmann
2c5e9bff2b 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>
2012-10-26 18:08:35 +02:00
David Herrmann
eaffe90061 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>
2012-10-25 14:47:32 +02:00
David Herrmann
a0a9a7f9b4 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>
2012-10-24 18:52:54 +02:00
David Herrmann
8b30e6cf11 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>
2012-10-24 17:01:44 +02:00
David Herrmann
031e9a9039 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>
2012-10-24 17:00:48 +02:00
David Herrmann
b9743bb75c 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>
2012-10-24 15:46:19 +02:00
David Herrmann
37d3499fb5 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>
2012-10-24 15:45:21 +02:00
David Herrmann
069e467913 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>
2012-10-24 15:25:23 +02:00
David Herrmann
1cd2e00bc1 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>
2012-10-23 13:22:06 +02:00
David Herrmann
6b8006a530 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>
2012-10-23 13:21:27 +02:00
David Herrmann
55410d376a 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>
2012-10-23 13:18:42 +02:00
David Herrmann
0cd57e21ae 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>
2012-10-23 12:32:37 +02:00
David Herrmann
936992298c 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>
2012-10-23 12:06:55 +02:00
David Herrmann
d4529d735a 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>
2012-10-23 12:05:42 +02:00
David Herrmann
8923fe2123 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>
2012-10-23 11:45:43 +02:00
David Herrmann
6aeae8be93 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>
2012-10-23 11:41:34 +02:00
David Herrmann
8a4ddda742 Merge branch 'github/master'
Merge upstream development into the config-rework.
2012-10-23 11:39:24 +02:00
David Herrmann
696adf965a 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>
2012-10-23 11:35:49 +02:00
David Herrmann
338e1ee063 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>
2012-10-22 14:00:39 +02:00
David Herrmann
9e0db18fb9 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>
2012-10-19 17:18:58 +02:00
David Herrmann
d40b23d789 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>
2012-10-19 16:51:01 +02:00
David Herrmann
78cf66f087 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>
2012-10-19 16:19:26 +02:00
David Herrmann
06c6e56d4c 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>
2012-10-19 16:15:34 +02:00
David Herrmann
228a99d4bc 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>
2012-10-18 18:57:47 +02:00
David Herrmann
32677b496e 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>
2012-10-18 16:49:49 +02:00
David Herrmann
c1536ad6b1 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>
2012-10-18 15:10:42 +02:00
David Herrmann
613abadb4b 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>
2012-10-18 14:48:09 +02:00
David Herrmann
5cd14efb80 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>
2012-10-18 14:22:55 +02:00
David Herrmann
35d7cc33ec 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>
2012-10-18 13:45:49 +02:00
David Herrmann
18b0011d55 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>
2012-10-18 13:28:10 +02:00
David Herrmann
ebce60a86a 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>
2012-10-18 13:15:41 +02:00
David Herrmann
d3b718f187 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>
2012-10-18 13:14:16 +02:00
David Herrmann
9946a9e458 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>
2012-10-18 11:50:57 +02:00
David Herrmann
c22fac0129 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>
2012-10-18 11:48:30 +02:00
David Herrmann
94f11b18b9 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>
2012-10-15 22:59:31 +02:00
David Herrmann
3254848124 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>
2012-10-15 22:53:55 +02:00
Ran Benita
33274c5e7e COPYING: remove no longer relevent sections
All of the (xkb) keyboard handling code was written by David and me;
even the old code was not based on xlib but written against the
specification (not entirely correct, too). All of this logic was moved
to libxkbcommon, which we merely link against.

We also no longer carry our own uterm_keysyms.h file, so that section is
not relevant either.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-15 21:18:45 +02:00
Ran Benita
d2600527a7 external: remove unused imKStoUCS files
We needed these files before libxkbcommon had a function to convert
keysyms to unicode, and then for the 'plain' keyboard backend, which
didn't use libxkbcommon. Since this backend was removed, these files are
no longer needed.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-15 21:18:14 +02:00
David Herrmann
3ad2996e27 kmscon: add wayland-session support
This adds a wayland compositor which registers sessions for each top-level
window within kmscon. This means, you can run any arbitrary
wayland-application on kmscon. Each top-level window that is registered by
the applications is put into a separate session and you can switch between
the sessions with the previously introduced session-shortcuts.

The compositor is still very basic. It doesn't support input devices at
all (not even talking about DnD). The only thing it does is surface
management (and even that is not fully implemented).

However, this shows the direction that kmscon will go. You can run the
Wayland "simple-shm" and "simple-egl" demos on kmscon to see how it works.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-15 18:10:27 +02:00
David Herrmann
488f7abac0 seat: allow session-switching with keyboard
This adds two new grabs to switch sessions within kmscon. They are set to
ctrl+alt+Left/Right by default.

To improve debugging, we also add some log-messages to session management.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-15 18:02:12 +02:00
David Herrmann
22e63dbdba shl: dlist: add *_but_one() loops
The *_but_one() variants of dlist-loops start from within a loop instead
of at the head and iterate over all elements except the start-element. The
start element is skipped as we would need a temporary variable to include
it and in most times you want to skip the start-element, anyway.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-15 17:56:44 +02:00
David Herrmann
52edafe08c conf: allow multiple grabs and keysyms per grab-option
We allow users to specify grabs on the command-line or in config-options.
We sometimes want multiple grabs to do the same. Therefore, this changes
the grab-parser and handlers to allow this.

Furthermore, this adds support for keysyms that are assembled of multiple
syms. This isn't needed by any keymap, yet, but might be used in the
future.

Last but not least, you can also specify modifiers only now. This might be
used by subsystems to use the default keysyms but let the user specify
what modifiers should be used.
However, be careful when specifying modifiers-only for normal grabs as
this means the grab is executed everytime the modifier is reported with
_any_ key.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-15 17:30:27 +02:00
David Herrmann
acba8f0177 uterm: video: fbdev: fix setting current-mode on activation
We must not recreate a video-mode if we re-activate an fbdev display after
wake-up. Otherwise, the "current" pointer changes and users might get
confused. We guarantee that the "current" pointer stays the same during
operation as we currently do not support changing display size without
reactiating the display.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-15 14:25:59 +02:00
David Herrmann
c1256560d1 uterm: video: use generic timer if vblank events are not available
fbdev does not provide any vertical-blanks so this introduces a generic
framework for uterm-videos as replacement. We simply schedule a timer
event that fires after a fixed timeout. This allows other subsystems to
rely on the page-flip event to occur either at the next real page-flip or
at a fixed timeout. As this is what we want in most places, we just
implement it inside of uterm. So relying on page-flips no longer hogs the
CPU because swap() generates the right away.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-15 13:22:42 +02:00
David Herrmann
efd00b154e uterm: video: add display callbacks
Users might be interested in vertical-blank events so we now allow them to
register event-callbacks on displays. The only event that we currently
pass is a page-flip event that is always sent as reaction to a swap. If
there is no hardware support for such events, we simply throw it from
within the swap() function.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-15 12:26:03 +02:00
David Herrmann
6636bc6ca3 uterm: video: add display_fill/blit helpers
Instead of requiring to create uterm-screens, it is now possible to blit
and fill displays directly similar to fake-blends.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-13 16:48:09 +02:00
David Herrmann
8cc97f6913 seat: fix activating only enabled seats during session-switch
If we deactivate a session, we must not activate the next session we find
but we need to look for an enabled session instead.
This also changes the session_deactivate() helper to allow deactivating
disabled sessions. This shouldn't be relyed on, but it is a safe fallback
if some session turns out to be disabled but still active.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-12 15:56:18 +02:00