platform/upstream/kmscon.git
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>
11 years agobuild: disable freetype2 by default
David Herrmann [Thu, 3 Jan 2013 16:09:18 +0000 (17:09 +0100)]
build: disable freetype2 by default

The freetype2 backend is no longer recommended. You should always prefer
the pango backend. Pango provides a lot more advanced font options and
internationalization.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: add freetype2 module
David Herrmann [Thu, 3 Jan 2013 16:04:55 +0000 (17:04 +0100)]
kmscon: add freetype2 module

The freetype2 module register the freetype2 font backend with kmscon core.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: add unifont module
David Herrmann [Thu, 3 Jan 2013 16:04:33 +0000 (17:04 +0100)]
kmscon: add unifont module

The unifont module registers the unifont font backend with kmscon core.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotext: remove old font definitions
David Herrmann [Thu, 3 Jan 2013 16:03:31 +0000 (17:03 +0100)]
text: remove old font definitions

All font definitions have been moved to font.h so remove the old
definitions and include font.h instead.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotext: move font layer into top-level font_* namespace
David Herrmann [Thu, 3 Jan 2013 15:55:56 +0000 (16:55 +0100)]
text: move font layer into top-level font_* namespace

The font layer does not longer depend on the text layer so move it into
its own namespace.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: add pango module
David Herrmann [Thu, 3 Jan 2013 15:30:40 +0000 (16:30 +0100)]
kmscon: add pango module

The pango module registers the pango font-backend with kmscon.

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

The owner fields specifies the module that provides the code for the given
backend. The font-core is responsible of ref/unref'ing the module so its
code is always available as long as the module exists.

We cannot push this into the modules as modules _must_ never call
kmscon_module_unref(KMSCON_THIS_MODULE)! Because this might drop the last
reference and hence the function might disallocate the module. However,
this means that it cannot return because the caller is _part_ of the
module and so no longer valid.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: add module support
David Herrmann [Thu, 3 Jan 2013 15:21:18 +0000 (16:21 +0100)]
kmscon: add module support

Several parts of kmscon have huge external dependencies. However, we allow
them to be disabled during build-time. But this is not enough as it
requires distributions to choose which options to use. Therefore, we now
allow dynamicly loadable modules that can optionally be installed and
kmscon automatically picks them up.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agobuild: disable wlterm by default
David Herrmann [Thu, 3 Jan 2013 14:53:01 +0000 (15:53 +0100)]
build: disable wlterm by default

wlterm hasn't been updated for long and it will take some more time to get
it to work with recent Wayland protocol. Hence, disable it so it doesn't
matter if it breaks for now.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotext: font: add .finalize callback
David Herrmann [Thu, 3 Jan 2013 13:03:58 +0000 (14:03 +0100)]
text: font: add .finalize callback

Each font-backend now also gets a .finalize callback that is called when
the last font-user drops its font. This will allow modules to destroy
themself when the last reference is dropped.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoshl: register: add destroy callback
David Herrmann [Thu, 3 Jan 2013 13:00:57 +0000 (14:00 +0100)]
shl: register: add destroy callback

The new destroy callback is called whenever an entries last reference is
dropped. This will allow modules to keep reference of its code users.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotext: remove load/unload helpers for text-font backends
David Herrmann [Wed, 2 Jan 2013 17:14:48 +0000 (18:14 +0100)]
text: remove load/unload helpers for text-font backends

With modules we no longer need to conditionally load backends. Instead
each module will register the backend with the main application on load.

This will temporarily break pango, freetype2 and unifont backends as they
are not registered until we introduce full module support.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agobuild: link each text-font backend separately
David Herrmann [Wed, 2 Jan 2013 17:00:14 +0000 (18:00 +0100)]
build: link each text-font backend separately

We want to modularize the text-font library, so we need each backend as a
different library. This step links each of them into a different static
library so we can now link them either into the binary or into modules.

This step also makes 8x16 always compiled into the text-font backend so we
always have a working implementation even though no modules might be
loaded.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agodocs: remove getty@.service
David Herrmann [Wed, 2 Jan 2013 16:34:47 +0000 (17:34 +0100)]
docs: remove getty@.service

This is no longer used and was replaced by kmsconvt@.service some time
ago.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agobuild: include kmsconvt@.service in EXTRA_DIST
David Herrmann [Wed, 2 Jan 2013 16:34:07 +0000 (17:34 +0100)]
build: include kmsconvt@.service in EXTRA_DIST

We need the new kmsconvt@.service file instead of the old kmscon@.service.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agobuild: fix man-page compilation
David Herrmann [Wed, 2 Jan 2013 16:32:49 +0000 (17:32 +0100)]
build: fix man-page compilation

The man_fixup_aliases thingy was a horrible hack. Replace it with a
temporary .man_fixup file that saves compilation timestamps so we have
post-recipies for man-fixups.

Also fix some minor out-of-tree build problems.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agobuild: provide git-head revision via githead.h
David Herrmann [Mon, 31 Dec 2012 15:40:51 +0000 (16:40 +0100)]
build: provide git-head revision via githead.h

We need the git-revision for module-version checks so provide the
infrastructure now and print it in log_init().

Note that the git-describe string is distributed with the tarballs so
end-users will not have to generate it themself. But when building from
git, the revision will be automatically updated whenever something
changes.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agobuild: fix libuterm dependency typo
David Herrmann [Mon, 31 Dec 2012 14:41:00 +0000 (15:41 +0100)]
build: fix libuterm dependency typo

We didn't set the dependencies correctly for uterm libraries as a
backslash was missing. Fix this typo.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agobuild: mark man_fixup_aliases as PHONY target
David Herrmann [Mon, 31 Dec 2012 14:40:06 +0000 (15:40 +0100)]
build: mark man_fixup_aliases as PHONY target

We need to mark it as PHONY target as it has no corresponding source file.
It's unlikely that it causes problems, but lets be safe.

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