platform/upstream/kmscon.git
11 years agoshl: dlist: add _first/_last helpers
David Herrmann [Tue, 5 Mar 2013 00:22:13 +0000 (01:22 +0100)]
shl: dlist: add _first/_last helpers

These helpers return the first and last elements respectively.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
11 years agoshl: array: add shl_array_zresize()
David Herrmann [Tue, 5 Mar 2013 00:21:29 +0000 (01:21 +0100)]
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>
11 years agoREADME: fix tarball-link to /software/kmscon
David Herrmann [Mon, 4 Mar 2013 17:42:34 +0000 (18:42 +0100)]
README: fix tarball-link to /software/kmscon

We now have official upload space on freedesktop.org. No need to link to
my personal upload space, anymore.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
11 years agobuild: add .xz files to gitignore instead of bz2
David Herrmann [Mon, 4 Mar 2013 15:07:52 +0000 (16:07 +0100)]
build: add .xz files to gitignore instead of bz2

We use .xz now instead of .bz2 for release tarballs.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
11 years agodocs: fix links to point to freedesktop.org
David Herrmann [Mon, 4 Mar 2013 15:05:34 +0000 (16:05 +0100)]
docs: fix links to point to freedesktop.org

kmscon is now hosted on freedesktop.org. Please don't use the github
links, anymore. I will push to github for some more weeks, but I recommend
to everyone to use my freedesktop.org repository as primary upstream link.

There were many reasons why github.com wasn't sufficient, anymore. But the
main reason is that they no longer provide upload space for release
tarballs. Hence, lets ditch github and move to freedesktop.org which
kindly provides everything we need plus a really nice mailing-list.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
11 years agobuild: use xz tarballs instead of bz2
David Herrmann [Mon, 4 Mar 2013 15:04:15 +0000 (16:04 +0100)]
build: use xz tarballs instead of bz2

xz is way better than bz2 with same/better decompression times.
Compression will take longer, but that's totally ok.

All new tarballs will be provided as xz only. Please adjust your
build-scripts to stop using bz2.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
11 years agobuild: add --enable-all
David Herrmann [Mon, 4 Mar 2013 14:32:01 +0000 (15:32 +0100)]
build: add --enable-all

This flag enables all other options that extend the build. It is used for
debugging only and should never be used by distributions to control what
is built. Hence, we don't document it and never advertise it.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
11 years agotests: use new shl_log.h
David Herrmann [Mon, 4 Mar 2013 14:29:48 +0000 (15:29 +0100)]
tests: use new shl_log.h

log.h was moved to shl so use it in all tests.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
11 years agouvtd: add new Virtual Terminal daemon
David Herrmann [Mon, 4 Mar 2013 14:11:30 +0000 (15:11 +0100)]
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>
11 years agoshl: move githead into a source file
David Herrmann [Mon, 4 Mar 2013 14:05:17 +0000 (15:05 +0100)]
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>
11 years agoshl: move log.[ch] to shl_log.[ch]
David Herrmann [Mon, 4 Mar 2013 13:40:36 +0000 (14:40 +0100)]
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>
11 years agolog: move includes to top
David Herrmann [Mon, 4 Mar 2013 13:27:27 +0000 (14:27 +0100)]
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>
11 years agobuild: mark font-unifont as noexecstack
David Herrmann [Mon, 4 Mar 2013 11:15:27 +0000 (12:15 +0100)]
build: mark font-unifont as noexecstack

ld automatically assumes that any binary input file requires an executable
stack. There's no way to tell it that it doesn't so we simply mark all
inputs as noexecstack.

Reported-by: Etam
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
11 years agoRelease kmscon-7 kmscon-7
David Herrmann [Thu, 28 Feb 2013 10:37:16 +0000 (11:37 +0100)]
Release kmscon-7

This is kmscon-7. See ./NEWS for a list of new features.

Unfortunately, github disabled the "Downloads" section so there is no way
to upload new pre-generated tarballs. I have a pending application to move
kmscon to freedesktop.org, but it didn't get processed in time for this
release. Therefore, you need to build the GNU-autotools files yourself.
That is, before calling ./configure you need to call:
  NOCONFIGURE=1 ./autogen.sh

You can extend your build-scripts with:
  test -f ./configure || NOCONFIGURE=1 ./autogen.sh

Which will call ./autogen.sh if needed. Everything else can be left
unchanged.

I will not upload the tarballs at another location. Feel free to do that
yourself, but I personally think this will introduce more confusion than
help. I hope the freedesktop.org move will be soon approved. This will
also provide a mailing-list where I can properly announce new releases.

Raw tarballs will be available as (without pre-generated autotools):
  https://github.com/dvdhrm/kmscon/archive/kmscon-7.tar.gz
  https://github.com/dvdhrm/kmscon/archive/kmscon-7.zip

The git-tag is: kmscon-7
You can use my public GPG key to verify the tarballs.

As usual, please report bugs to: https://github.com/dvdhrm/kmscon

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
11 years agobuild: fix empty --with-*= arguments
David Herrmann [Wed, 27 Feb 2013 18:48:53 +0000 (19:48 +0100)]
build: fix empty --with-*= arguments

It currently isn't possible to pass empty lists to these arguments as it
will then be interpreted as default. Fix this by using "default" if it is
empty.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
11 years agobuild: enable static libraries by default
David Herrmann [Wed, 27 Feb 2013 18:47:33 +0000 (19:47 +0100)]
build: enable static libraries by default

No reason to disable static libraries. Remove the LT_INIT parameter so we
can provide statically linked libraries.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
11 years agouvt: new library implementing VTs in user-space
David Herrmann [Wed, 27 Feb 2013 18:44:55 +0000 (19:44 +0100)]
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>
11 years agoshl: misc: provide shl_next_pow2()
David Herrmann [Mon, 18 Feb 2013 18:17:49 +0000 (19:17 +0100)]
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>
11 years agotests: fix compilation with new eloop API
David Herrmann [Sat, 16 Feb 2013 20:41:02 +0000 (21:41 +0100)]
tests: fix compilation with new eloop API

We added llog-data pointers so fix the tests helpers to set it to NULL by
default.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoREADME: update build-instructions
David Herrmann [Sat, 16 Feb 2013 20:34:46 +0000 (21:34 +0100)]
README: update build-instructions

The build-system changed slightly so update the build-instructions.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoNEWS: add kmscon-7 notes
David Herrmann [Sat, 16 Feb 2013 20:22:21 +0000 (21:22 +0100)]
NEWS: add kmscon-7 notes

We changed a whole bunch of stuff since kmscon-6 but most of it still
isn't finished (mainly the modularization). However, we definitly need a
bugfix-release.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agobuild: check for fuse >= 2.9.0
David Herrmann [Sat, 16 Feb 2013 20:19:21 +0000 (21:19 +0100)]
build: check for fuse >= 2.9.0

We need "fuse_buf" so check for at least fuse 2.9.0.

Reported-by: https://github.com/dvdhrm/kmscon/issues/67
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agobuild: enable unifont by default
David Herrmann [Sat, 16 Feb 2013 20:05:55 +0000 (21:05 +0100)]
build: enable unifont by default

Unifont is a very nice font-backend that now has sane compilation times
(by using ld directly). It's recommended over 8x16 as it has proper
internationalization support.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agodocs: remove pixman comments
David Herrmann [Mon, 11 Feb 2013 15:26:28 +0000 (16:26 +0100)]
docs: remove pixman comments

We now provide an experimental pixman backend. It still suffers from the
same problems but that cannot be fixed easily. Check it out if you want
it. Disabled by default, though.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoFix several typos
Jakub Wilk [Mon, 11 Feb 2013 15:24:21 +0000 (16:24 +0100)]
Fix several typos

Provided via github. Fixes typos in documentation and comments.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agollog: add "data" parameter to pass context
David Herrmann [Fri, 8 Feb 2013 15:14:48 +0000 (16:14 +0100)]
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>
11 years agobuild: add --enable-wlterm to distcheck flags
David Herrmann [Wed, 6 Feb 2013 17:30:13 +0000 (18:30 +0100)]
build: add --enable-wlterm to distcheck flags

We should test wlterm when running distcheck so make in mandatory.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agofont: freetype2: include tsm_unicode.h
David Herrmann [Wed, 6 Feb 2013 14:19:21 +0000 (15:19 +0100)]
font: freetype2: include tsm_unicode.h

We use TSM symbols so include the right headers.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agofont: unifont: compress binary data and link via ld directly
David Herrmann [Wed, 6 Feb 2013 14:16:09 +0000 (15:16 +0100)]
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>
11 years agobuild: major cleanup
David Herrmann [Tue, 5 Feb 2013 23:16:33 +0000 (00:16 +0100)]
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>
11 years agoconf: remove unused CONF_DONE
David Herrmann [Tue, 5 Feb 2013 11:40:03 +0000 (12:40 +0100)]
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>
11 years agoconf: fix include-protection name
David Herrmann [Tue, 5 Feb 2013 11:36:48 +0000 (12:36 +0100)]
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>
11 years agoconf: perform aftercheck on ctx-copy
David Herrmann [Tue, 5 Feb 2013 10:45:33 +0000 (11:45 +0100)]
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>
11 years agowlt: toolkit: fix stuck key repeat bug
Martin Minarik [Sat, 26 Jan 2013 11:09:05 +0000 (12:09 +0100)]
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>
11 years agowlt: link font library statically
David Herrmann [Thu, 24 Jan 2013 19:32:40 +0000 (20:32 +0100)]
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>
11 years agowlt: fix shl_hook API changes
David Herrmann [Thu, 24 Jan 2013 19:17:26 +0000 (20:17 +0100)]
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>
11 years agowlt: toolkit: fix resize window stuck in need_resize=true
Martin Minarik [Thu, 24 Jan 2013 15:48:03 +0000 (16:48 +0100)]
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>
11 years agouterm: drm: rename to drm3d
David Herrmann [Thu, 24 Jan 2013 15:42:03 +0000 (16:42 +0100)]
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>
11 years agouterm: rename drm-dumb backend into drm2d module
David Herrmann [Thu, 24 Jan 2013 13:42:54 +0000 (14:42 +0100)]
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>
11 years agotext: pixman: add support for non x4-stride glyphs
David Herrmann [Thu, 24 Jan 2013 13:11:22 +0000 (14:11 +0100)]
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>
11 years agotext: pixman: remove debug tests
David Herrmann [Thu, 24 Jan 2013 13:10:43 +0000 (14:10 +0100)]
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>
11 years agotext: pixman: special case rendering for known bg/fg colors
David Herrmann [Thu, 24 Jan 2013 13:09:17 +0000 (14:09 +0100)]
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>
11 years agouterm: dumb: optimize division by 255 in rendering path
David Herrmann [Thu, 24 Jan 2013 13:04:58 +0000 (14:04 +0100)]
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>
11 years agotext: cairo: fix debug message to print correct values
David Herrmann [Thu, 24 Jan 2013 13:04:04 +0000 (14:04 +0100)]
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>
11 years agokmscon: add pixman renderer
David Herrmann [Thu, 24 Jan 2013 11:13:29 +0000 (12:13 +0100)]
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>
11 years agouterm: fbdev: fix wakeing up displays
David Herrmann [Thu, 24 Jan 2013 09:24:18 +0000 (10:24 +0100)]
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>
11 years agouterm: video: print debug messages on wakeup/sleep
David Herrmann [Wed, 23 Jan 2013 18:31:43 +0000 (19:31 +0100)]
uterm: video: print debug messages on wakeup/sleep

This helps debugging video sleep/wakeup issues.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: add cairo-renderer module
David Herrmann [Tue, 15 Jan 2013 15:30:49 +0000 (16:30 +0100)]
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>
11 years agouterm: fbdev: map FBs for read access
David Herrmann [Tue, 15 Jan 2013 10:09:32 +0000 (11:09 +0100)]
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>
11 years agouterm: video: return buffer information on display_use()
David Herrmann [Mon, 14 Jan 2013 19:57:15 +0000 (20:57 +0100)]
uterm: video: return buffer information on display_use()

uterm_display_use() now returns the current back-buffer index when called.
It returns <0 on error. Whether OpenGL is supported is returned via a new
parameter "opengl". Set it to NULL if you're not interested.

Note that a backend might support OpenGL _and_ memory-mapped buffer
access. But you shouldn't rely on uterm_display_use() to return the
correct buffer-index if uterm_display_get_buffers() is not supported. For
instance the DRM-3D backend always returns 0 as buffer index as it has no
way of detecting it, yet.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: video: return information for all buffers on get_buffers()
David Herrmann [Mon, 14 Jan 2013 19:53:32 +0000 (20:53 +0100)]
uterm: video: return information for all buffers on get_buffers()

This renames get_buffer() to get_buffers() and returns back _and_ front
buffer to the application. This allows the application to create
supplemantal data for the buffers and manage it themself.

This data _must_ stay the same as long an activation-period of a display
so users can rely on the buffer information.
Also all information for back and front buffer is the same except for the
data pointer (which is only the same for single-buffered FBs).

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoshl: hook: fix invalid memory access for non-oneshot entries
David Herrmann [Sun, 13 Jan 2013 18:30:35 +0000 (19:30 +0100)]
shl: hook: fix invalid memory access for non-oneshot entries

If an entry is not a oneshot entry, then it might get deleted during the
callback procedure and hence, we _must_ not access it afterwards.
Therefore, remember the oneshot setting so we access it only if it really
is a oneshot entry.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: video: add uterm_display_get_buffer()
David Herrmann [Sun, 13 Jan 2013 15:58:31 +0000 (16:58 +0100)]
uterm: video: add uterm_display_get_buffer()

Until now we required external renderers to use the blit/blend helpers.
However, this seems hardly reasonable now so we provide a way to retrieve
the 2D buffer via the public API.

This is limited to xrgb32 and rgb16, other formats are not exported for
now (and probably not used, yet?). The 3D backends do not support that so
use the blit/blend helpers or OpenGL.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoCOPYING: add 'Swift Geek'
David Herrmann [Sun, 13 Jan 2013 15:11:07 +0000 (16:11 +0100)]
COPYING: add 'Swift Geek'

Without his many bug-reports kmscon wouldn't be what it is now. So add him
to the author-list.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: video: add support for immediate buffer-swaps
David Herrmann [Sun, 13 Jan 2013 15:06:00 +0000 (16:06 +0100)]
uterm: video: add support for immediate buffer-swaps

Internally, we already support immediate buffer-swaps but this hasn't been
exported in the API. This patch adds an "immediate" argument that causes
the flip to be immediate and not synchronized with vertical-blanks.

Please note that this might block if there is a pending page-flip.
However, this is mostly a delay of 16ms so we can ignore it as this is
acceptable if you want immediate swaps while there is still a
pending-buffer.
You can listen for the UTERM_PAGE_FLIP event if you don't want this
behavior.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agopty: reset signal-handlers for childs
David Herrmann [Sun, 13 Jan 2013 14:58:40 +0000 (15:58 +0100)]
pty: reset signal-handlers for childs

If signal-handlers are set to SIG_IGN, then this behavior is preserved
across an execve(). We don't want that so reset the handlers for all
childs before executing them.

kmscon may be executed with pre-set signal handlers for good reasons. So
reset the handlers in setup_child() so we have a clean environment.

This fixes a bug where child-programs assume SIGPIPE is not ignored but do
not explicitly set it to SIG_DFL.

Reported-by: Swift Geek [github issue #62]
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: drm: share mode-setting between dumb+drm
David Herrmann [Sun, 13 Jan 2013 14:26:56 +0000 (15:26 +0100)]
uterm: drm: share mode-setting between dumb+drm

The modesetting code of both DRM backends is almost the same so share it.
This also works around several race-conditions in some DRM drivers. In
particular, we cannot call drmModeSetCrtc while a drmModePageFlip is still
pending. Therefore, we wait for page-flips to complete before performing
an immediate mode-set.

This requires us to handle page-flip events synchronously so we can wait
for kernel page-flip events but the user-space bottom-half is executed in
an idle-handler.

Note that the chance that we have to wait for a page-flip to complete is
pretty small. In fact, without hacking the code to do fast page-flips, I
couldn't get kmscon to run into this condition.

Last but not least, this patch also makes the dumb-backend support
immediate page-flips like the DRM backend did all the time.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoeloop: add EV_ONESHOT and EV_SINGLE flags for idle sources
David Herrmann [Sun, 13 Jan 2013 10:54:29 +0000 (11:54 +0100)]
eloop: add EV_ONESHOT and EV_SINGLE flags for idle sources

EV_ONESHOT will remove idle sources once they have been processed and
EV_SINGLE will only register the source if it hasn't been registered, yet.

For source removal EV_ONESHOT has no effect but EV_SINGLE causes all
events with this cb+data combination to be removed.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoshl: hook: add 'oneshot' flag
David Herrmann [Sun, 13 Jan 2013 10:42:04 +0000 (11:42 +0100)]
shl: hook: add 'oneshot' flag

If an entry is marked as 'oneshot' then it will get deleted after it has
been called once. Note that the entry is unlinked _before_ the callback is
called.

If you use 'oneshot'-entries and normal entries with the same cb+data
combination, then you will probably get unexpected behavior. It is not
recommended to do that. In detail, you cannot control which entry is
deleted via a shl_hook_rm() call so you can never be sure whether the
oneshot entry or a normal entry is deleted.

Do not mix oneshot entries with normal entries!

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoshl: hook: add helpers to add callbacks only once
David Herrmann [Sun, 13 Jan 2013 10:23:05 +0000 (11:23 +0100)]
shl: hook: add helpers to add callbacks only once

Very often we want to avoid adding callbacks multiple times. Currently we
have to keep track of this in each module with a boolean value.
To simplify this procedure, we add helpers that guarantee that entries are
only added once and a helper to remove all entries with a given cb+data
combination.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: drm: reread dpms state on wakeup
David Herrmann [Sat, 12 Jan 2013 13:01:01 +0000 (14:01 +0100)]
uterm: drm: reread dpms state on wakeup

Other DRM users might change the DPMS state of a display while we are
asleep. Therefore, reread the state during wakeup and force DPMS to the
same value it had when we left. But do this only for displays that are
online, other displays are never touched by uterm-video.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: remove uterm_video_use()
David Herrmann [Sat, 12 Jan 2013 12:40:50 +0000 (13:40 +0100)]
uterm: remove uterm_video_use()

This function is a no-op and not used. Hence, remove it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotests: fix build with new uterm headers
David Herrmann [Sat, 12 Jan 2013 12:40:00 +0000 (13:40 +0100)]
tests: fix build with new uterm headers

These tests still use uterm.h which builds fine if you have an old uterm
version installed, however, with a new version this will fail horribly.
Hence, fix them to use the new headers.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: video: use shl_dlist for linked lists
David Herrmann [Sat, 12 Jan 2013 12:31:17 +0000 (13:31 +0100)]
uterm: video: use shl_dlist for linked lists

uterm-video is actually older than shl_dlist and it used its own
single-linked lists until now. This had several drawbacks and produced
ugly code.

This commit converts all uterm-video elements to use shl_dlist and
introduces _bind and _unbind helpers.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: video: share set_dpms code
David Herrmann [Sat, 12 Jan 2013 07:21:40 +0000 (08:21 +0100)]
uterm: video: share set_dpms code

The set_dpms callback of dumb and drm backends is identical so share it in
drm-shared module.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: share drm-video wakeup helpers
David Herrmann [Sat, 12 Jan 2013 00:01:54 +0000 (01:01 +0100)]
uterm: share drm-video wakeup helpers

The dumb and drm backends still use the same code to perform wakeup/sleep
code. Hence, move it into the drm-shared file so we can use the same
helpers for both.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: drm: fix y-invert bug
David Herrmann [Fri, 11 Jan 2013 23:53:01 +0000 (00:53 +0100)]
uterm: drm: fix y-invert bug

This fixes the last OpenGL user that still uses the wrong y-axis
direction. See the gltex helpers for more information.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: share drm-video objects
David Herrmann [Fri, 11 Jan 2013 23:51:23 +0000 (00:51 +0100)]
uterm: share drm-video objects

This moves the gbm/drm shared properties into the drm-shared helper.
Furthermore, it removes the last static property in uterm_video objects so
everything is correctly accessed via ->data pointers.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: drm: fix y-inversion bug
David Herrmann [Fri, 11 Jan 2013 18:18:15 +0000 (19:18 +0100)]
uterm: drm: fix y-inversion bug

OpenGL uses an inverted y-axis by default. However, the old gbm-surface
layer didn't correctly map this. But with the conversion to gbm_surface
objects, we now have the correct OpenGL framebuffers so we have to invert
the y-axis.
This was already fixed for the gltex renderer earlier but we forgot to fix
the uterm-drm blitting backend.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: share drm-display helpers
David Herrmann [Fri, 11 Jan 2013 18:09:42 +0000 (19:09 +0100)]
uterm: share drm-display helpers

dumb and drm video backends share quite a lot of logic. Hence, move common
helpers into the drm-shared module and use it in both backends.

This also moves the uterm-display objects of both backends to use the data
member instead of static fields.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: share drm dpms code
David Herrmann [Fri, 11 Jan 2013 16:45:48 +0000 (17:45 +0100)]
uterm: share drm dpms code

drm and dumb backends use the same DPMS code so share it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: share drm_mode between dumb and drm backend
David Herrmann [Fri, 11 Jan 2013 16:28:29 +0000 (17:28 +0100)]
uterm: share drm_mode between dumb and drm backend

The dumb and drm backends use the same mode structure so share the code as
drm_shared module.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: fbdev: set mode dimensions after activation
David Herrmann [Fri, 11 Jan 2013 16:27:22 +0000 (17:27 +0100)]
uterm: fbdev: set mode dimensions after activation

We do not set the dimensions correctly but always use 0/0. Fix this by
overwriting the values on mode creation.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: video: remove .blend and .blendv backends
David Herrmann [Fri, 11 Jan 2013 15:35:25 +0000 (16:35 +0100)]
uterm: video: remove .blend and .blendv backends

We never implemented real blending and never hooked it up with the public
API. Hence, we can safely remove this. All functionality that was
available via .blend is now available via .fake_blendv.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: split fbdev module into different files
David Herrmann [Fri, 11 Jan 2013 15:24:37 +0000 (16:24 +0100)]
uterm: split fbdev module into different files

This is the first step towards a uterm-fbdev module. It splits the huge
video file into a video backend and a render backend. A monitor backend
will follow later when a full uterm module infrastructure is available.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: fbdev: use video-data pointer
David Herrmann [Fri, 11 Jan 2013 15:01:23 +0000 (16:01 +0100)]
uterm: fbdev: use video-data pointer

Instead of hardcoding fbdev data in the header, we now store all data in
the "data" pointer so we can be loaded during runtime.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: video: add data pointer
David Herrmann [Fri, 11 Jan 2013 15:00:32 +0000 (16:00 +0100)]
uterm: video: add data pointer

If we want to load backends during runtime, we must allow them to store
their data. Instead of hardcoding it, we now provide a "data" pointer so
they can store arbitrary data.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: video: include xf86drm.h for drmAvailable()
David Herrmann [Fri, 11 Jan 2013 14:59:33 +0000 (15:59 +0100)]
uterm: video: include xf86drm.h for drmAvailable()

We need this include so drmAvailable() is declared correctly.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: video: modularize video backends
David Herrmann [Fri, 11 Jan 2013 11:16:43 +0000 (12:16 +0100)]
uterm: video: modularize video backends

We want to allow dynamic backend loading during runtime so we need to
avoid static definitions. This converts the backend IDs into module
structures which are then linked into the binary.

To make this fully modular, we need to load the backends dynamicly via
dlsym() and move all the static declarations from uterm_video.h into the
backends. But for now at least the backends can be easily exchanged and
configured during compile-time.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agobuild: link with -ldl
David Herrmann [Tue, 8 Jan 2013 16:54:53 +0000 (17:54 +0100)]
build: link with -ldl

We use dlopen() and friends so link with libdl.so to be sure that they are
available.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: move uterm.h to uterm_monitor.h
David Herrmann [Mon, 7 Jan 2013 18:36:42 +0000 (19:36 +0100)]
uterm: move uterm.h to uterm_monitor.h

uterm.h contains only uterm-monitor related APIs so rename it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: move uterm-vt into uterm_vt.h
David Herrmann [Mon, 7 Jan 2013 18:31:27 +0000 (19:31 +0100)]
uterm: move uterm-vt into uterm_vt.h

This splits off uterm-vt from the main header to reduce the dependencies
on uterm.h.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: move input related API to uterm_input.h
David Herrmann [Mon, 7 Jan 2013 18:22:38 +0000 (19:22 +0100)]
uterm: move input related API to uterm_input.h

This splits off the uterm-input API from uterm.h to avoid depending on
uterm.h everywhere.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: move video API into uterm_video.h
David Herrmann [Mon, 7 Jan 2013 17:03:45 +0000 (18:03 +0100)]
uterm: move video API into uterm_video.h

Split the main header to avoid having it as dependency in so many places.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: monitor: avoid libdrm dependency
David Herrmann [Mon, 7 Jan 2013 13:07:14 +0000 (14:07 +0100)]
uterm: monitor: avoid libdrm dependency

Instead of depending on libdrm, we simply copy the VERSION-IOCTL ABI and
perform the ioctl ourself. This reduces complexity and dependencies.

Why does the DRM layer not provide normal uapi headers via
linux-api-headers? We should fix that.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: remove unused pciaccess helpers
David Herrmann [Mon, 7 Jan 2013 12:40:26 +0000 (13:40 +0100)]
uterm: remove unused pciaccess helpers

We now detect primary GPUs via udev so the pciaccess helpers are no longer
needed.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: video: remove drm_get_id() helper
David Herrmann [Mon, 7 Jan 2013 12:37:17 +0000 (13:37 +0100)]
uterm: video: remove drm_get_id() helper

This helper is no longer used so remove it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: monitor: read boot_vga via uterm
David Herrmann [Mon, 7 Jan 2013 12:34:44 +0000 (13:34 +0100)]
uterm: monitor: read boot_vga via uterm

Instead of using the pciaccess helpers, we now read the boot_vga flag via
uterm. This makes the whole process a lot simpler and removes a lot of
duplicated code that is already provided by the kernel.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: move uterm_systemd.h to uterm_systemd_internal.h
David Herrmann [Mon, 7 Jan 2013 12:24:50 +0000 (13:24 +0100)]
uterm: move uterm_systemd.h to uterm_systemd_internal.h

Same as uterm_input.h, we want internal headers to have the *_internal
suffix.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: move uterm_video.h to uterm_video_internal.h
David Herrmann [Mon, 7 Jan 2013 12:24:09 +0000 (13:24 +0100)]
uterm: move uterm_video.h to uterm_video_internal.h

Same as uterm_input.h, we want internal headers to have the *_internal
suffix.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: move uterm_input.h to uterm_input_internal.h
David Herrmann [Mon, 7 Jan 2013 12:18:06 +0000 (13:18 +0100)]
uterm: move uterm_input.h to uterm_input_internal.h

We will split the public uterm header soon to avoid big headers. Hence,
rename internal headers to *_internal.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agobuild: fix build without libfont.la
David Herrmann [Sat, 5 Jan 2013 23:50:12 +0000 (00:50 +0100)]
build: fix build without libfont.la

We still have dead dependencies on libfont.la but don't build it anymore.
Remove the dependency as it is directly linked now.

Reported-by: Vladimir Kravets
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agobuild: remove getty@.service from makefiles
David Herrmann [Sat, 5 Jan 2013 23:49:38 +0000 (00:49 +0100)]
build: remove getty@.service from makefiles

We removed this service unit earlier this week but the EXTRA_DIST variable
still mentions it. Remove it so kmscon builds cleanly again.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotext: remove old init/deinit helpers
David Herrmann [Thu, 3 Jan 2013 16:49:39 +0000 (17:49 +0100)]
text: remove old init/deinit helpers

We no longer need these helpers so remove them. We require each backend to
register itself as part of module-loading so no need to keep these
helpers.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: make bblit mandatory
David Herrmann [Thu, 3 Jan 2013 16:48:23 +0000 (17:48 +0100)]
kmscon: make bblit mandatory

Similar to the font backends we now require one backend to be always
available as safe fallback. The bblit backend is the most basic backend so
make it mandatory and link it unconditionally.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agobuild: remove libfont.la and link directly
David Herrmann [Thu, 3 Jan 2013 16:47:42 +0000 (17:47 +0100)]
build: remove libfont.la and link directly

We no longer share libfont.la so link it directly into kmscon.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: move gltex renderer into module
David Herrmann [Thu, 3 Jan 2013 16:41:50 +0000 (17:41 +0100)]
kmscon: move gltex renderer into module

Provide the gltex renderer via a module to allow loading it during
runtime.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: move bbulk renderer into module
David Herrmann [Thu, 3 Jan 2013 16:36:23 +0000 (17:36 +0100)]
kmscon: move bbulk renderer into module

Provide the bbulk renderer via mod-bbulk.so so it can be loaded during
runtime.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotext: add owner field to text-ops
David Herrmann [Thu, 3 Jan 2013 16:24:41 +0000 (17:24 +0100)]
text: add owner field to text-ops

When text-ops are registered via modules, we need an owner field so
they're correctly tracked. Hence, add this field to all text-ops and
correctly keep module references.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoCOPYING: update copyright to 2013
David Herrmann [Thu, 3 Jan 2013 16:15:54 +0000 (17:15 +0100)]
COPYING: update copyright to 2013

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