304 Commits

Author SHA1 Message Date
David Herrmann
54973fb341 uterm_video: set displays after waking up
Set CRTC state correctly after waking up. Otherwise the displays will keep
their previous state until the next redraw.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 16:02:30 +01:00
David Herrmann
ec6e095a64 uterm_video: check online-state before swapping
Check whether the display is online before swapping buffers in DRM
backend.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 16:01:13 +01:00
David Herrmann
ead3172d49 main: use ui subsystem
Use the new UI subsystem in the main application. The kmscon application
provides now the same functionality as the test_terminal application.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 15:44:36 +01:00
David Herrmann
e6d3d3f5b1 ui: add user interface subsystem
The UI subsystem starts the terminals, switches between them and draws the
screen.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 15:44:06 +01:00
David Herrmann
fded606baa input: change callback logic
Allow multiple callbacks and notify all about new input.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 15:22:23 +01:00
David Herrmann
e6db44385b uterm_video: add callback
Allow applications to register callback and notify them about new or gone
displays.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 15:21:57 +01:00
David Herrmann
c04c807eca misc: add hook structure
The hook structure can be used to provide a central hook where other
subsystems can register callbacks.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 15:12:37 +01:00
David Herrmann
a13797ac76 uterm_video: fix drm debug messages
Print more verbose messages on DRM errors.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 14:15:53 +01:00
David Herrmann
00c34e1685 kbd_*: fix log messages
Remove new-lines again and set subsystem automatically.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 13:54:27 +01:00
David Herrmann
84f1883809 xkb: use new API
libxkbcommon-git did some API changes

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 13:42:16 +01:00
David Herrmann
6072a4ea53 test_terminal: parse command line arguments
Parse command line arguments so the input subsystem recognizes the XKB
values.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 13:41:30 +01:00
David Herrmann
75339df698 input: fix kmscon_input_device_wakeup protection
We cannot check for dev->fd as the fd is only set when the input device
has keys. Therefore check for rfd now.
Also remove the NULL check in *_sleep() as it is not needed. All public
APIs allow passing NULL.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 13:20:52 +01:00
David Herrmann
18d829bd39 input: remove refcnt in input-devices
Input-devices are used internally only so we do not need refcounts.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 13:20:01 +01:00
David Herrmann
9f695c042f input: fix log-messages
Remove newline from log-messages and set LOG_SUBSYSTEM to "input". Also
fix some small indentation issues.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 13:19:02 +01:00
David Herrmann
f8dc74c297 conf: add --xkb-XY options
Allow setting XKB options on the command line.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 13:02:48 +01:00
David Herrmann
4c2ff06f31 input: do not wake up if we are not asleep
Check for state == INPUT_AWAKE before performing wakeup.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 12:29:01 +01:00
David Herrmann
e35ca87a95 conf: add --silent
Suppress debug, info, notice and warning messages if --silent is given.
This is overwritten by --debug and --verbose.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 18:38:24 +01:00
David Herrmann
929860217f main: print strerror() on failure
Print error-string if we cannot initialize kmscon.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 18:33:08 +01:00
David Herrmann
8e54ea1f65 main: add proper main application
This is not finished and only implements the basic VT handling +
application initialization.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 18:29:21 +01:00
David Herrmann
83980a7547 vt: fix log messages
Add new improved log messages to the VT subsystem.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 18:29:01 +01:00
David Herrmann
83dc28fcc7 Fix time calculations
eloop.c and log.c use struct timeval to calculate time-diffs but
incorrectly use "-" instead of "+" as the value is already negative.
They also use unsigned integers so fix both occurences.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 18:27:29 +01:00
David Herrmann
5a865fc39b build: add conf.c to build
conf.c was recently added so add it to the build-script now.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 18:26:50 +01:00
David Herrmann
5f1f1710f9 eloop: correctly set ->exit
When exiting a child eloop we should forward the exit to the parent. Also,
we should reset ->exit on ev_eloop_run() otherwise we cannot run multiple
times.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 17:58:19 +01:00
David Herrmann
42631efa2c eloop: add debug messages
Add two debug messages to track eloop behavior.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 17:57:53 +01:00
David Herrmann
6d63b55d6f conf: add --switchvt
--switchvt enables kmscon to automatically switch to the new VT that was
opened by kmscon. If this is the current VT, then this has obviously no
effect.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 17:42:39 +01:00
David Herrmann
c8b247785c conf: fix --help handling
Handle --help same way as -h.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 17:41:52 +01:00
David Herrmann
a4bd71cd0c conf: remove unneeded global initialization
Global variables are initialized to 0 automatically. So remove the
initialization.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 17:40:56 +01:00
David Herrmann
205ab68ff9 eloop: add ev_eloop_run() function
ev_eloop_run() runs the eloop for a given fixed time. If the dispatcher
returns and the timeout isn't reached, then the dispatcher is called
again.
This also adds the *_exit() function which allows to exit the main-loop
and can be called from anywhere (including the callbacks).

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 17:32:45 +01:00
David Herrmann
14b0035f50 eloop: several fixes
Fix parameter validation, fix log_* statements, fix indentation and print
messages on HUP/ERR.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 17:13:01 +01:00
David Herrmann
563492a0c8 eloop: remove fd from epoll-set on HUP
If a handler does not correctly remove itself on HUP, the epoll-loop will
never sleep again because the fd will always be notified as HUP.
Therefore, remove the fd from the epoll-set directly on HUP. This doesn't
change application behavior so it is safe here.

This also allows other subsystems to ignore HUP/ERR events if they are not
fatal. The FD won't be readded but that may not bother.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 16:59:42 +01:00
David Herrmann
56659ce429 eloop: remove ev_eloop_get_fd()
This function was never used so remove it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 16:46:22 +01:00
David Herrmann
cfca84f250 vt: fix callback enum type
We should use the enum type instead of plain "int" to be more verbose
here.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 16:42:04 +01:00
David Herrmann
d19f7ec2f1 conf: add configuration subsystem
The conf-subsystem is used throughout the whole source and provides a
global static read-only configuration. The configuration is read on
startup from the command-line and filesystem and then provided to the
other subsystems.

This is no database, that is, the data is not written to a file on
shutdown!

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 16:13:50 +01:00
David Herrmann
be8fe301f9 eloop: allow an eloop to be an event source
This allows to add one eloop object into another eloop. This is useful if
we want to run a single event source isolated (for instance VT on exit).

The internal epoll-descriptor allows polling so this is a fairly
straightforward implementation.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 16:10:53 +01:00
David Herrmann
af31f251f3 console: merge console_cell.c into console.c
We currently have too much layers in the console subsystem. This reduces
performance and produces ugly hacks like our "*_clear_region" function. We
now merge both files so we can directly access the buffer-structure.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 14:34:55 +01:00
David Herrmann
650c7077f1 Remove old output subsystem
This subsystem is no longer used so remove it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 14:29:25 +01:00
David Herrmann
096f0cadc7 Move to new uterm infrastructure
This fixes all compositor/output/context/etc. uses and replaces them by
the new uterm API.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 14:18:50 +01:00
David Herrmann
911d635e6e gl: add viewport helper
This helper correctly sets the viewport to the size of a screen.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 14:18:28 +01:00
David Herrmann
1dd7198216 test_output: use new uterm/log/etc. subsystems
Convert the test_output test to use the new subsystems.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 13:35:02 +01:00
David Herrmann
a8562c7a5c uterm_video: add *_screen_height/width() helpers
A screen may have a different size than the displays so add these two
hooks.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 13:34:20 +01:00
David Herrmann
564d42fde9 build: define LOG_ENABLE_DEBUG if debugging
Define LOG_ENABLE_DEBUG if we enabled debugging. The log subsystem uses
this to enable the log_debug() statements.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 13:30:36 +01:00
David Herrmann
253ef4850f gl: add debug statements
Add messages about new shader objects.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 13:30:05 +01:00
David Herrmann
4cc8eadd40 uterm_video: take ref-cnt of display in screen object
Inside a screen object we are independent of the lifetime of the displays
so we need to correctly keep references to them.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 12:53:59 +01:00
David Herrmann
25f41f84f7 gl: add GL subsystem
The GL subsystem is copied from the old output_context subsystem and now
provides shader and GL-math. It will replace the old output_context subs
soon.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 12:50:35 +01:00
David Herrmann
50e0cdbec8 uterm_video: include GLES2 headers instead of GL
We use GLES2 for drawing. There is currently no reason to provide full GL
inside kmscon as we use the basic operations only.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 11:49:17 +01:00
David Herrmann
62a3db3e9c uterm_video: add dummy fbdev backend
The fbdev backend is non-functional, but we add it for documentational
purposes. It is not built as part of kmscon.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 11:46:39 +01:00
David Herrmann
95e434eddb uterm_video: add DRM backend
uterm_video can work with any backend so we need a DRM backend to get the
same functionality as our previous compositor/output API.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 11:45:49 +01:00
David Herrmann
8e2af97038 uterm: new video backend
Our old backend was hacked together and hadn't have any structure. This is
a new approach to create the uterm-library inside kmscon. The
uterm-library will contain everything that is needed to run an application
on Linux DRM devices without X11 or Wayland support.

The idea is to move the input subsystem to uterm, too. No other stuff is
currently planned to be included in uterm.

Although uterm is supposed to be a separate library, we do not build it as
such library. We currently include the log-subsystem and the
eloop-handlers in the library so we cannot build it as stand-alone
library. However, we try to keep it separate so if we ever need to export
it, then it should be a one-hour job to do it so.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 11:26:04 +01:00
David Herrmann
7eafca0e9f log: rewrite log subsystem
The new logger is much more powerful, allows online log-filter
modifications and precise debugging. We still avoid heavy file-operations
as we rely on the caller to forward stderr to a log-file and perform
log-rotations. However, we now provide a simple way to perform this
forward inside the application.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 11:11:46 +01:00
David Herrmann
4790d9f7ab eloop: move prefix to "ev_" instead of "kmscon_"
The long "kmscon_" prefix is horrible so move everything to "ev_" now.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-20 19:08:29 +01:00