81 Commits

Author SHA1 Message Date
David Herrmann
6648029d5f test_input: fix using XKB directly
We removed a lot of helpers from uterm-input because XKB is now a
mandatory dependency. So use it directly from test_input to avoid all the
uterm helpers.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-09 13:56:30 +02:00
David Herrmann
c77e3d8c0c test_input: fix compilation with changed input API
We dropped unused modifiers so we have to fix test_input not to print them
out.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-01 14:07:23 +02:00
David Herrmann
c43d1ca722 kmscon: allow paths with --vt=<xy>
The getty variants out there (including agetty) require an relative path
to the /dev directory as argument. This is really odd but we want to be
backwards-compatible to them so we allow this, too.

--vt now accepts:
  * A positive number which is internally converted into /dev/ttyXY
  * A string that does not start with '/' or '.' which is interpreted
    relative to /dev as /dev/%s
  * Everything else is interpreted as path

This option still selects only the TTY on seat0. On all other seats we do
not use controlling TTYs.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-30 19:13:02 +02:00
David Herrmann
e39aa6533f test_vt: fix compilation with new allocation API
We changed the uterm API so we need to fix this test again.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-30 15:15:06 +02:00
David Herrmann
be4cd8edd0 test_key: add small helper for client-side key-input
We sometimes need to test what keys a client receives when specific keys
are pressed. This small helper simply runs in a terminal and receives raw
keyboard input and prints it to stdout with debugging information.

This can definitely be improved with the help of the TSM state-machine to
print more useful information and directly parse the input. However, this
is better than nothing.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-20 13:16:32 +02:00
David Herrmann
fc913dd238 test_vt: fix using correct uterm API
This still uses the old VT API which now fails as we added a new
parameter. As a side-effect, this test will not work if used on a VT-less
system or on a seat without VTs. But we actually don't care, yet, as any
other VT-replacement isn't really production-ready, yet.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-29 17:59:21 +02:00
David Herrmann
2841558f7c test_output: add --dev parameter
The --dev parameter is used to specify the device that is used for
testing.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-12 13:30:51 +02:00
David Herrmann
e20283217b tests: make all tests use the new conf-parsers
This allows the tests to have their own command-line parsers. Finally!

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-11 22:43:13 +02:00
David Herrmann
ea62198b6e test_output: always use blitting backend
This removes the currently non-working OpenGL test and always uses the
blitting functions.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-11 13:21:15 +02:00
David Herrmann
023fb41bb4 test_output: add blitting support
When opengl rendering is not available on the target device, we now fall
back to software rendering. Instead of drawing a nice gradient we now draw
a white screen to the target device to avoid heavy calculations.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-31 10:31:40 +02:00
David Herrmann
20e0e69253 test_input: fix compilation for kbd_keysym_to_string()
Since we moved to a runtime backend system for the input subsystem, we
cannot access the internal keysym_to_string() helpers anymore. Hence, use
the recently introduced uterm-input forwarding helper.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-31 10:01:32 +02:00
David Herrmann
8256ef6686 tests: fix tests to compile again
Whoops, I totally forgot about them. Fix the headers to be compatible with
eloop again.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-07 13:45:29 +02:00
David Herrmann
51bfe9d107 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>
2012-05-27 16:41:19 +02:00
Ran Benita
06885d2dd6 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>
2012-05-26 14:49:06 +02:00
David Herrmann
14ab49d985 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>
2012-05-26 07:24:47 +02:00
David Herrmann
bb1eee8a0f 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>
2012-05-17 16:31:38 +02:00
David Herrmann
efcc519458 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>
2012-05-05 22:49:29 +02:00
David Herrmann
3acc23c932 test_input: use new input API
Use new uterm_monitor and input API instead.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-05 22:48:15 +02:00
David Herrmann
3c6d3ed468 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>
2012-04-22 17:07:11 +02:00
David Herrmann
508a3be363 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>
2012-04-22 16:57:45 +02:00
David Herrmann
1081c76274 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>
2012-04-22 16:51:28 +02:00
David Herrmann
a34a107723 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>
2012-04-22 16:42:25 +02:00
David Herrmann
f307f145a8 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>
2012-04-14 19:54:45 +02:00
David Herrmann
24f189a31a 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>
2012-04-14 19:49:36 +02:00
David Herrmann
7a27de465b 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>
2012-04-14 19:45:11 +02:00
David Herrmann
b56ec68a91 test_output: remove signal handler
It will be replaced by the event loop signal handler.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-04-14 19:35:12 +02:00
David Herrmann
c9ea08d9b5 unicode: use static global symbol table
A symbol table should never be created twice therefore we can make it
static and global. We add locks so it is totally thread-safe, too.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-29 16:17:55 +02: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
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
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
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
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
Ran Benita
d8cf293c94 build: implicitly include config.h
config.h is meant to be around in all files, as it contains stuff like
_GNU_SOURCE, NDEBUG and HAVE_*.

Make these definitions available without needing to #include config.h
every single time.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-20 19:00:16 +01:00
David Herrmann
2b8caca91c console: remove *_buffer_newline()
This function is no longer needed as we now have proper scrolling
functions. This also adjusts the buffer tests to be more appropriate.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-04 14:34:33 +01:00
David Herrmann
ff408d6fb9 test_buffer: add margin tests
Modify the buffer test to add margin tests.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-03 18:43:56 +01:00
David Herrmann
af3a1f3e50 console: move kmscon_console_rotate to *_newline
We do no rotation so rename the function to the more appropriate name
kmscon_console_newline.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-02 17:01:54 +01:00
David Herrmann
2ddd47e858 test_buffer: add utf8 state machine test
Add trivial test to show how to use the utf8 state machine.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-29 14:21:19 +01:00
David Herrmann
79e1ada7e5 vte: handle keyboard input (stub)
Make the vte subsystem handle the keyboard input instead of doing this
inside of test_terminal.

The handling is just a stub function. No actual keys are parsed yet.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-28 22:14:20 +01:00
David Herrmann
da0623c260 terminal, pty: pass eloop reference on obj creation
There is no reason to pass the eloop reference late at terminal/pty
open. If we pass it early on object creation we will always have a valid
reference and can remove several code paths.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-28 13:56:13 +01:00
David Herrmann
bd09f38a4d log: move log_warning to log_warn
log_warn is much shorter and we already use log_err instead of log_error
so this is more consistent now.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-24 15:29:55 +01:00
Ran Benita
5cc190d947 test_terminal: wait on children to avoid zombies
Unfortunately, there is no clean way I see to hook this up from the pty
object. We can (and will) have more than one pty object opened at a
time, but the semantics of signalfd make it impossible to deliver each
SIGCHLD to its rightful owner without complicating things.

[ From what I tested:
 - If you have two signalfd's listening to the same signal, they will be
   dispatched in some round-robin manner.
 - Also, if more than one child exits before we read signalfd (possibly
   beloging to different terminals), they will be compressed to one
    event. ]

We therefore need to do the reaping from a central location, and need to
remember to copy this snippet over to main.c in the future.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-24 15:06:51 +01:00
Ran Benita
6ebc7c1892 terminal: use new pty object
Add a new terminal_open/terminal_close methods to correspond to the pty
ones, and notify when the terminal is closed.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-24 15:04:06 +01:00
Ran Benita
582ee16d31 test_input: simplify and drop xkbcommon dependency
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-23 13:51:50 +01:00
David Herrmann
5a3801386a font: rewrite font backend
We now properly draw fonts with OpenGL. We now use FreeType2 instead of
pango to avoid big dependencies.

We also add a DejaVu font so we currently don't have to deal with font
selection.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-22 22:44:12 +01:00
David Herrmann
e5f5c2729a font: require compositor reference
To avoid cairo dependencies we now take a compositor reference in the
font backend so fonts can be drawn with GL textures instead of cairo.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-22 13:51:23 +01:00
David Herrmann
7085084b1d context: use GL_TRIANGLES instead of GL_QUADS
GL_QUADS may actually be not supported on some embedded platforms so we
use GL_TRIANGLES.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-20 16:11:30 +01:00
David Herrmann
83cec439c6 console: use new drawing pipeline
Instead of drawing with fixed-function GL pipeline we now use our own
shader for texture drawing. This also fixes test_console to no longer
depend on GL.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-20 15:45:58 +01:00
David Herrmann
05a1747f00 console: take reference of compositor
To switch to the new drawing subsystem we need a reference to a valid
compositor object so we can retrieve the GL context.
This also applies to the terminal object.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-18 18:09:08 +01:00
David Herrmann
cabde245df test_output: use new drawing pipeline
This converts the output test function to use the new kmscon_context for
drawing operations so we no longer depend directly on GL.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-18 16:26:57 +01:00
Ran Benita
01e469b9ec test_console: fix use-after-free
Here's how it goes:
1. stdin reaches EOF, kmscon_eloop_rm_fd is called on stdin_fd.
2. The fd object is freed, the memory is reused in the meantime.
3. rm_fd is called again in destroy_eloop.
4. con->stdin_fd points to garbage and we get a segmentation fault.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-09 20:20:58 +01:00