1480 Commits

Author SHA1 Message Date
David Herrmann
67355db150 shl: misc: provide shl_next_pow2()
Move the next_pow2() helper to shl_misc.h so we can use it everywhere.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-02-18 19:17:49 +01:00
David Herrmann
dd13dd06ee tests: fix compilation with new eloop API
We added llog-data pointers so fix the tests helpers to set it to NULL by
default.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-02-16 21:41:02 +01:00
David Herrmann
7b1f0438a1 README: update build-instructions
The build-system changed slightly so update the build-instructions.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-02-16 21:34:46 +01:00
David Herrmann
a892f7542b 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>
2013-02-16 21:22:21 +01:00
David Herrmann
0160457914 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>
2013-02-16 21:19:21 +01:00
David Herrmann
1d4f6d4379 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>
2013-02-16 21:05:55 +01:00
David Herrmann
d57c4eb7c9 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>
2013-02-11 16:26:28 +01:00
Jakub Wilk
37f88bd384 Fix several typos
Provided via github. Fixes typos in documentation and comments.

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

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-02-08 16:14:48 +01:00
David Herrmann
36f9d2d0b1 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>
2013-02-06 18:30:13 +01:00
David Herrmann
5ef32794c6 font: freetype2: include tsm_unicode.h
We use TSM symbols so include the right headers.

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

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

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

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

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

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

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

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

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

Observed: key stuck repeat
Expected: key not stuck repeating

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

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

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

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

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

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

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

This is the basic idea:

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

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

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

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

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

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

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

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

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

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

No conceptual changes, just renames and moves.

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

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

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

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

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

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

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

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

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

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

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

This backend is disabled by default.

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

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-01-15 11:09:32 +01:00
David Herrmann
3eb9cc6f50 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>
2013-01-14 20:57:15 +01:00
David Herrmann
0b25c9f68a 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>
2013-01-14 20:53:32 +01:00
David Herrmann
a67f02cf21 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>
2013-01-13 19:30:35 +01:00
David Herrmann
6cae946505 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>
2013-01-13 16:58:31 +01:00
David Herrmann
0fc59ef4d7 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>
2013-01-13 16:11:07 +01:00
David Herrmann
80e5a3b4a6 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>
2013-01-13 16:06:00 +01:00
David Herrmann
df2d153e39 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>
2013-01-13 15:58:40 +01:00
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