platform/upstream/kmscon.git
11 years agouterm: move uterm_internal.h to uterm_input.h
David Herrmann [Tue, 11 Sep 2012 17:16:54 +0000 (19:16 +0200)]
uterm: move uterm_internal.h to uterm_input.h

uterm_internal.h contains only input related content so we can rename it
and remove all the inclusions where it is not needed.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: move internal video-helpers to uterm_video.h
David Herrmann [Tue, 11 Sep 2012 17:11:01 +0000 (19:11 +0200)]
uterm: move internal video-helpers to uterm_video.h

This splits off all video related helpers of the big internal
uterm_internal.h header into uterm_video.h.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agofakevt: remove unused tool
David Herrmann [Tue, 11 Sep 2012 17:03:29 +0000 (19:03 +0200)]
fakevt: remove unused tool

The fakevt tool is no longer used. The same functionality was integrated
into kmscon with the fake-VT uterm_vt backend.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agogenshader: avoid generating source file during configuration
David Herrmann [Tue, 11 Sep 2012 16:46:28 +0000 (18:46 +0200)]
genshader: avoid generating source file during configuration

There is no need to make genshader being generated by configure, anymore.
We used to use @srcdir@ but this was not embedded into Makefile.am. Hence,
we can avoid this and make it build normally.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agobuild: fix gbm_bo_get_stride() upstream bug
David Herrmann [Tue, 11 Sep 2012 16:41:30 +0000 (18:41 +0200)]
build: fix gbm_bo_get_stride() upstream bug

libkms doesn't link to libdrm so our current check for gbm_bo_get_stride()
fails. This has been fixed upstream but distributions still need to pick
it up. Therefore, we simply add the drm libs to our checks. They are
available at this point, anyway.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agobuild: add uterm pkg-config file
David Herrmann [Tue, 11 Sep 2012 16:01:32 +0000 (18:01 +0200)]
build: add uterm pkg-config file

We intend to make libuterm independent of kmscon so it can be used by
other projects. Therefore, add a pkg-config file for easier integration
into other build systems.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agobuild: reorder makefile
David Herrmann [Tue, 11 Sep 2012 15:59:45 +0000 (17:59 +0200)]
build: reorder makefile

This moves the independent libraries to the top as they can be built
without kmscon, too.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoexternal: add xkbcommon-keysyms.h
David Herrmann [Tue, 11 Sep 2012 15:31:46 +0000 (17:31 +0200)]
external: add xkbcommon-keysyms.h

If libxkbcommon is not available on the current platform, we still want to
be able to use the keysyms. We currently do this by depending on xproto
but this is ugly and we want to avoid this.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoeloop: add pkg-config file
David Herrmann [Tue, 11 Sep 2012 14:54:49 +0000 (16:54 +0200)]
eloop: add pkg-config file

The pkg-config file allows other users of libeloop to more easily
configure build-time options for eloop.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoeloop: add pre-cbs
David Herrmann [Tue, 11 Sep 2012 14:37:30 +0000 (16:37 +0200)]
eloop: add pre-cbs

pre-cbs are similar to post-cbs but they are called _before_ the actual
dispatching takes place. It can be used to perform any actions before
going to sleep.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoeloop: call post-cbs on errors during dispatch
David Herrmann [Tue, 11 Sep 2012 14:36:41 +0000 (16:36 +0200)]
eloop: call post-cbs on errors during dispatch

If the dispatch files or is skipped for whatever reason, we should
nevertheless call the post-cbs to avoid any integration errors.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoeloop: fix unregistering post-cbs
David Herrmann [Tue, 11 Sep 2012 14:34:56 +0000 (16:34 +0200)]
eloop: fix unregistering post-cbs

This is obviously a copy/paste error. This fixes the unregistering to
correctly work now.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoeloop: fix registering post-cb hooks
David Herrmann [Sun, 9 Sep 2012 15:36:14 +0000 (17:36 +0200)]
eloop: fix registering post-cb hooks

We actually have to register the hook-helper before we can add any hooks.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoeloop: improve idle-source logic
David Herrmann [Sun, 9 Sep 2012 14:49:31 +0000 (16:49 +0200)]
eloop: improve idle-source logic

Instead of using an ev_counter object internally, we now directly create a
new eventfd object. This avoids adding/removing the fd from the epoll-set
constantly when adding/removing idle sources. This should increase
idle-source speed considerably.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agollog: add "d"irect variants
David Herrmann [Sun, 9 Sep 2012 14:42:34 +0000 (16:42 +0200)]
llog: add "d"irect variants

The "d" variants of the log functions take a direct pointer to the llog
helper instead of the parent. This is sometimes used when we have no
parent but still want to log errors.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoeloop: add post-dispatch hook
David Herrmann [Sun, 9 Sep 2012 14:14:50 +0000 (16:14 +0200)]
eloop: add post-dispatch hook

When integrating other event-sources or event-loops into eloop which do
not provide FD-abstractions, we often want to check for specific
conditions before returning from the dispatch-callback or going to sleep.
Therefore, you can now register a post-dispatch-cb and check whether your
alien event source is firing. If it is, simply push an idle-source into
the event-loop and it will fire during the next dispatch without going to
sleep.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoeloop: add ev_eloop_get_fd()
David Herrmann [Sun, 9 Sep 2012 13:01:32 +0000 (15:01 +0200)]
eloop: add ev_eloop_get_fd()

This new helper allows retrieving a single file descriptor which
represents the whole event loop. This is very useful if you want to use
your own event loop in combination with libeloop.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoRelease kmscon-4
David Herrmann [Sat, 8 Sep 2012 14:21:45 +0000 (16:21 +0200)]
Release kmscon-4

This is the first public release. Most major features are implemented and
kmscon works reliably. I use it for real work since several weeks now so I
consider it stable.
Anyway, there is still much to do. The TODO list is long...

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agobuild: fix distcheck errors
David Herrmann [Sat, 8 Sep 2012 14:21:09 +0000 (16:21 +0200)]
build: fix distcheck errors

Correctly include everything in the distribution so distcheck and dist
really work.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agodocs: remove gtkdoc
David Herrmann [Sat, 8 Sep 2012 14:19:49 +0000 (16:19 +0200)]
docs: remove gtkdoc

This never really worked and was horrible to maintain. We need to find
something else for documentation, but we will probably have to do it with
a separate XML file without any generator.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agobuild: fix dbus-loop build
David Herrmann [Sat, 8 Sep 2012 14:18:19 +0000 (16:18 +0200)]
build: fix dbus-loop build

We need to include everything in the distribution and fix the
include-path, otherwise, we might get "distcheck" errors.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agolog: add log_dummyf() helper
David Herrmann [Sat, 8 Sep 2012 14:17:04 +0000 (16:17 +0200)]
log: add log_dummyf() helper

Instead of doing nothing we now pass everything to log_dummyf() if a
logging macro is not enabled. This silences all the "unused variable"
warnings which are really annoying.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoUpdate NEWS file
David Herrmann [Sat, 8 Sep 2012 13:36:23 +0000 (15:36 +0200)]
Update NEWS file

Add all new functionality to the NEWS file as "kmscon-4" entry.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: vt: be more verbose on errors
David Herrmann [Sat, 8 Sep 2012 13:36:02 +0000 (15:36 +0200)]
uterm: vt: be more verbose on errors

Print more information when VT allocation fails.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agomain: change default font-size to 15
Marcin Slusarz [Sat, 8 Sep 2012 12:57:54 +0000 (14:57 +0200)]
main: change default font-size to 15

"10" is really small and not really suited as default value. We currently
do debugging a lot and hence using bigger fonts makes that task a lot more
easy. Furthermore, as a "first impression" people get from kmscon, we want
the font to be at a proper size.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agomain: change default TERM to xterm-256color
David Herrmann [Sat, 8 Sep 2012 12:53:49 +0000 (14:53 +0200)]
main: change default TERM to xterm-256color

We have added a lot of more xterm functionality so "xterm-256color" should
be the better default value now. It also makes most applications behave
better as they can use improved control sequences.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agovte: separate color-codes from RGB values
David Herrmann [Sat, 8 Sep 2012 12:48:21 +0000 (14:48 +0200)]
vte: separate color-codes from RGB values

We need to know whether a current attribute was created with a specific
RGB value or whether a vt-color-code was used. This is, because several
affects have to be applied when color-codes are used. For instance, bold
colors are always brightened to simulate "bold".

Therefore, two new fields are added which contain the color-code or -1 if
an RGB value is used. All of this is always applied internally of the VTE
layer so other layers (like the console layer) can be sure, that the RGB
value is always correct and use it.
But the VTE layer needs to keep track of the color-codes so we put them
into the attribute structure.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agovte: make independent of uterm
David Herrmann [Sat, 8 Sep 2012 12:20:53 +0000 (14:20 +0200)]
vte: make independent of uterm

Remove the last reference to uterm structures so we can put the vte layer
into a separate library without any dependency to rendering
infrastructure.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoconsole: make independent of text drawing layer
David Herrmann [Sat, 8 Sep 2012 12:09:09 +0000 (14:09 +0200)]
console: make independent of text drawing layer

We finally want to get rid of any dependencies in the vte/console layer so
we can split it out into a separate library.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoconsole: rename font_char_attr to kmscon_console_attr
David Herrmann [Sat, 8 Sep 2012 11:37:02 +0000 (13:37 +0200)]
console: rename font_char_attr to kmscon_console_attr

This removes this legacy name and also moves the attribute structure into
the console subsystem where it belongs. This currently creates circular
dependencies between text and console layers but we can ignore that for
now and fix it later.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agovte: implement bce-mode (background color erase mode)
David Herrmann [Sat, 8 Sep 2012 10:56:37 +0000 (12:56 +0200)]
vte: implement bce-mode (background color erase mode)

BCE is implemented by all major terminal emulators and activated by
default. If used, then every erase/insert/scroll/delete operation will
redraw the background of the erased/new characters with the current
background color instead of the default background color.

There is currently no way to control this behavior from an application so
you cannot turn it off. However, every terminfo based application can read
whether it is activated from the terminfo database.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotext: font: pango: fix width calculation off by one
David Herrmann [Fri, 7 Sep 2012 12:04:32 +0000 (14:04 +0200)]
text: font: pango: fix width calculation off by one

When using small glyphs, the pango text renderer used to cut off a pixel
of each glyph. This is due to incorrect rounding in width calculation. To
avoid this, we simply increase each glyph by 1 so it will always have
enough space for the whole data.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoterminal: make shortcuts configurable via command-line
David Herrmann [Wed, 5 Sep 2012 17:50:41 +0000 (19:50 +0200)]
terminal: make shortcuts configurable via command-line

This adds command line options to make all currently available keyboard
shortcuts of the terminal layer configurable on the command-line and
config-file.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: input: uxkb: fix compile error in string_to_keysym()
David Herrmann [Wed, 5 Sep 2012 17:50:00 +0000 (19:50 +0200)]
uterm: input: uxkb: fix compile error in string_to_keysym()

Damnit, already pushed and not noticed this bug. Anyway, this fixes the
obvious typo in uxkb module.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: input: include keysym file from main header
David Herrmann [Wed, 5 Sep 2012 17:47:41 +0000 (19:47 +0200)]
uterm: input: include keysym file from main header

We still depend on xproto during compile time as we need the keysym
definitions. We could simply copy the keysym file but I really want to
wait until xkbcommon is finally released as it includes a keysym header,
too. Then we can simply depend on xkbcommon during build.

However, as we still need a way to perform the other conversion: string to
keysym, we need some hashtable anyway. So we can then also copy the keysym
definitions, too.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoconf: add "grab" config data-type
David Herrmann [Wed, 5 Sep 2012 12:07:03 +0000 (14:07 +0200)]
conf: add "grab" config data-type

Grabs are used to specify keyboard shortcuts so they do not have to be
hardcoded into the binary.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: input: add string_to_keysym() helper
David Herrmann [Wed, 5 Sep 2012 12:04:05 +0000 (14:04 +0200)]
uterm: input: add string_to_keysym() helper

This new helper can be used to convert a string description of a keysym
into a real keysym. This is required to allow users to configure keyboard
shortcuts and more.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agodocs: add xkbcommon build instructions to README
ysangkok [Fri, 31 Aug 2012 11:27:29 +0000 (14:27 +0300)]
docs: add xkbcommon build instructions to README

libxkbcommon still has no public release so most distributions do not ship
it. This adds short build-instructions for people who still want to test
it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agobuild: make eloop independent of libkmscon-static
David Herrmann [Tue, 4 Sep 2012 17:10:28 +0000 (19:10 +0200)]
build: make eloop independent of libkmscon-static

This removes the nasty dependency to libkmscon-static for libeloop.
Otherwise, we might end up with GLESv2 dependencies here which is really
not what we want.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agostatic: move hook into separate independent header
David Herrmann [Tue, 4 Sep 2012 17:05:45 +0000 (19:05 +0200)]
static: move hook into separate independent header

This makes the hook implementation independent of any other code or header
so you do not have to link to libkmscon-static when using it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agostatic: move dlist into separate independent header
David Herrmann [Tue, 4 Sep 2012 16:55:08 +0000 (18:55 +0200)]
static: move dlist into separate independent header

This creates a new header static_dlist.h which is independent of any other
code. It can be included by other libraries/applications without the need
of linkin to libkmscon-static which reduces a lot overhead.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoterminal: print debug warning when skipping frames
David Herrmann [Tue, 4 Sep 2012 16:42:31 +0000 (18:42 +0200)]
terminal: print debug warning when skipping frames

If the CPU is too slow to render the console in a decent speed and we have
to skip frames, then we should print warnings if debug mode is on.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agomain: make bbulk renderer the default
David Herrmann [Tue, 4 Sep 2012 16:21:29 +0000 (18:21 +0200)]
main: make bbulk renderer the default

The bbulk renderer performs like 30% better than the bblit renderer so we
should make it the default.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoconsole: add --render-timing parameter
David Herrmann [Tue, 4 Sep 2012 16:16:38 +0000 (18:16 +0200)]
console: add --render-timing parameter

This parameter makes the console subsystem print rendering-performance
information to the debug log. This can be used to find rendering
bottlenecks and compare each render-engine.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoconsole: free tab ruler on init-failure
David Herrmann [Tue, 4 Sep 2012 16:07:32 +0000 (18:07 +0200)]
console: free tab ruler on init-failure

When console initialization fails, we need to free the tab-ruler if it was
allocated.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotext: add bbulk renderer
David Herrmann [Tue, 4 Sep 2012 15:58:37 +0000 (17:58 +0200)]
text: add bbulk renderer

The bbulk renderer is very similar to the bblit renderer but it assembles
a request-buffer of all characters and then pushes these requests via a
vector-call to the video hardware.
This turns out to increase performance slightly as we do not call into the
video subsystem for every characters but only once.

This renderer can reduce performance when used with partial-redraws (which
are not implemented, yet), so we keep the bblit renderer around.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: video: greatly enhance performance by special casing
David Herrmann [Tue, 4 Sep 2012 15:54:22 +0000 (17:54 +0200)]
uterm: video: greatly enhance performance by special casing

If we special-case the "src == 0" and "src == 0xff" cases, then we can
avoid all the heavy calculations most of the time. This reduces rendering
time by like 50%.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agodocs: add some pixman-rendering comments
David Herrmann [Tue, 4 Sep 2012 15:37:14 +0000 (17:37 +0200)]
docs: add some pixman-rendering comments

We didn't use pixman for rendering in kmscon. This documents shows some
code how we could do it but also explains why this would not improve
performance.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agopty: improve application data read-path
David Herrmann [Fri, 31 Aug 2012 18:19:55 +0000 (20:19 +0200)]
pty: improve application data read-path

The kernel tty buffer is actually too small to buffer data for 20ms, which
is the time a frame may take in kmscon so we can still get 50 fps.
However, profiling showed that we often read multiple times from the pty.
We can optimize this by increasing the buffer to match the tty internal
buffer.

The kernel internal buffering is currently the only performance slowdown
that we have. That is, the data an application writes while we do a single
rendering is more than the kernel can buffer. Therefore, the application
waits until we read from the pty again. We then wait with redrawing until
the next vblank.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: video: add vectorized blending
David Herrmann [Thu, 30 Aug 2012 22:00:07 +0000 (00:00 +0200)]
uterm: video: add vectorized blending

Vectorized blending allows pushing multiple blending-requests to the video
hardware at once. This can speed up rendering on 2D devices a lot.
However, the gl-rendering is really just for completeness and shouldn't be
used if performance matters.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: video: drm: fix running without gles2 stride support
David Herrmann [Thu, 30 Aug 2012 20:29:12 +0000 (22:29 +0200)]
uterm: video: drm: fix running without gles2 stride support

Similar to the gltex renderer we need to work around the missing stride
support in plain gles2. Most drivers provide it but we cannot rely on it.
Therefore, we simply allocate a temporary buffer for it. This horribly
breaks performance, but the 2D blitting via DRM was never fast, anyway.
Don't use it except for testing and debugging.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotest_vt: fix using correct uterm API
David Herrmann [Wed, 29 Aug 2012 15:59:21 +0000 (17:59 +0200)]
test_vt: fix using correct uterm API

This still uses the old VT API which now fails as we added a new
parameter. As a side-effect, this test will not work if used on a VT-less
system or on a seat without VTs. But we actually don't care, yet, as any
other VT-replacement isn't really production-ready, yet.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: video: improve blitting performance
David Herrmann [Wed, 29 Aug 2012 15:56:38 +0000 (17:56 +0200)]
uterm: video: improve blitting performance

Turns out gcc didn't optimize this trivial math so we do it by hand. This
reduces the number of divisions per color to 1. This increases performance
by like 15%.

As a second optimization, we replace the division with a left shift, that
is, we divide by 256. Technically, this is wrong as we will get slightly
incorrect results. However, this is hardly noticible by human eye so we
can safely use it. This increases performance by like 20% again.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agomisc: add timer infrastructure
David Herrmann [Wed, 29 Aug 2012 15:54:16 +0000 (17:54 +0200)]
misc: add timer infrastructure

Timers can be used to measure time-delays with microsecond resolution.
This is heavily used for performance-tests and to improve rendering
performance.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agobuild: add GLES2-libraries to kmscon-static
David Herrmann [Wed, 29 Aug 2012 15:51:53 +0000 (17:51 +0200)]
build: add GLES2-libraries to kmscon-static

kmscon-static needs these to build properly. Currently, they are pulled in
via uterm but if it is used without uterm the build will fail.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agomain: add --render-engine option
David Herrmann [Tue, 28 Aug 2012 08:41:33 +0000 (10:41 +0200)]
main: add --render-engine option

This option allows changing the console renderer during runtime. This is
only useful for debugging. The default choice should be best for all
situations.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agogl: shader: do not include uterm.h
David Herrmann [Sun, 26 Aug 2012 16:18:33 +0000 (18:18 +0200)]
gl: shader: do not include uterm.h

The "static" library does not have any dependencies. To avoid compilation
errors, remove this inclusion.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotext: font: add unifont backend
Ted Kotz [Sat, 25 Aug 2012 13:49:44 +0000 (15:49 +0200)]
text: font: add unifont backend

This adds a new Unifont font-backend based on the recently added Unifont
data. The backend is disabled by default for 2 reasons:
  - It takes about 5min to compile and needs >1GB of memory on an Intel
    Atom N450
  - License situation is unclear as it is GPL

Written-by: Ted Kotz <ted@kotz.us>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotext: font: unifont: add genunifont generator
David Herrmann [Sat, 25 Aug 2012 13:36:55 +0000 (15:36 +0200)]
text: font: unifont: add genunifont generator

This new generator converts the unifont hex-encoded data into a C-source
file which then can be compiled statically into the kmscon binary. Please
note that the resulting source file is bigger than 100MB and can take
quite a while to compile.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotext: include errno.h in text.h
David Herrmann [Sat, 25 Aug 2012 12:00:19 +0000 (14:00 +0200)]
text: include errno.h in text.h

text.h uses -EOPNOTSUPP so we should include errno.h to avoid compilation
errors.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agobuild: add temporary files *~ to gitignore
David Herrmann [Sat, 25 Aug 2012 08:46:37 +0000 (10:46 +0200)]
build: add temporary files *~ to gitignore

These files are created by several editors as temporary storage. Ignore
them.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotext: font: add unifont font description
David Herrmann [Sat, 25 Aug 2012 08:43:50 +0000 (10:43 +0200)]
text: font: add unifont font description

The GNU Unifont project provides a bitmap font with a fixed 8x16/16x16
size. The source is encoded as simple hex-file.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agodocs: add unicode test document
Theodore Kotz [Sat, 25 Aug 2012 08:40:38 +0000 (10:40 +0200)]
docs: add unicode test document

This document contains several special Unicode characters which can be
used to test the terminal font-engine/UTF-8-engine.

Written-by: Theodore Kotz <ted@kotz.us>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agobuild: improve gbm_bo_get_stride check
Marcin Slusarz [Wed, 22 Aug 2012 19:45:00 +0000 (21:45 +0200)]
build: improve gbm_bo_get_stride check

There were 3 problems with previous version:
- it didn't take into account libgbm cflags (fatal error: gbm.h: No such file or directory)
- it was vulnerable to gbm.h include bugs (gbm.h:259:50: error: unknown type name 'size_t')
- it was checked even when libgbm was not detected
Fix it.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agobuild: ...and now fix build without GLES2
Marcin Slusarz [Wed, 22 Aug 2012 19:11:47 +0000 (21:11 +0200)]
build: ...and now fix build without GLES2

Defining *_la_CPPFLAGS var in "if...endif" block breaks generation
of Makefile.in - automake assumes it's defined unconditionally and
uses it for building objects.

configure.ac clears all variables if each dependency is disabled so we can
include it unconditionally.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoterminal: remove debug messages
David Herrmann [Wed, 22 Aug 2012 10:59:11 +0000 (12:59 +0200)]
terminal: remove debug messages

These messages should have never been committed, oops. Remove them as they
are really not needed.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: video: drm: check for EGL_KHR_surfaceless_context
Marcin Slusarz [Tue, 21 Aug 2012 21:34:20 +0000 (23:34 +0200)]
uterm: video: drm: check for EGL_KHR_surfaceless_context

Mesa 8.1-devel/9.0-devel stopped exposing EGL_KHR_surfaceless_opengl because
it never actually existed and started exposing EGL_KHR_surfaceless_context.
Check that in addition to EGL_KHR_surfaceless_opengl.

http://cgit.freedesktop.org/mesa/mesa/commit/?id=b50703aea55450e04bcd8154335774786e0f253b

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agobuild: fix build with GLESv2
Marcin Slusarz [Tue, 21 Aug 2012 21:05:37 +0000 (23:05 +0200)]
build: fix build with GLESv2

  CC     src/static_gl_math.lo
In file included from src/static_gl_math.c:35:0:
src/static_gl.h:36:23: fatal error: GLES2/gl2.h: No such file or directory

  CC     src/static_gl_shader.lo
src/static_gl_shader.c:36:23: fatal error: GLES2/gl2.h: No such file or directory

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoterminal: add --fps to limit framerate
David Herrmann [Tue, 21 Aug 2012 15:56:34 +0000 (17:56 +0200)]
terminal: add --fps to limit framerate

Instead of redrawing on change, we now use a framerate-timer which
redraws the screen. This timer stays active for 1s after the last redraw
so we do not enable/disable the timer while the console is under heavy
work-load. This still needs to be benchmarked but it seems to work nicely.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agopty: read all available data instead of only one chunk
David Herrmann [Tue, 21 Aug 2012 15:44:43 +0000 (17:44 +0200)]
pty: read all available data instead of only one chunk

If there is plenty data available, we should read all of it before
returning. Otherwise, we might spend too much time letting the other
subsystems perform actions. This can have the effect, that we render after
each read() on the pty if a redraw takes more time than a single frame.
This is definitely not what we want.

To avoid staying here too long we use a hard-coded maximum. Otherwise, if
the vte layer takes longer than the pty-end writes data to us, we might
stay here forever. This is very unlikely as the VTE layer as no immediate
side-effects that make long computations, but we use it to be on the safe
side.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotext: gltex: fix rendering whithout GL_EXT_unpack_subimage
David Herrmann [Tue, 21 Aug 2012 12:53:59 +0000 (14:53 +0200)]
text: gltex: fix rendering whithout GL_EXT_unpack_subimage

OpenGLESv2 doesn't support specifying stride values for textures without
this extension. So allocate a temporary storage when uploading values
which have a default-stride.

This was reported by "towolf / Tobias Wolf" on github:
  https://github.com/dvdhrm/kmscon/issues/17

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agobuild: add build-time check for gbm_bo_get_stride()
David Herrmann [Tue, 21 Aug 2012 12:38:30 +0000 (14:38 +0200)]
build: add build-time check for gbm_bo_get_stride()

Upstream mesa renamed gbm_bo_get_pitch() to gbm_bo_get_stride(). As gbm
has not seen an official release, they actually don't care but several
users complained about this. Therefore, we simply add a build-time check
for this. However, this may break when mesa is updated without recompiling
kmscon but that is less intrusive.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agogl: add gl_err_to_str() helper
David Herrmann [Mon, 20 Aug 2012 18:10:29 +0000 (20:10 +0200)]
gl: add gl_err_to_str() helper

This helper converts an GL error into a string for easier debugging.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: vt: fix resetting access control on VT-close
David Herrmann [Mon, 20 Aug 2012 12:57:39 +0000 (14:57 +0200)]
uterm: vt: fix resetting access control on VT-close

This is a weird fix. One would think that this is automatically reset when
calling close() on the fd but, suprise, it's not. So lets reset this
manually, otherwise when we close the VT but our application is still
active, the user will never be able to leave the VT again.

Again a hilarious example why the VT API sucks. Really... Get rid of it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: vt: add fake VT via user-input
David Herrmann [Wed, 15 Aug 2012 07:27:11 +0000 (09:27 +0200)]
uterm: vt: add fake VT via user-input

This actually incorporates the fakevt tool into kmscon. That is, if the
user presses ctrl+mod4+F12, we activate or deactivate the fake VT.

This is for debugging only and needs to be made more configurable. Use it
on your own risk.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoconsole: suppress multiple warnings
David Herrmann [Wed, 15 Aug 2012 07:25:55 +0000 (09:25 +0200)]
console: suppress multiple warnings

If a single rendering-round prints more than 3 warnings for
unrenderable-glyphs, we suppress these warnings. This is useful for
debugging rendering errors. As sometimes no glyph was renderable and this
caused >80x24 warnings.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoterminal: add wake-up/sleep logic
David Herrmann [Wed, 15 Aug 2012 07:24:45 +0000 (09:24 +0200)]
terminal: add wake-up/sleep logic

Similar to the UI subsystem, we also need to be aware of our current state
inside of the terminal subsystem. We can now avoid rendering graphics when
not awake. This suppresses odd warnings that occured when keeping an
application active and printing in the terminal while the terminal was in
background.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agomain: correctly wake up UI subsystem
David Herrmann [Wed, 15 Aug 2012 07:23:24 +0000 (09:23 +0200)]
main: correctly wake up UI subsystem

We must wake up the UI system _after_ wakeing up everything else,
otherwise, they might assume everything else is already up.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoui: add sleep/awake logic to UI
David Herrmann [Wed, 15 Aug 2012 06:54:02 +0000 (08:54 +0200)]
ui: add sleep/awake logic to UI

We need to forward all sleep/awake states to the lower subsystems to avoid
overdoing stuff like rendering an user-input. That is, while being asleep
we shouldn't render and/or do any other user-interaction.

This patch simply adds this logic to the UI subsystem, which, however,
does not to anything useful, yet.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: input: make sleep-state recursive
David Herrmann [Tue, 14 Aug 2012 20:57:36 +0000 (22:57 +0200)]
uterm: input: make sleep-state recursive

Instead of using a boolean state we now have an integer and a device needs
to be put asleep as often as it was woken up to be put asleep, and vice
versa.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: uxkb: fix correctly resetting input state
David Herrmann [Tue, 14 Aug 2012 20:47:34 +0000 (22:47 +0200)]
uterm: uxkb: fix correctly resetting input state

We currently have a very subtle bug when modifiers are pressed while
leaving a terminal but released while entering. The internal state will
not be updated and as xkbcommon does not fix this up, we need to recreate
the state when re-entering the terminal.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoterminal: implement basic scrolling-keys
David Herrmann [Tue, 14 Aug 2012 15:09:42 +0000 (17:09 +0200)]
terminal: implement basic scrolling-keys

This implements Shift+UP/DOWN and Shift+PageUp/PageDown as scrolling keys
for terminals. This will later be made configurable so other
keyboard-shortcuts can be used.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoterminal: add --sb-size to control scrollback buffer size
David Herrmann [Tue, 14 Aug 2012 15:08:55 +0000 (17:08 +0200)]
terminal: add --sb-size to control scrollback buffer size

The new sb-size option specifies the size of the scrollback buffer. Use 0
to disable the scrollback-buffer.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoconsole: provide scrollback-buffer helpers
David Herrmann [Tue, 14 Aug 2012 15:02:56 +0000 (17:02 +0200)]
console: provide scrollback-buffer helpers

These helpers allow moving around in the scrollback-buffer. Scrolling
bigger portions of the screen is quite slowly as we have to traverse a
list. However, nothing compared to screen-rendering so we can ignore this.
But O(n) is always bad...

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agovte: return status in kmscon_vte_handle_keyboard()
David Herrmann [Tue, 14 Aug 2012 15:01:55 +0000 (17:01 +0200)]
vte: return status in kmscon_vte_handle_keyboard()

We now return whether the key had any effect. This can be used by the
terminal handler to perform various actions on user-input.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agomain: add --dumb option to control uterm devices
David Herrmann [Tue, 14 Aug 2012 14:34:28 +0000 (16:34 +0200)]
main: add --dumb option to control uterm devices

The --dumb option disables hardware-accelerated rendering and instead uses
the dumb-DRM devices.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agomain: add font options
David Herrmann [Tue, 14 Aug 2012 14:29:55 +0000 (16:29 +0200)]
main: add font options

This adds two options --font-size and --font-name that can be used to
configure which font is used.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoconf: add UINT as new datatype
David Herrmann [Tue, 14 Aug 2012 14:23:03 +0000 (16:23 +0200)]
conf: add UINT as new datatype

The "uint" type parses an unsigned integer as argument.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: input: do not include main.h
David Herrmann [Tue, 14 Aug 2012 14:22:15 +0000 (16:22 +0200)]
uterm: input: do not include main.h

The uterm library does not need and must not depend on main.h. Remove the
unneeded inclusion.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agovte: add --palette=XY to choose color palette
David Herrmann [Tue, 14 Aug 2012 14:05:40 +0000 (16:05 +0200)]
vte: add --palette=XY to choose color palette

This adds two more color-palettes and a mode to choose the used palette.
The "solarized" palettes are from an online project that tries to optimize
color palettes.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agovte: add COLOR_FOREGROUND/BACKGROUND to palette
David Herrmann [Tue, 14 Aug 2012 13:52:26 +0000 (15:52 +0200)]
vte: add COLOR_FOREGROUND/BACKGROUND to palette

Instead of hard-coding these values we simply put them into the palette.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agovte: make color-palette configurable
David Herrmann [Tue, 14 Aug 2012 13:47:13 +0000 (15:47 +0200)]
vte: make color-palette configurable

This adds a color-palette-pointer to VTE objects so each VTE object can
have a different palette. This allows runtime configuration of terminal
colors.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoconsole: add function to set default-attribute
David Herrmann [Tue, 14 Aug 2012 13:44:55 +0000 (15:44 +0200)]
console: add function to set default-attribute

This new function allows other layers to control the default attribute of
a console. This attribute is used when clearing the screen or when
allocating new cells.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoconsole: remove kmscon_console_set_bg()
David Herrmann [Tue, 14 Aug 2012 13:11:19 +0000 (15:11 +0200)]
console: remove kmscon_console_set_bg()

This function is no longer needed so we can safely remove it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agofakevt: add fakevt helper for VT-less systems
David Herrmann [Sun, 12 Aug 2012 11:33:10 +0000 (13:33 +0200)]
fakevt: add fakevt helper for VT-less systems

The fakevt helper binary can be used on VT-less systems or seats to make
kmscon activate the fake VT and deactivate it. This way, you can control
when kmscon acquires video devices and when it releases them.

This is a global setting that affects all seats where kmscon is running
except seat0 if it uses real VTs.

This should only be used for debugging. This is really no intended for use
in production.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: vt: fix checking for /dev/tty0 instead of /dev/tty
David Herrmann [Sun, 12 Aug 2012 11:31:19 +0000 (13:31 +0200)]
uterm: vt: fix checking for /dev/tty0 instead of /dev/tty

/dev/tty may be available even though CONFIG_VT is not set. Therefore,
check for /dev/tty0 instead which is guaranteed to be not available with
CONFIG_VT=n.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotest_output: add --dev parameter
David Herrmann [Sun, 12 Aug 2012 11:30:51 +0000 (13:30 +0200)]
test_output: add --dev parameter

The --dev parameter is used to specify the device that is used for
testing.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: monitor: fix crash during device hotplug
David Herrmann [Sun, 12 Aug 2012 11:26:16 +0000 (13:26 +0200)]
uterm: monitor: fix crash during device hotplug

We must make sure that the returned value is non-NULL, otherwise we crash
during device-change events for non-DRM-Hotplug events.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: vt: add fake-vt logic for debugging
David Herrmann [Sun, 12 Aug 2012 09:18:48 +0000 (11:18 +0200)]
uterm: vt: add fake-vt logic for debugging

This adds a very limited non-multi-seat-capable fake-VT logic. If you use
this in production it will break your multi-seat systems so do not use it
except for debugging.

On SIGUSR1 we activate fake VTs and on SIGUSR2 we deactivate them. The
signals must be sent from a priviledged process. Kernel signals are
ignored.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: vt: ignore non-kernel signals in real-mode
David Herrmann [Sun, 12 Aug 2012 08:21:11 +0000 (10:21 +0200)]
uterm: vt: ignore non-kernel signals in real-mode

If using real linux VTs, we must ignore all signals that are not sent from
the kernel. Otherwise, we might get problems if we reuse SIGUSR for other
functionality.
Note that we already check that we are the active VT before handling
SIGUSR. However, this hardens this check to be more sure that this is
really the signal we want.

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