681 Commits

Author SHA1 Message Date
David Herrmann
df84e9f217 text: gltex: add OpenGL text renderer
This adds an OpenGL text renderer. It uses textures to store glyph
information and renders the characters by assembling a vertex-list first.
To improve performance, we use texture-atlases.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-10 11:43:07 +02:00
David Herrmann
ac3fa529dc text: rework text renderer system
This reworks the text renderer system to make it easier to write backends.
We also allow returning errors during rendering now.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-10 11:42:00 +02:00
David Herrmann
4ee5c05b57 uterm: video: drm: reset vertex-attrib-arrays after use
We should reset all used vertex-attrib-arrays, otherwise, we have to reset
them before drawing as we cannot sure that some other renderer left them
on.
As a rule we always assume a reset state similar to our assumption that no
VBO is bound during rendering.

This is a quite bad side-effect from OpenGL being a state-machine. As we
are a library, we cannot make any undocumented assumptions about the
OpenGL state. Therefore, we try to be as strict as possible.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-10 11:38:42 +02:00
David Herrmann
ee71531870 build: make bblit backend optional
This allows configuring the bblit backend during kmscon-build. If other
rendering backends are preferred, you can now compile kmscon without the
bblit backend.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-08 19:33:34 +02:00
David Herrmann
e1bf9c5c19 uterm: video: drm: implement .blit, .blend and .fill callbacks
This implements the static 2D blitting callbacks for the DRM backend. It
uses OpenGL to push the images with textures through the rendering
pipeline. Please note that this is horribly slow when used like 2D
blitting. However, it is a safe backend and better than nothing.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-08 19:11:42 +02:00
David Herrmann
c677377e04 gl: add shader helpers
New helper functions for working with OpenGL shaders.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-08 15:32:01 +02:00
David Herrmann
1de4f67f44 misc: fix returning false in kmscon_hashtable_find() when invalid
We currently return "true" if the hashtable is invalid which is
irritating. Fix this to be "false".

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-08 15:14:35 +02:00
David Herrmann
f880a3abdb misc: fix rehashing hashtable entries
We need to hash the key instead of the whole entry, otherwise, we have
dead/wrong entries in the hash-table after a rehash-round.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-08 15:13:49 +02:00
David Herrmann
2e06e93a80 llog: mark llog_format as unused
Gcc emits useless warnings when llog_format is not used so mark it as
unused.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-08 13:02:44 +02:00
David Herrmann
70a503d00c static: add gl math helpers
These are the same helpers that were previously removed, however, they are
now part of the static-kmscon library and can be stripped away by the
linker.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-08 12:26:35 +02:00
David Herrmann
9fe063e274 genshader: make shader generation more flexible
The genshader program now takes all input shaders as arguments so we can
easily add new shaders. We also name the constants after the shader file
to be as flexible as possible.

This also moves the generated shaders into the static-kmscon library. The
linker will strip unused symbols, anyway, so we aren't loosing anything
here.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-08 12:13:29 +02:00
David Herrmann
2da673ec8f gl: remove GL subsystem
The GL subsystem is no longer used so we can remove it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-08 11:36:51 +02:00
David Herrmann
beb36e962d terminal: remove gl.h include
We do not use this header inside of the terminal subsystem so we can
remove it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-08 11:28:23 +02:00
David Herrmann
f1f8fac0ec font: remove font.h
This header is unused so we can remove it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-08 11:28:03 +02:00
David Herrmann
002e8fb65e text: move font_char_attr to text.h
This way we can now remove all font.h includes. We can rename the
structure later.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-08 11:27:19 +02:00
David Herrmann
5126c02f17 uterm: video: drm: adopt new libgbm API
libgbm changed the API (why?) so we need to use get_stride() instead of
get_pitch().

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-08 11:21:20 +02:00
David Herrmann
1f5fa54bfe terminal: remove OpenGL drawing stubs
Drawing with OpenGL didn't work, so we can safely remove the stubs.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-08 11:20:36 +02:00
David Herrmann
f8e342c019 misc: remove log references
The static-* code does not depend on the log subsystem so it should not
include the header nor define some internal logging helpers.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-06 19:04:04 +02:00
David Herrmann
9ae00680df text: bblit: remove unused private data
The bit-blitting renderer does not really use the helper structure so
remove it and simplify the code a lot.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-06 15:44:41 +02:00
David Herrmann
a7f703f8c1 build: add --disable-optimizations option
We are in a state where redrawing the console can take a significant
amount of time on slower machines. Therefore, we definitely need gcc code
optimizations which help here a _lot_. However, they are currently bundled
to the debug flags.

This splits this into two options. We still need this flag to get getter
backtraces. Otherwise, those inlined functions are horrible to track done.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-06 15:27:53 +02:00
David Herrmann
d057ecadae Suppress some odd gcc warnings
As gcc is not aware of out list-semantics, it warns about uninitialized
variables when in fact we know that they must be initialized. Suppress
some by initializing the variables to NULL.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-06 15:04:42 +02:00
David Herrmann
3f492d9553 text: bblit: do not clear screen
The console layer guarantees that all glyphs are sent to the renderer so
there is no need to clear the screen before redrawing.

This reduces flickering of single-buffered video backends.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-06 14:54:34 +02:00
David Herrmann
0fee19a8c0 text: font: Simplify font-system and add freetype2 renderer
The freetype2 renderer uses ft2 and fontconfig to provide a very
simplistic renderer. We also simplify the logic of the whole subsystem a
lot and guarantee that each glyph will have the same size now.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-06 14:48:22 +02:00
David Herrmann
1ce3b14ca6 uterm: uxkb: fix typo in (u)xkb_available=false
When compiling without xkbcommon we currently get compiler errors as the
uxkb_available variable hasn't been correctly renamed previously.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-06 14:47:12 +02:00
David Herrmann
c52ecdfa6b conf: add "font-engine" option
This option allows to select the font-engine during run-time.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-06 14:45:03 +02:00
David Herrmann
2e667f583a Remove old font renderer sources
font_freetype.c was unused for long and font_pango.c has been removed
recently.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-01 15:42:35 +02:00
David Herrmann
5517fa16bd Use new text renderer
This fixes the console and terminal layer to use the new text renderer
instead of the old one.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-01 15:41:22 +02:00
David Herrmann
b074966af1 text: font: pango: fix memory allocation
Whoops, we were checking the wrong variable. Fix the OOM check to
correctly catch the right errors.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-31 16:59:36 +02:00
David Herrmann
b04410f1a9 text: add bblit text-renderer
The bblit text-renderer is the most basic renderer which simply blits or
blends the glyphs into the framebuffer memory. It cannot be used with
displays that do not provide framebuffer access but only 3D access.
However, 3D rendering is currently broken, anyway, so we can ignore it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-31 16:50:20 +02:00
David Herrmann
b31e7565c3 text: add text renderer subsystem
The text-renderer subsystem provides a way to register arbitrary
text-rendering backends. These backends use the font-objects to draw the
console into a framebuffer.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-31 16:49:32 +02:00
David Herrmann
a0c8fd5f83 text: font: pango: fix font width being 0
We must avoid having a width of zero, otherwise, the text renderers might
divide by zero.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-31 16:46:22 +02:00
David Herrmann
1ef98f6ee4 text: font: correctly measure pango fonts
We need to actually increase the character count, otherwise, we will never
have a measurement set.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-31 16:44:28 +02:00
David Herrmann
65424fa304 vte: add CHA CSI
The CHA CSI is used to move the cursor horizontally but keep the vertical
position.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-31 14:57:47 +02:00
David Herrmann
2898851269 vte: add VPA/VPR CSIs
VPA and VPR are used to change the current line but keep the column. One
does an absolute positioning and one a relative positioning.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-31 14:57:04 +02:00
David Herrmann
1a84c938da vte: add SU/SD CSIs
SU and SD are used to scroll-up and scroll-down the visible buffer.
Margins are kept and the cursor position does not change. This is a valid
vt510 CSI.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-31 14:56:11 +02:00
David Herrmann
b4bbc2b087 console: add *_console_scroll_up()/_down() helpers
Xterm supports CSIs which simply move the visible buffer up/down so we
need these helpers to perform such operations from the VTE layer.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-31 14:54:58 +02:00
David Herrmann
51b70bef52 uterm: video: add blend() helper
When drawing single glyphs we often have the glyph as alpha-only buffer so
we can draw it with any color we want. blit() requires a full image that
can be copied, so the new blend() helper is introduced which takes a
foreground and background color and blends in an image. Only plain-alpha
buffers are currently supported.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-31 14:24:45 +02:00
David Herrmann
6ab01cbf6b uterm: video: fix blit() and fill() height adjustments
Whoops, we missed the last line for all blit()/fill() operations. Fix the
decrement to correctly count as many lines as given.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-31 13:35:18 +02:00
David Herrmann
7c075e3891 uterm: video: remove unused UTERM_FORMAT_MONO
This format is not used, neither implemented, so it is safe to remove the
constant.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-31 13:12:05 +02:00
David Herrmann
254cb5f6cb uterm: video: remove fbdev_display_map() orphan
The dummy fbdev backend included this function to allow outside access to
the framebuffer. This has for long been replaced with blit() and fill()
helpers and it was never actually implemented. Hence, remove the helper
function.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-31 10:32:43 +02:00
David Herrmann
023fb41bb4 test_output: add blitting support
When opengl rendering is not available on the target device, we now fall
back to software rendering. Instead of drawing a nice gradient we now draw
a white screen to the target device to avoid heavy calculations.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-31 10:31:40 +02:00
David Herrmann
aada3038e1 uterm: video: add fill() helper
When using unaccelerated video we want to be able to fill a region of the
target framebuffer with a solid color. Hence, this adds the fill() helper
function with similar semantics to blit() but it uses a solid RGB color
value to fill in the framebuffers.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-31 10:29:52 +02:00
David Herrmann
361177fe97 uterm: video: change blit'ting logic
Instead of passing width/height separately, we now use the values from the
buffer object. The caller has to manipulate the buffer object to change
these values. In fact, they can simply create a buffer object on the stack
with the same values copied from the real buffer and just adjust the
offset, width, height and stride. With the help of the stride value, it is
possible to even shrink the buffer horizontally.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-31 10:22:39 +02:00
David Herrmann
20e0e69253 test_input: fix compilation for kbd_keysym_to_string()
Since we moved to a runtime backend system for the input subsystem, we
cannot access the internal keysym_to_string() helpers anymore. Hence, use
the recently introduced uterm-input forwarding helper.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-31 10:01:32 +02:00
David Herrmann
dd3d67a6f4 uterm: input: add uterm_input_keysym_to_string()
There is no much gain from having an internal kbd_desc_keysym_to_string()
function if we cannot get access to the kbd_desc object. Therefore, add a
forward helper to uterm_input() which forwards the call to its internal
kbd_desc object. This allows outside access to the keysym_to_string()
function.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-31 10:00:03 +02:00
David Herrmann
99b2038f7f text: font: add pango font backend
The pango font backend is similar to the currently used older backend but
provides the new API. It is modular so we can disable it if not needed.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-30 17:44:02 +02:00
David Herrmann
36938b59d7 text: font: replace x/y offsets with baseline attribute
When rendering underlines we need the baseline attribute. Therefore,
replace the unused x/y offsets with a baseline attribute.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-30 17:42:21 +02:00
David Herrmann
48beed72f4 build: add text-subsystem to build-sources
This finally adds the new font renderers to the build-sources so they are
actually built.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-30 11:09:57 +02:00
David Herrmann
f55715b60b external: htable: remove config.h inclusion
There is no need to include config.h manually so remove this to avoid
compilation errors when compiling external applications.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-30 11:08:55 +02:00
David Herrmann
d5f85bba13 text: font: Add 8x16 font
The 8x16 font is a static in-memory font that can be used as safe
fallback. It does not allow scaling or other font decorations so it's
really just for very basic text-layouts.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-28 16:40:22 +02:00