Commit Graph
1208 Commits
Author SHA1 Message Date
David Herrmann fb08eea373 uvtd: vt: implement VT_GETMODE/SETMODE ioctl state-tracking
These ioctls are used to retrieve and set the VT-mode. That is, the
signals and PID information that correspond to the VT controlling process.
It is notified whenever the VT gets active/inactive so it can react to it
or prevent/acknowledge it.

This doesn't implement the signal-sending logic, yet. It only implements
state-tracking.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-03-06 19:03:34 +01:00
David Herrmann 066d9fdb78 uvtd: seat: implement session IDs
Session IDs provide a unique ID for each registered session. They are used
to sort the sessions so next/prev return the correct neighbour-sessions.
Furthermore, they can be used by outside users to refer to a session
directly without knowing the session implementation.
Sessions with ID=0 are always linked at the end and considered to be
"unnamed".

The algorithm to switch to a session with a given ID is:
  Try to find the first session with the exact same ID. If there is none,
  return the session with the next higher ID. If there is none, return the
  ID'th session in the list. If there is none, return the last session.

This provides a fairly predictable way of switching between session. It is
modeled after the classic VT F1-F12 keys that switch between sessions. If
a session is not given, these keys will switch to the next higher session
instead.
All "unnamed" sessions are put at the end. So if you have only F1-F4, then
F5-F12 will map to unnamed sessions.

Please note that new sessions are always linked at the end of their group.
So new unnamed sessions are at the far end, new named sessions are linked
in the sorted list but behind all sessions with the same ID.
Hence, the caller should avoid multiple sessions with the same ID,
otherwise, some sessions might not be reachable even though they're named
(unless you use next/prev of course).

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-03-06 18:21:25 +01:00
David Herrmann 5c7184f797 uvtd: vt: implement ioctl dummies
Add dummies for the ioctl VT callbacks. Also implement the KD-MODE and
KB-MODE state tracking as it is fairly trivial.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-03-06 17:33:39 +01:00
David Herrmann 724afe8c1a wlt: theme: prevent move/resize requests when maximized/fullscreen
We should let the user move or resize the window while it is fullscreen or
maximized. This depends on the compositor to stop pending move/resize
requests when maximizing or setting a window fullscreen.

We can implement some "snap away from edges" behavior that allows to move
or resize while maximized. This will "unmaximize" the window if you move
it more than a given threshold. However, that's not needed now so lets do
that later when the wl_shell system is fully figured out.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-03-06 16:30:31 +01:00
David Herrmann 96a82433b0 wlt: toolkit: add is_maximized/fullscreen helpers
These helpers return whether a window is maximized/fullscreen. This can be
used by the theme/terminal control layer to change behavior depending on
these flags.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-03-06 16:29:14 +01:00
David Herrmann e4d25266b0 tsm: vte: fix g0-g3 character-set shifting
A terminal's GL and GR sets can be mapped to 4 different registers g0 to
g3. The g0-g3 registers can be freely set by the application to predefined
or uploaded character-sets.

We implemented GL and GR as separate registers that are set to the current
g0-g3 states when the applications requests a remapping. So subsequent
changes to g0-g3 don't affect GL and GR. Unfortunately, it turns out this
is wrong. GL and GR should point to the g0-g3 registers instead of copying
them.

This commit fixes the GL and GR pointers to point to g0-g3 instead of
pointing to the underlying character sets. This fixes line-drawing
applications like alsamixer, make-menuconfig and other ncurses based
software.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-03-06 11:12:47 +01:00
David Herrmann e668e9b6cc uvt: client: implement major ioctl callbacks
Add callbacks for all major ioctls. We currently only implement ioctls
that are used by xserver on linux machines. Feel free to implement the new
ioctls.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-03-05 19:13:31 +01:00
David Herrmann 4307d9baf1 uvtd: ctx: link control/legacy nodes with VTs
We now create a VT for each legacy node and assign all clients to it. For
control nodes, we create a different VT for each open-file/client.

Note that we do not recreate VTs or CDEVs directly on HUP instead of
during the next open() or reconfiguration. This avoids trapping into the
same error again and gives control to the user to recreate the nodes at
the right time.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-03-05 18:05:09 +01:00
David Herrmann e28da46b05 uvtd: add VT subsystem
The VT subsystem manages the virtual VTs and registers them with the
seat/session-scheduler. They manage control and legacy nodes as they are
mostly the same.

The different contexts create these VTs and assign them to cdev clients.
This allows us to split the VT and cdev logic apart so they can be
assigned freely to different clients.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-03-05 18:03:18 +01:00
David Herrmann 25736f8363 uvt: client: export symbols
This adds the uvt_client symbols to the public symbol list and exports
them so we can use them in uvtd.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-03-05 18:02:18 +01:00
David Herrmann fdf1321fc7 uvt: client: fix double-kill by first unlinkink then resetting
We _must_ unlink the client and cdev first, then reset the VT. Otherwise,
the set_vt() call might think we are still alive and call user-defined
callbacks which might call kill again.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-03-05 18:00:50 +01:00
David Herrmann a9219924c8 uvt: include inttypes.h
We use uint8_t so make sure we include inttypes.h in uvt.h.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-03-05 18:00:09 +01:00
David Herrmann c56f5fcb4d uvtd: add ctx subsystem
The ctx subsystem manages the CDEV devices for each seat. It currently
allocates one manager device and a given number of legacy devices that can
be accessed via subdirectories.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-03-05 01:32:45 +01:00
David Herrmann e28c39c4fb uvt: ctx: add major/minor helpers
Two new functions to retrieve the current major number and dynamically
allocate minor numbers.
This can be used by clients that allocate more than one CDEV for VTs to
dynamically retrieve a new minor number.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-03-05 01:31:27 +01:00
David Herrmann e62850ded5 uvt: add SHL_EXPORT to cdev+ctx subsystems
We need to export the symbols to make use of them. This exports all useful
ctx+cdev functions for outside use. The other subsystems still need to get
reviewed before we export them.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-03-05 01:27:32 +01:00
David Herrmann fdf045317f uvt: cdev: fix sending DEVNAME parameter
We used an incorrectly formatted arguments as we mixed up two local
variables. Use the correct DEVNAME format now.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-03-05 01:25:01 +01:00
David Herrmann 0cb9f3b505 uvt: cdev: print minor/major debug messages
These numbers are pretty useful during debugging so print them before
attempting to create the cdev devices.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-03-05 01:24:17 +01:00
David Herrmann 61d88ec9c8 shl: add flagset helper
A flagset is a dynamic array where each bit of the array can be
independently set/reset. It can be used for minor/major allocations or
for other dynamically growing bitsets.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-03-05 01:22:55 +01:00
David Herrmann 3c7956e45a shl: dlist: add _first/_last helpers
These helpers return the first and last elements respectively.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-03-05 01:22:13 +01:00
David Herrmann b8f58fea9c shl: array: add shl_array_zresize()
This helper resizes the array to a given length and zeroes out all new
elements.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-03-05 01:21:29 +01:00
David Herrmann 176a0e8be5 uvtd: add new Virtual Terminal daemon
This introduces uvtd which replaces kmscon sessions as an external helper
program. It's still a dummy program but it will get extended soon. After
that, kmscon sessions will get removed and limited to a single seat. This
will simplify kmscon itself heavily and move rarely used features out of
kmscon into helpers.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-03-04 15:11:30 +01:00
David Herrmann 9c2375b6d4 shl: move githead into a source file
This moves githead.h to shl_githead.c so we can skip recompilations on
GIT-HEAD changes. We only need to relink now (which we cannot skip).

This speeds up build-processes considerably on slower machines.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-03-04 15:05:17 +01:00
David Herrmann 0249b2cb0b shl: move log.[ch] to shl_log.[ch]
We want to avoid any static files that are shared between multiple
programs but are not part of SHL. These make the build-process just more
complex.
Move log.[ch] to SHL so we have a known context.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-03-04 14:40:36 +01:00
David Herrmann f14fde004f log: move includes to top
There is no reason to include headers in the main body of the source code.
Move it to the top so it's more readable.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-03-04 14:27:27 +01:00
David Herrmann 068119a6c3 uvt: new library implementing VTs in user-space
UVT is based heavily on the old cdev-sessions. It uses CUSE/FUSE to
implement virtual terminals in user-space.

This move into a library allows to use it in other projects, too. There is
no reason to limit it to kmscon sessions. In fact, we will remove the
cdev-sessions, soon and make kmscon a stand-alone terminal emulator
without any session capability.
Instead, the uvtd program will provide the VT emulation.

This library is not finished, nor ready for use. However, feel free to
contribute patches so we can eventually release a stable API.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-02-27 19:44:55 +01:00
David Herrmann 67355db150 shl: misc: provide shl_next_pow2()
Move the next_pow2() helper to shl_misc.h so we can use it everywhere.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-02-18 19:17:49 +01:00
Jakub Wilk 37f88bd384 Fix several typos
Provided via github. Fixes typos in documentation and comments.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-02-11 16:24:21 +01:00
David Herrmann 577a9b4c41 llog: add "data" parameter to pass context
If we allow users to specify log functions, we should also allow them to
pass a context. This isn't used internally, but may be needed by external
users so provide it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-02-08 16:14:48 +01:00
David Herrmann 5ef32794c6 font: freetype2: include tsm_unicode.h
We use TSM symbols so include the right headers.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-02-06 15:19:21 +01:00
David Herrmann fc4865ed03 font: unifont: compress binary data and link via ld directly
Instead of using the blown up UTERM_FORMAT_GREY binary data, we now use an
A1 1bit alpha channel and extract the data during runtime. This guarantees
that only used characters will be extracted into the full alpha channel.

We should add support for A1 formats in uterm to avoid this problem
entirely.

We also now link the binary file directly into the module via ld. This
avoids the long compile times for the huge C-array that we previously
generated. As a side effect, you no longer run out of memory linking this
file on small machines.

With this change we could even start making unifont a default font-backend
as it now works pretty well.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-02-06 15:16:09 +01:00
David Herrmann aad2715cf4 build: major cleanup
Major overhaul of the build system. This introduces symbol-versioning for
all exported libraries. Please note that none of these libraries is
stable, yet!

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-02-06 01:22:10 +01:00
David Herrmann 8a2413d76a conf: remove unused CONF_DONE
This flag was never used and is mostly useless, so remove it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-02-05 12:40:03 +01:00
David Herrmann 8a00e39854 conf: fix include-protection name
We use CONF, not CONFIG as prefix so fix the include-protection to use
this, too.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-02-05 12:38:45 +01:00
David Herrmann 6a674402ea conf: perform aftercheck on ctx-copy
Afterchecks should be always performed when reading data into a config
context. So perform them after copy operations, too.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-02-05 11:45:33 +01:00
Martin Minarik 7dd5bf25fc wlt: toolkit: fix stuck key repeat bug
1. Depress Shift
2. Depress K
3. Release Shift
4. Release K

Observed: key stuck repeat
Expected: key not stuck repeating

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-01-27 15:27:13 +01:00
David Herrmann 4f8edb38c8 wlt: link font library statically
We need the font layer to build wlterm. However, the font layer depends on
kmscon internal module handling so we cannot do this. To avoid this, we
simply provide dummy handlers for the kmscon_module_* layer and link it
anyway. This is kind of ugly but works, yey!

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-01-24 20:32:40 +01:00
David Herrmann 6a7cbd8fc0 wlt: fix shl_hook API changes
We changed the hook_add() API but forgot to fix WLT to use the new API.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-01-24 20:17:26 +01:00
Martin Minarik e0f798071c wlt: toolkit: fix resize window stuck in need_resize=true
The problem is that:
 wnd->w_frame contains a number
and
 wnd->need_frame=true
Therefore schedule_frame() doesn't schedule the callback.
But deleting these checks causes flicker. Further redesign
of the frame sheduling was necessary.

4. frame_callback()
3. do_frame()
3. idle_frame()
2. schedule_frame()
1. wlt_window_set_size()

Please, observe the need_resize variable.
-------------------------------------------------------------------------------
BAD (window stuck on resize):
$3 = {ref = 1, list = {next = 0x659c70, prev = 0x659c70},
  buffer_attached = true, skip_damage = false, need_resize = true,
  w_frame = 0x70d9b0, widget_list = {next = 0x686cb0, prev = 0x6b54d0}}

OK (window not stuck on resize):
$3 = {ref = 1, list = {next = 0x240cc70, prev = 0x240cc70},
  buffer_attached = true, skip_damage = false, need_resize = false,
  w_frame = 0x241bb10, widget_list = {next = 0x2439cb0, prev = 0x2468560}}

-----------------------------------------------------------------------------------

This is the basic idea:

-> time ->
frame callbacks()      *           *           *           *           *           *
wnd->idle_pending ------   ---------   ---------    --------   ---------------------
wnd->need_frame   ---      --- ---     ---          ---        ------ ---
schedule_frame()  *        *   *       *            *          *  *   **
idle_frame()        *        *   *       *            *          *  *   *

This design follows similiar design in weston/clients/window.c

Kmscon                     Weston
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
wlt_window_do_redraw() ~~~ shm_surface_swap()
do_frame() ~~~~~~~~~~~~~~~ window_attach_surface()

wnd->idle_pending ~~~~~~~~ window->redraw_scheduled

frame_callback()  ~~~~~~~~ frame_callback()

do_frame()  ~~~~~~~~~~~~~~ idle_redraw()

wlt_window_set_size()
wlt_window_schedule_redraw()
schedule_frame()  ~~~~~~~~ window_schedule_redraw()

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-01-24 20:13:09 +01:00
David Herrmann 0f206cc5b5 uterm: drm: rename to drm3d
This renames the video-drm backend to drm3d (which was already used
internally). This is a pure rename, the code-logic stays the same.

This also puts the drm3d backend into a module so we can more easily
load it during runtime.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-01-24 16:42:03 +01:00
David Herrmann f289349ef9 uterm: rename drm-dumb backend into drm2d module
This moves all the drm-dumb code into a new module that is now called
drm2d (which was already used internally before).

No conceptual changes, just renames and moves.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-01-24 14:42:54 +01:00
David Herrmann ae25adc34f text: pixman: add support for non x4-stride glyphs
pixman expects stride values to be a multiple of 4. However, the glyphs we
get may be of a different stride so copy it if it is.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-01-24 14:11:22 +01:00
David Herrmann 7ca44910c2 text: pixman: remove debug tests
The "true ||" case made pixman always use shadow buffers. Remove this
debug statement so it works as expected.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-01-24 14:10:43 +01:00
David Herrmann 048576a85c text: pixman: special case rendering for known bg/fg colors
We can preallocate a white solid-fill image so we don't have to do that
for each round where we blend white glyphs.

Also, if the background is black, we can omit the pixman_fill() operation
and use the direct composite with SRC operations.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-01-24 14:09:17 +01:00
David Herrmann 0344686417 uterm: dumb: optimize division by 255 in rendering path
This was recommended by Soren Sandmann on the pixman ML. We can optimize a
real t /= 255 with:
  t += 0x80
  t = (t + (t >> 8)) >> 8;
Instead of using a single fake (t >> 8) shift as we used to.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-01-24 14:04:58 +01:00
David Herrmann 717e193ea1 text: cairo: fix debug message to print correct values
We need to print the actual stride+buffer instead of the first set values.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-01-24 14:04:04 +01:00
David Herrmann 79c5ba7185 kmscon: add pixman renderer
This is an experimental renderer based on pixman. It is only available for
testing-purposes and should not be used in production, yet. The bbulk
renderer is still the faster alternative and should be used instead.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-01-24 12:13:29 +01:00
David Herrmann d72e44e9a1 uterm: fbdev: fix wakeing up displays
The dfb->disp pointer is not used so the current fbdev backend doesn't
wake up displays on video-wakeup. Fix this by traversing the new display
list (even though we currently have only one display at most).

Also remove th dfb->disp pointer as it is unused now.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-01-24 10:24:18 +01:00
David Herrmann 26ce0994e3 uterm: video: print debug messages on wakeup/sleep
This helps debugging video sleep/wakeup issues.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-01-23 19:31:43 +01:00
David Herrmann 0a3c34ca0e kmscon: add cairo-renderer module
The cairo text renderer uses the cairo blitting functions to blit all
glyphs into the cairo-surface. This is only for testing-purposes. Cairo is
not really suited for blending/blitting of large surfaces. Hence, this
backend is horribly slow compared to bblit/bbulk.

This backend is disabled by default.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-01-15 16:30:49 +01:00
David Herrmann 2fd3afc10b uterm: fbdev: map FBs for read access
We want to provide read-access to users of get_buffers() so map memory
with PROT_READ. However, read is almost always horribly slow so this
should only be used as fallback.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-01-15 11:09:32 +01:00