platform/upstream/kmscon.git
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>
11 years agoshl: misc: add shl_ends_with() helper
David Herrmann [Sun, 30 Dec 2012 18:41:08 +0000 (19:41 +0100)]
shl: misc: add shl_ends_with() helper

This helper checks whether a string has the given suffix.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoshl: misc: add shl_dirent() helper
David Herrmann [Sun, 30 Dec 2012 18:40:04 +0000 (19:40 +0100)]
shl: misc: add shl_dirent() helper

"struct dirent" has always been a mess. As its size may differ between
systems, we need to dynamically allocate it. This helper does that for us.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotext: use new shl-registry objects
David Herrmann [Sun, 30 Dec 2012 15:21:27 +0000 (16:21 +0100)]
text: use new shl-registry objects

Instead of implementing our own thread-safe backend-storage, we now use
the generic shl-registry object.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotext: font: use new shl-registry objects
David Herrmann [Sun, 30 Dec 2012 15:20:51 +0000 (16:20 +0100)]
text: font: use new shl-registry objects

Instead of implementing a thread-safe backend-system we can now use the
new shl-registry storage module.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoshl: add new register helper
David Herrmann [Sun, 30 Dec 2012 15:18:25 +0000 (16:18 +0100)]
shl: add new register helper

The shl-register module is used to create registries of named-objects. The
main purpose for it will be for module-systems were we have different
backends implementing an interface. The registry can then be used to find
a specific module (or the default module).

No sophisticated filter/search mechanism is used as this cannot be done
efficiently in a generic way.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoCOPYING: add missing contributor's names
David Herrmann [Sun, 30 Dec 2012 11:50:47 +0000 (12:50 +0100)]
COPYING: add missing contributor's names

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agodocs: fix systemd-unit name typo
Hoàng Đức Hiếu [Sat, 29 Dec 2012 14:05:57 +0000 (21:05 +0700)]
docs: fix systemd-unit name typo

We forgot to rename the templates from kmscon to kmsconvt in the comments.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotext: gltex: fix y-inversion with new gbm-surfaces
David Herrmann [Fri, 21 Dec 2012 14:30:19 +0000 (15:30 +0100)]
text: gltex: fix y-inversion with new gbm-surfaces

The standard OpenGL surfaces are y-inverted (which we didn't implement
correctly previously when using our own gbm-surfaces). Therefore, we need
to flip the y-coordinates now as we use correct GL surfaces with the new
drm-uterm backend.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: video: drm: use gbm surfaces
David Herrmann [Fri, 21 Dec 2012 14:15:16 +0000 (15:15 +0100)]
uterm: video: drm: use gbm surfaces

Until now we always created our buffers via gbm_bo_create() and used
surfaceless EGL contexts so we can schedule buffer-flips manually.
However, recent gbm and EGL mesa releases include gbm-surfaces that allow
us to ignore all this an let EGL manage the buffers.

This introduces some problems as we are no longer under control of the
buffers so we cannot know which buffer is active. That means, applications
that use the uterm-drm devices must redraw the screen on each frame.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agodocs: fix default font-size=12 documentation
David Herrmann [Fri, 21 Dec 2012 13:13:00 +0000 (14:13 +0100)]
docs: fix default font-size=12 documentation

We used font-size=15 in the past but changed it long ago. However, the
documentation still used 15 so fix this now.

Reported-by: James Buren <ryu0@ymail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agodocs: add kmsconvt@.service systemd template
David Herrmann [Mon, 17 Dec 2012 12:25:52 +0000 (13:25 +0100)]
docs: add kmsconvt@.service systemd template

This new template can be used as replacement for getty@.service. It has
the same semantics and can be used as drop-in replacement. It even uses
getty@.service as fallback if kmscon fails.
See the comments in the files for more information.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoterminal: use COLORTERM=kmscon as default
David Herrmann [Wed, 12 Dec 2012 20:29:23 +0000 (21:29 +0100)]
terminal: use COLORTERM=kmscon as default

We now set COLORTERM to "kmscon" so applications can identify their
controlling terminal. Note that COLORTERM is not used for terminfo/termcap
detection (unlike TERM).

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: use /bin/login -p as default login program
David Herrmann [Wed, 12 Dec 2012 20:24:51 +0000 (21:24 +0100)]
kmscon: use /bin/login -p as default login program

We must pass "-p" to make "login" preserve the environment. We make sure
the environment is correctly reset before calling it so it is safe.
Furthermore, this allows us to pass additional environment variables to
the child without having /bin/login reset it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: add --reset-env option
David Herrmann [Wed, 12 Dec 2012 20:24:15 +0000 (21:24 +0100)]
kmscon: add --reset-env option

This option controls whether we reset the environment before spawning the
PTY child.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agopty: add env_reset property
David Herrmann [Wed, 12 Dec 2012 20:20:45 +0000 (21:20 +0100)]
pty: add env_reset property

This property controls whether the environment should be reset before
spawning the child process. Defaults to "no" and affects whether "-p" is
passed as default argument to /bin/login.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agopty: add "colorterm" property
David Herrmann [Wed, 12 Dec 2012 19:12:21 +0000 (20:12 +0100)]
pty: add "colorterm" property

The colorterm property is used (if set) as COLORTERM environment variable.
Note that this variable (despite the name) is not used with
terminfo/termcap. Instead, it's solely used to identify the running
terminal.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agobuild: check for udev >=172
David Herrmann [Mon, 10 Dec 2012 15:21:32 +0000 (16:21 +0100)]
build: check for udev >=172

We need udev_device_has_tag() which was introduced in version 172.
Document that in README file.

Reported-by: Manuel Rüger <mrueg@rueg.eu>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotsm: screen: add support for multi-cell characters
David Herrmann [Mon, 10 Dec 2012 15:09:28 +0000 (16:09 +0100)]
tsm: screen: add support for multi-cell characters

The wcwidth() POSIX helper returns the number of cells that a character
occupies. This is normally 1, however, if it is 0 we simply discard this
input (this should never happen as all characters that wcwidth() returns 0
for should already be handled by the VTE layer).
But if it is >1, we write the character in the first cell, set the width
correctly and mark all following characters as width=0.

Everything else is left unchanged, that means, the running application has
to be aware of wcwidth() and correctly send two backspaces to clear a
width=2 character and so on.

This behavior almost exactly matches the xterm behavior. There are some
corner cases like erasing only one part of a multi-cell character etc.
that might differ. However, these are non-standard cases that no
application should never rely on.
Anyway, if we spot any of these differences between xterm and kmscon, we
should fix kmscon to behave like xterm does.

Thanks to Shixin for looking this up in other emulators.

Reported-by: Shixin Zeng
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotext: add render-support for multi-cell glyphs
David Herrmann [Mon, 10 Dec 2012 15:00:08 +0000 (16:00 +0100)]
text: add render-support for multi-cell glyphs

Multi-cell glyphs are glyphs that span across multiple horizontal cells.
The font renderers already support this. This patch fixes the console
renderers to take advantage of this.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotext: font: draw multi-cell characters correctly
David Herrmann [Mon, 10 Dec 2012 14:40:48 +0000 (15:40 +0100)]
text: font: draw multi-cell characters correctly

Instead of clipping every character to a one-cell boundary, we now render
multi-cell characters correctly into multiple cells.

This does not adjust the console-renderers but only the font renderers to
provide the correct glyphs.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agodocs: fix typos in unicode-test.txt
David Herrmann [Mon, 10 Dec 2012 14:36:28 +0000 (15:36 +0100)]
docs: fix typos in unicode-test.txt

Two simple obvious typos.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotsm: unicode: add wcwidth() implementation
David Herrmann [Mon, 10 Dec 2012 14:31:47 +0000 (15:31 +0100)]
tsm: unicode: add wcwidth() implementation

wcwidth() is a POSIX function that returns the number of cells that a
wide-character occupies. The glibc function cannot be used as it depends
on the locale and we need _always_ UTF8 no matter what the locale is.

This implementation is provided by Markus Kuhn and is equivalent to
xterm's behavior.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotsm: unicode: fix header-protection namespace
David Herrmann [Mon, 10 Dec 2012 14:23:10 +0000 (15:23 +0100)]
tsm: unicode: fix header-protection namespace

TSM is no longer part of main-kmscon libraries so move macro-names to
TSM_* prefix.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouxkb: print warning if LED update fails
David Herrmann [Sun, 9 Dec 2012 21:06:51 +0000 (22:06 +0100)]
uxkb: print warning if LED update fails

If we cannot write LED states to an input device, we should print proper
warnings instead of ignoring it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoRelease kmscon-6
David Herrmann [Sun, 9 Dec 2012 20:55:32 +0000 (21:55 +0100)]
Release kmscon-6

This release contains a lot of fixes all over the place and introduces
many new features. See ./NEWS for a list of new features.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoREADME: update readme-file
David Herrmann [Sun, 9 Dec 2012 19:49:28 +0000 (20:49 +0100)]
README: update readme-file

We updated configure.ac several times and need to update the README with
the newest command-line options.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoNEWS: add further kmscon-6 news entries
David Herrmann [Sun, 9 Dec 2012 19:11:14 +0000 (20:11 +0100)]
NEWS: add further kmscon-6 news entries

We added some more features in the recent weeks so add them. Most of it
were bugfixes, though.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoCOPYING: add all contributors
David Herrmann [Sun, 9 Dec 2012 18:53:27 +0000 (19:53 +0100)]
COPYING: add all contributors

Add name of all contributors to COPYING.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agobuild: add systemd service files to EXTRA_DIST
David Herrmann [Sun, 9 Dec 2012 18:52:35 +0000 (19:52 +0100)]
build: add systemd service files to EXTRA_DIST

These service files aren't installed, yet but they work so distribute
them.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agobuild: add manpage-XML files to EXTRA_DIST
David Herrmann [Sun, 9 Dec 2012 18:51:51 +0000 (19:51 +0100)]
build: add manpage-XML files to EXTRA_DIST

We need these XML files to build the man-pages so add them to EXTRA_DIST.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agobuild: add kmscon_cdev.h to source files
David Herrmann [Sun, 9 Dec 2012 18:51:22 +0000 (19:51 +0100)]
build: add kmscon_cdev.h to source files

This is needed to get "make distcheck" working again.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoAdd getty@.service replacement
David Herrmann [Sun, 9 Dec 2012 17:40:26 +0000 (18:40 +0100)]
Add getty@.service replacement

This unit file is a new replacement for standard systemd-getty files.
Installed into /etc/systemd/system it replaces the standard systemd unit
and spawns kmscon instead of agetty on virtual terminals.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: add --seats=current option
David Herrmann [Sun, 9 Dec 2012 17:34:26 +0000 (18:34 +0100)]
kmscon: add --seats=current option

This option uses XDG_SEAT to determine the current seat. If this is NULL,
we fall back to "seat0".

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agopty: use /bin/login by default
David Herrmann [Sun, 9 Dec 2012 17:33:03 +0000 (18:33 +0100)]
pty: use /bin/login by default

kmscon does always pass a proper argv array so the default is never used.
However, for security reasons we shouldn't hardcode /bin/login. If some
other program uses the pty layer and forgets to pass in a suitable argv
all the time, they mind end up with opening a root shell.

Hence, use /bin/login as default.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agobuild: add more verbose recursive error-messages to configure.ac
David Herrmann [Sun, 9 Dec 2012 16:45:50 +0000 (17:45 +0100)]
build: add more verbose recursive error-messages to configure.ac

Our dependency checker should recursively report missing dependencies.
Otherwise, the user doesn't really know what is missing.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agobuild: add AC_PROG_SED to configure.ac
David Herrmann [Sun, 9 Dec 2012 16:45:20 +0000 (17:45 +0100)]
build: add AC_PROG_SED to configure.ac

We need SED for man-page generation so explicitly look for it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: remove compositor support
David Herrmann [Sun, 9 Dec 2012 14:55:26 +0000 (15:55 +0100)]
kmscon: remove compositor support

The wayland compositor support was some research project that turned out
to not work that well. The main problem is that the DRM planes support
cannot be easily forwarded to a child. Sub-surface support might change
that but until then we remove compositor support.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoseat: always activate fake-VTs during startup
David Herrmann [Sun, 9 Dec 2012 13:19:17 +0000 (14:19 +0100)]
seat: always activate fake-VTs during startup

Instead of relying on --switchvt, we should always activate fake-VTs
during startup. Otherwise, we might end up with dead seats as there is no
way to wake up kmscon later.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: remove broken vt_eloop concept
David Herrmann [Sun, 9 Dec 2012 13:14:41 +0000 (14:14 +0100)]
kmscon: remove broken vt_eloop concept

We tried to avoid running unused code during shutdown by moving VT
handling into a separate eloop and run it exclusively. However, with
delayed VT switching, we need to run other event-handlers to make the VT
switch work. Therefore, run all of this during shutdown and remove the
vt_eloop event-loop.

This means that we might create new seats, displays, etc. during shutdown.
This is valid and doesn't harm kmscon, but we want to avoid doing stuff
that is undone few miliseconds later. Therefore, we set a "exiting" flag
and check that before initiating most of the big handlers.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoseat: start hotplugged seats if --switchvt is given
David Herrmann [Sun, 9 Dec 2012 12:50:38 +0000 (13:50 +0100)]
seat: start hotplugged seats if --switchvt is given

We currently only start seats (switch to their VT) during startup but we
should also do that for hotplugged seats. Therefore, move that logic into
kmscon_seat and perform the startup after the seat is fully set up.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: remove unused 'out' arguments
David Herrmann [Sun, 9 Dec 2012 12:44:52 +0000 (13:44 +0100)]
kmscon: remove unused 'out' arguments

We don't use the newly created objects so no need to return them.
Furthermore, we want the functions to already perform actions on the
objects so there is no guarantee the objects are still alive after
function return. Thus, simply return nothing.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: move video-device uterm-monitor handling
David Herrmann [Sun, 9 Dec 2012 12:41:28 +0000 (13:41 +0100)]
kmscon: move video-device uterm-monitor handling

Same as previous commit: Move uterm-monitor device-data handling into the
real device create/destroy functions to allow dynamic device removal.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: set uterm-seat data in seat-creation
David Herrmann [Sun, 9 Dec 2012 12:37:39 +0000 (13:37 +0100)]
kmscon: set uterm-seat data in seat-creation

If we want to be able to destroy seats from anywhere, not just
uterm-monitor callbacks, we need to be able to reset the monitor-event
seat-data so we no longer access the seat memory.
Hence, move the seat-data set/reset logic into the actual seat
creation/destroy functions.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoseat: pass allowed VTs from caller
David Herrmann [Sun, 9 Dec 2012 12:26:45 +0000 (13:26 +0100)]
seat: pass allowed VTs from caller

We should handle everything --listen related in kmscon_main so pass in the
allowed-VTs mask from the caller.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoAdd manpage infrastructure and kmscon.1 manpage
David Herrmann [Sun, 9 Dec 2012 12:18:56 +0000 (13:18 +0100)]
Add manpage infrastructure and kmscon.1 manpage

Add a very basic man-page infrastructure so we can easily add new
docbook-style manpages.

Also add kmscon.1 man-page with a basic overview.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: fix compilation of builds where fbdev is the only output
James Buren [Thu, 6 Dec 2012 20:31:17 +0000 (14:31 -0600)]
uterm: fix compilation of builds where fbdev is the only output

Declare helpers as "static inline" as they might get included but not
used.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agocdev: change TODO item to check for CAP_KILL
David Herrmann [Thu, 6 Dec 2012 14:21:23 +0000 (15:21 +0100)]
cdev: change TODO item to check for CAP_KILL

CAP_KILL will be documented in kmscon manuals, but we should actually
check for the capability during startup.

However, this requires linking with libcap or libcap-ng and we currently
want to avoid that for such a simple task.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: ignore SIGPIPE
David Herrmann [Thu, 6 Dec 2012 13:49:56 +0000 (14:49 +0100)]
kmscon: ignore SIGPIPE

Ignore SIGPIPE globally. We handle HUP correctly everywhere and this
signal is just annoying.

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