691 Commits

Author SHA1 Message Date
David Herrmann
bed915dfb6 uterm: video: fbdev: add support for non xrgb32 devices
This adds blitting/blending/filling support for devices which are not the
classic xrgb32 device. bpp=24 is not supported as it is still unclear how
3-byte integers look like in mixed/big endian.

This uses a very basic dithering technique to check for errors between the
real and computed values which is then distributed horizontally only.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-11 13:51:10 +02:00
David Herrmann
ea62198b6e test_output: always use blitting backend
This removes the currently non-working OpenGL test and always uses the
blitting functions.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-11 13:21:15 +02:00
David Herrmann
faa12b6a61 uterm: fbdev: add udlfb workaround
udlfb incorrectly reports framebuffer sizes. That is, if we request a
framebuffer twice the size as the real framebuffer for double-bufferring,
it will accept these values and report success. We can even map this
virtual framebuffer successfully! However, the memory that is internally
allocated is only the real smaller framebuffer and we will get segfaults.
This might even leak internal kernel memory so we should fix this on
kernel-side as soon as possible.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-11 11:32:55 +02:00
David Herrmann
e5dfe1164d Remove fonts/ directory
This directory and the DejaVu Font is no longer used and replaced with a
proper fontconfig subsystem. There is also another in-memory font in the
8x16 font subsystem so no need to have this one.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-10 18:03:32 +02:00
David Herrmann
7a64adeca9 Move doc/vte.txt to docs/vte.txt
There is really no reason to have _two_ documentation directories.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-10 18:02:32 +02:00
David Herrmann
7ae88d4ed7 eloop: finish documentation
Finish source code documentation. gtk-doc isn't working very well so this
probably needs to be re-done, but not now...

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-10 18:01:14 +02:00
David Herrmann
48d9743be5 console: correctly catch text-renderer errors
We should check for errors to avoid doing all the rendering even though
the text-renderer already failed. Also print debug messages if specific
intermediate steps fail.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-10 11:53:25 +02:00
David Herrmann
ac8cc08f41 terminal: check for errors when initializing text renderer
We need to check for errors, otherwise, the text-renderer may be invalid
and we will never be able to render on it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-10 11:51:02 +02:00
David Herrmann
4e9ad1b915 terminal: choose "gltex" renderer if OpenGL is available
If the uterm backend supports OpenGL, then we should use the "gltex"
renderer as the "bblit" renderer performs pretty badly on OpenGL displays.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-10 11:49:12 +02:00
David Herrmann
2652637fb9 text: fix choosing fallback backend
We didn't correctly choose the fallback backend but instead used the
last-registered backend. Fix this.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-10 11:48:28 +02:00
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