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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>