28 Commits

Author SHA1 Message Date
David Herrmann
6f14e5905d build: replace genshader by binary linker
Instead of generating C source files, we now use our binary-linker make
target which can link in any arbitrary binary file.

This way, we can delete genshader and instead link the files directly.
This speeds up compilation and makes the code more consistent.
We also strip the shaders from useless comments and whitespaces to reduce
memory consumption.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-11-03 12:15:35 +01:00
David Herrmann
0a098393c2 shl: shader: add "len" parameter to shader sources
Shader sources may not be 0 terminated if we mmap() them. Hence, we need
to pass the length to the shader compiler. As glShaderSource() allows this
<0 as zero-terminated strings, we can simply add a parameter for the
shader length.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-11-03 12:12:29 +01:00
David Herrmann
924a732e7c shl: move static_gl_* to shl_gl_*
No need to keep these static helpers outside of SHL. Instead, include them
in SHL to avoid any external linking.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-11-03 12:12:07 +01:00
David Herrmann
c4193b81d7 gltex: fix GL_UNPACK_ROW_LENGTH(_EXT) update
Khronos updated their GLES2 headers and broke backwards compatibility,
hurray. Fix it for real now.

Reported-by: Yichao Yu <yyc1992@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-08-19 23:30:54 +02:00
David Herrmann
0249b2cb0b shl: move log.[ch] to shl_log.[ch]
We want to avoid any static files that are shared between multiple
programs but are not part of SHL. These make the build-process just more
complex.
Move log.[ch] to SHL so we have a known context.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-03-04 14:40:36 +01:00
David Herrmann
67355db150 shl: misc: provide shl_next_pow2()
Move the next_pow2() helper to shl_misc.h so we can use it everywhere.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-02-18 19:17:49 +01:00
David Herrmann
577a9b4c41 llog: add "data" parameter to pass context
If we allow users to specify log functions, we should also allow them to
pass a context. This isn't used internally, but may be needed by external
users so provide it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-02-08 16:14:48 +01:00
David Herrmann
3eb9cc6f50 uterm: video: return buffer information on display_use()
uterm_display_use() now returns the current back-buffer index when called.
It returns <0 on error. Whether OpenGL is supported is returned via a new
parameter "opengl". Set it to NULL if you're not interested.

Note that a backend might support OpenGL _and_ memory-mapped buffer
access. But you shouldn't rely on uterm_display_use() to return the
correct buffer-index if uterm_display_get_buffers() is not supported. For
instance the DRM-3D backend always returns 0 as buffer index as it has no
way of detecting it, yet.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-01-14 20:57:15 +01:00
David Herrmann
50cfef008b uterm: move video API into uterm_video.h
Split the main header to avoid having it as dependency in so many places.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-01-07 18:03:45 +01:00
David Herrmann
9fd26ce310 text: remove old init/deinit helpers
We no longer need these helpers so remove them. We require each backend to
register itself as part of module-loading so no need to keep these
helpers.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-01-03 17:49:39 +01:00
David Herrmann
0cecc8de1e text: add owner field to text-ops
When text-ops are registered via modules, we need an owner field so
they're correctly tracked. Hence, add this field to all text-ops and
correctly keep module references.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-01-03 17:24:41 +01:00
David Herrmann
60c2851d64 text: gltex: fix y-inversion with new gbm-surfaces
The standard OpenGL surfaces are y-inverted (which we didn't implement
correctly previously when using our own gbm-surfaces). Therefore, we need
to flip the y-coordinates now as we use correct GL surfaces with the new
drm-uterm backend.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-21 15:30:19 +01:00
David Herrmann
1657bb9a3a text: add render-support for multi-cell glyphs
Multi-cell glyphs are glyphs that span across multiple horizontal cells.
The font renderers already support this. This patch fixes the console
renderers to take advantage of this.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-10 16:00:08 +01:00
David Herrmann
636c383c68 text: gltex: free atlas during destruction
If we remove an atlas, we have to correctly free its memory. Otherwise, we
will loose the memory.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-02 13:40:53 +01:00
David Herrmann
5f234e6592 text: use uterm_display directly
Instead of using the uterm-screen indirection, we now directly access
uterm-display objects. We do not really intend to use virtual screens with
kmscon so there is no need to make this more complex.

I don't think consoles should every provide this feature. Instead, you
should use real compositors for such tasks like Wayland+wlterm. kmscon,
however, is rather an emergency tool or a safe backup than a fancy
daily-use-console.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-26 16:50:39 +01:00
David Herrmann
f9e2818b9a text: gltex: use bold fonts
Make the gltex renderer use bold fonts for bold characters. Internally, we
use a separate hashtable to cache all glyph information. As the hash-key
is the unicode ID, we have to use a separate table for bold glyphs. This
doesn't affect performance, though.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-11-08 14:16:28 +01:00
David Herrmann
32faedbfb4 Fix printf() specified bugs all over the code
When enabling the printf() logic for the logging subsystem, several
warnings were produced about missing or wrong specifiers. This fixes all
those occurrences.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-30 18:01:35 +02:00
David Herrmann
efb210469d console: rename prefix to tsm_screen_*
This is part of the TSM library creation. We also rename "console" to
"screen" as this layer actually manages the screen.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 14:49:20 +02:00
David Herrmann
f2c1dd77ff text: pass symbol-data directly into text layer
Instead of converting symbols into UCS4 string in each backend, we now
pass the whole data from the console layer into the renderers.

This makes all renderers indepedent of any recently introduced
symbol-tables and they can be implemented inside of TSM without exporting
them. However, we still need to pass the IDs to the text layer. The text
layer must not use them for anything but identification. Moreover, it must
never assume that they are valid tsm_symbol_t values.
We do this so the backends can still have fast hashtable lookups rather
than allocating big keys containing the UCS4 string+length and using these
for lookups.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 13:46:44 +02:00
David Herrmann
cca90781c0 tsm: move unicode.[ch] to tsm_unicode.[ch]
All TSM related files will get the tsm_* prefix so move unicode headers
and sources.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 10:54:06 +02:00
David Herrmann
93c553c1bc shl: move timer to shl_timer_*
This moves the timers to SHL and removes the old static_misc header and
source. They are no longer needed.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-16 17:08:21 +02:00
David Herrmann
f3e3973d56 shl: move kmscon_hashtable to shl
This moves the whole hashtable implementation into the SHL library. Now we
can link it only to the applications that really use it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-16 09:13:30 +02:00
David Herrmann
aed1373bc6 shl: move dlist to shl_dlist.h
Instead of including dlist in the static library, we now move it to SHL.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-15 20:11:00 +02:00
David Herrmann
715e247676 shl: move dlist implementation to shl_dlist_*
Shl (Static helper library) is the new name of all static helpers in
kmscon that might be shared between different applications.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-15 19:10:37 +02:00
David Herrmann
61e0d9d098 unicode: move kmscon_symbol* to tsm_symbol*
All the unicode helpers are move to TSM so move the symbols, too.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-14 18:26:43 +02:00
David Herrmann
4250cffd6c 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>
2012-09-08 13:37:02 +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
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