890 Commits

Author SHA1 Message Date
David Herrmann
2d3166a847 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>
2012-09-05 14:07:03 +02:00
David Herrmann
7ff4426bc3 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>
2012-09-05 14:04:05 +02:00
ysangkok
9754f71c16 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>
2012-09-04 22:12:57 +02:00
David Herrmann
174722b400 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>
2012-09-04 19:10:28 +02:00
David Herrmann
700b12b89d 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>
2012-09-04 19:05:45 +02:00
David Herrmann
5c3bad843c 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>
2012-09-04 18:55:08 +02:00
David Herrmann
facb99b913 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>
2012-09-04 18:42:31 +02:00
David Herrmann
6bc433dc8b 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>
2012-09-04 18:21:29 +02:00
David Herrmann
9a33668923 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>
2012-09-04 18:16:38 +02:00
David Herrmann
79a07358a9 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>
2012-09-04 18:07:32 +02:00
David Herrmann
6ae5ddc0e7 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>
2012-09-04 17:58:37 +02:00
David Herrmann
720d8d8dfd 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>
2012-09-04 17:56:03 +02:00
David Herrmann
816dcfb148 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>
2012-09-04 17:37:14 +02:00
David Herrmann
69bde6077e 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>
2012-08-31 20:19:55 +02:00
David Herrmann
3386aa955b 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>
2012-08-31 00:00:07 +02:00
David Herrmann
107581b7e4 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>
2012-08-30 23:57:18 +02:00
David Herrmann
fc913dd238 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>
2012-08-29 17:59:21 +02:00
David Herrmann
efce8e1747 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>
2012-08-29 17:56:38 +02:00
David Herrmann
c0047d701a 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>
2012-08-29 17:54:16 +02:00
David Herrmann
1637e7fd30 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>
2012-08-29 17:51:53 +02:00
David Herrmann
e1a6437473 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>
2012-08-28 10:41:33 +02:00
David Herrmann
232486dfd3 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>
2012-08-26 18:18:33 +02:00
Ted Kotz
4788267a9c 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>
2012-08-25 17:04:51 +02:00
David Herrmann
e9b523c3f1 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>
2012-08-25 15:36:55 +02:00
David Herrmann
ec808aba12 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>
2012-08-25 14:00:19 +02:00
David Herrmann
51f2ab81e0 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>
2012-08-25 10:46:37 +02:00
David Herrmann
711b4ffe76 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>
2012-08-25 10:45:51 +02:00
Theodore Kotz
68dc2f84e6 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>
2012-08-25 10:42:22 +02:00
Marcin Slusarz
569868ed62 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>
2012-08-23 22:03:02 +02:00
Marcin Slusarz
6a61caab9a 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>
2012-08-23 21:07:26 +02:00
David Herrmann
beb7c25137 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>
2012-08-22 12:59:11 +02:00
Marcin Slusarz
a0a6237825 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>
2012-08-22 12:57:08 +02:00
Marcin Slusarz
6094ff1603 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>
2012-08-22 12:56:00 +02:00
David Herrmann
8398f4b0f9 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>
2012-08-21 17:59:02 +02:00
David Herrmann
a05815eb71 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>
2012-08-21 17:44:43 +02:00
David Herrmann
5f59c7953c 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>
2012-08-21 14:53:59 +02:00
David Herrmann
7ad970c1f4 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>
2012-08-21 14:38:30 +02:00
David Herrmann
585879281f 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>
2012-08-20 20:10:29 +02:00
David Herrmann
5dfc12ee6a 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>
2012-08-20 14:57:39 +02:00
David Herrmann
06d33f6636 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>
2012-08-15 09:27:11 +02:00
David Herrmann
7ad2044077 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>
2012-08-15 09:25:55 +02:00
David Herrmann
40ef6f9491 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>
2012-08-15 09:24:45 +02:00
David Herrmann
2ba0cc5ec2 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>
2012-08-15 09:23:24 +02:00
David Herrmann
dbb589c55b 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>
2012-08-15 08:54:02 +02:00
David Herrmann
d372390734 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>
2012-08-14 22:57:36 +02:00
David Herrmann
5aade75f3d 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>
2012-08-14 22:47:34 +02:00
David Herrmann
b697fcd43c 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>
2012-08-14 17:09:42 +02:00
David Herrmann
5a24d624ae 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>
2012-08-14 17:08:55 +02:00
David Herrmann
4f57e7b3d2 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>
2012-08-14 17:02:56 +02:00
David Herrmann
681c9acb4c 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>
2012-08-14 17:01:55 +02:00