1341 Commits

Author SHA1 Message Date
David Herrmann
5604a0a325 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>
2013-01-13 15:26:56 +01:00
David Herrmann
1ef166c12c 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>
2013-01-13 11:54:29 +01:00
David Herrmann
5ee2338b60 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>
2013-01-13 11:42:04 +01:00
David Herrmann
8fa28926cb 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>
2013-01-13 11:26:05 +01:00
David Herrmann
041baf4c40 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>
2013-01-12 14:01:01 +01:00
David Herrmann
9f27d05319 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>
2013-01-12 13:40:50 +01:00
David Herrmann
5f348ccec7 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>
2013-01-12 13:40:00 +01:00
David Herrmann
bf39cf80b0 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>
2013-01-12 13:31:17 +01:00
David Herrmann
ca6d86d8e8 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>
2013-01-12 08:21:40 +01:00
David Herrmann
415a53bfd7 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>
2013-01-12 01:01:54 +01:00
David Herrmann
9d70156dc9 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>
2013-01-12 00:53:01 +01:00
David Herrmann
921d4e8c25 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>
2013-01-12 00:51:23 +01:00
David Herrmann
5853a5c97a 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>
2013-01-11 19:18:15 +01:00
David Herrmann
4965a957b3 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>
2013-01-11 19:09:42 +01:00
David Herrmann
432b1961d1 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>
2013-01-11 17:45:48 +01:00
David Herrmann
b6087af25e 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>
2013-01-11 17:28:29 +01:00
David Herrmann
464fbe7fef 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>
2013-01-11 17:27:22 +01:00
David Herrmann
bbe3a5cc2f 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>
2013-01-11 16:35:25 +01:00
David Herrmann
cad0d410d7 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>
2013-01-11 16:24:37 +01:00
David Herrmann
a272e506f7 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>
2013-01-11 16:01:23 +01:00
David Herrmann
9220d48a42 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>
2013-01-11 16:00:32 +01:00
David Herrmann
686ee42b22 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>
2013-01-11 15:59:33 +01:00
David Herrmann
694f451ae8 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>
2013-01-11 12:16:43 +01:00
David Herrmann
81b691b742 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>
2013-01-08 17:54:53 +01:00
David Herrmann
cadb3e0899 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>
2013-01-07 19:37:44 +01:00
David Herrmann
407a5fc158 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>
2013-01-07 19:31:27 +01:00
David Herrmann
2047b56c80 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>
2013-01-07 19:22:38 +01:00
David Herrmann
50cfef008b 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>
2013-01-07 18:03:45 +01:00
David Herrmann
ebf48cba22 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>
2013-01-07 14:07:14 +01:00
David Herrmann
67ac019dec 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>
2013-01-07 13:40:26 +01:00
David Herrmann
0dc3bf8012 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>
2013-01-07 13:37:17 +01:00
David Herrmann
6e013bca45 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>
2013-01-07 13:34:44 +01:00
David Herrmann
790254766e 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>
2013-01-07 13:24:50 +01:00
David Herrmann
0c008631d7 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>
2013-01-07 13:24:09 +01:00
David Herrmann
9ad1438d55 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>
2013-01-07 13:18:06 +01:00
David Herrmann
77b67694d2 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>
2013-01-06 00:50:12 +01:00
David Herrmann
776566e216 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>
2013-01-06 00:49:38 +01:00
David Herrmann
9fd26ce310 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>
2013-01-03 17:49:39 +01:00
David Herrmann
995c07f853 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>
2013-01-03 17:48:23 +01:00
David Herrmann
b55f6e3284 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>
2013-01-03 17:47:42 +01:00
David Herrmann
72925e0af9 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>
2013-01-03 17:41:50 +01:00
David Herrmann
e9d314b49b 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>
2013-01-03 17:36:23 +01:00
David Herrmann
0cecc8de1e 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>
2013-01-03 17:24:41 +01:00
David Herrmann
074c06eafb COPYING: update copyright to 2013
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-01-03 17:15:54 +01:00
David Herrmann
bef45b7d65 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>
2013-01-03 17:09:18 +01:00
David Herrmann
70b069aacc kmscon: add freetype2 module
The freetype2 module register the freetype2 font backend with kmscon core.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-01-03 17:04:55 +01:00
David Herrmann
b81cff46e5 kmscon: add unifont module
The unifont module registers the unifont font backend with kmscon core.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-01-03 17:04:33 +01:00
David Herrmann
e6fa020937 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>
2013-01-03 17:03:31 +01:00
David Herrmann
e97c71fea1 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>
2013-01-03 16:55:56 +01:00
David Herrmann
c14492796e kmscon: add pango module
The pango module registers the pango font-backend with kmscon.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-01-03 16:30:40 +01:00