platform/upstream/libtsm.git
10 years agoRemove old hashtable and replace tests
David Herrmann [Wed, 23 Oct 2013 16:12:04 +0000 (18:12 +0200)]
Remove old hashtable and replace tests

shl_hashtable is no longer used. Remove it and replace the tests with
shl_htable tests.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
10 years agounicode: use new faster htable
David Herrmann [Wed, 23 Oct 2013 16:05:19 +0000 (18:05 +0200)]
unicode: use new faster htable

Replace the old shl_hashtable with shl_htable, which avoids the additional
allocations and is considerably faster. The underlying hash-table is still
the same, but our boilerplate code is reduced heavily.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
10 years agounicode: simplify hash_ucs4 and cmp_ucs4
David Herrmann [Wed, 23 Oct 2013 16:03:35 +0000 (18:03 +0200)]
unicode: simplify hash_ucs4 and cmp_ucs4

Both are overly complex. Remove the boilerplate and redundant code.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
10 years agounicode: remove the default symbol table
David Herrmann [Wed, 23 Oct 2013 15:30:00 +0000 (17:30 +0200)]
unicode: remove the default symbol table

We don't use the default table, anymore. Remove it so no-one else will
ever have the stupid idea to use it again.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
10 years agoscreen: allocate private symbol table
David Herrmann [Wed, 23 Oct 2013 15:19:07 +0000 (17:19 +0200)]
screen: allocate private symbol table

We shouldn't use the global symbol table. It's not thread-safe. Allocate a
new one for private use in tsm_screen.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
10 years agoRemove internal symbols from public API
David Herrmann [Wed, 23 Oct 2013 15:10:59 +0000 (17:10 +0200)]
Remove internal symbols from public API

These symbols have been used by kmscon once internally. We copied them
over during libtsm extraction. Remove them now so no-one else uses them.
They're for internal use only!

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
10 years agoMove shl_misc.h into libtsm_int.h
David Herrmann [Wed, 23 Oct 2013 14:30:20 +0000 (16:30 +0200)]
Move shl_misc.h into libtsm_int.h

Add a single internal header for all our shared but private code. Remove
now unused shl_misc.h.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
10 years agoshl: move next_pow2() into shl_array
David Herrmann [Wed, 23 Oct 2013 14:24:49 +0000 (16:24 +0200)]
shl: move next_pow2() into shl_array

We use next_pow2() only in the shl_array implementation, so move it. We
want shl APIs to be self-contained so this removes the array->misc
dependency.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
10 years agoSanitize header
David Herrmann [Wed, 23 Oct 2013 14:15:09 +0000 (16:15 +0200)]
Sanitize header

Add C++ protection and proper docbook comments so we can later hook it up.
No huge documentation, but at least some proper grouping is added.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
10 years agoscreen: add screen-age to API
David Herrmann [Wed, 23 Oct 2013 13:31:03 +0000 (15:31 +0200)]
screen: add screen-age to API

This adds the "ageing"-concept to the screen API. Each cell now has an
integer attached which describes its age. Furthermore, the whole screen
has an age-counter which is increased on every change we do on the screen.
Whenever we modify a cell, we increase the age-counter and set the age of
the cell to the current value of the age-counter.

During rendering, we pass the age of the cell to the cell-renderer.
Furthermore, once rendering is done, we return the current screen age.
This allows renderers to save the age of the screen with a framebuffer.
Once a specific framebuffer is redrawn, only cells with a newer age need
to be updated. Everything else can be skipped.
By saving the age with the framebuffer, this even allows multi-buffered
applications to make use of this (also see the EGL buffer-age ext for a
similar feature).

Note that the age-counter might overflow. We return 0 in that case (which
is an invalid age). Applications need to reset *all* their framebuffer
ages if that happens.

Note that non-ageing-aware applications can simply ignore the new feature
(apart from changing the draw-cb) and it'll work as before.

This does _not_ implement the real ageing feature. It only adds the API.
We currently always return 1 as age, which is wrong.. We need to fix the
whole code to increase ages correctly, which can get quite tricky if we
want the scrollback-buffer to work, too.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
10 years agoscreen: reset buffer-link on screen-reset
David Herrmann [Wed, 23 Oct 2013 13:23:54 +0000 (15:23 +0200)]
screen: reset buffer-link on screen-reset

We need to reset the lines-link to main_lines during reset, otherwise the
alternate buffer stays active (which is not what we want).

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
10 years agoscreen: minor coding style fixes
David Herrmann [Tue, 22 Oct 2013 14:53:47 +0000 (16:53 +0200)]
screen: minor coding style fixes

Fix some coding-style issues and minor logical redudancy. Also improve the
file-documentation to correctly describe what tsm_screen does today.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
10 years agoscreen: clear padding of main-lines on resize
David Herrmann [Tue, 22 Oct 2013 14:28:02 +0000 (16:28 +0200)]
screen: clear padding of main-lines on resize

The invisible padding during width reduction is not cleared as we clear
it when it gets visible again. However, if the line is pushed into
scrollback in between, it may get visible once the width is increases
again. Hence, clear padding of main-lines if screen-width is decreased.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
10 years agoscreen: remove empty cell fallback
David Herrmann [Tue, 22 Oct 2013 13:53:31 +0000 (15:53 +0200)]
screen: remove empty cell fallback

If we resize our screen, we guarantee that all cells are allocated. This
hasn't been true in the early times so we needed an empty cell during
rendering as fallback. It's no longer needed so remove it.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
10 years agoscreen: remove prepare/render callbacks
David Herrmann [Tue, 22 Oct 2013 13:38:14 +0000 (15:38 +0200)]
screen: remove prepare/render callbacks

Again, some leftovers from kmscon. There's no reason to provide these
callbacks. Users can just call the, before/after calling into TSM.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
10 years agobuild: remove shl_timer.h
David Herrmann [Tue, 22 Oct 2013 13:36:04 +0000 (15:36 +0200)]
build: remove shl_timer.h

This helper is now unused, remove it.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
10 years agoscreen: remove timer
David Herrmann [Tue, 22 Oct 2013 13:34:24 +0000 (15:34 +0200)]
screen: remove timer

This is still a leftover from kmscon. Remove it, if users want it, they
should implement it themselves.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
10 years agoscreen: correctly clear expansion area
David Herrmann [Tue, 22 Oct 2013 13:07:59 +0000 (15:07 +0200)]
screen: correctly clear expansion area

We incorrectly clear the alternate-screen and width-extensions. Fix this.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
10 years agoAdd support for blink screen attribute
Marcin Kulik [Sat, 17 Aug 2013 10:33:36 +0000 (12:33 +0200)]
Add support for blink screen attribute

The blink attribute is enabled via m-CSI 5 and disabled via 25. It's up to
the renderer to do anything useful with it.

Signed-off-by: Marcin Kulik <m@ku1ik.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
10 years agoAdd test infrastructure
David Herrmann [Mon, 19 Aug 2013 21:22:51 +0000 (23:22 +0200)]
Add test infrastructure

Add "make check" test suite and some initial hashtable dummy tests. More
comprehensive tests can be added later.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
10 years agogitignore: ignore release tarballs
David Herrmann [Sat, 17 Aug 2013 13:02:11 +0000 (15:02 +0200)]
gitignore: ignore release tarballs

Ignore tar.xz tarballs from "make dist".

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
10 years agobuild: remove non-existant shl_dlist.h reference
David Herrmann [Sat, 17 Aug 2013 13:01:34 +0000 (15:01 +0200)]
build: remove non-existant shl_dlist.h reference

We don't use the linked list helper, so remove this reference.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
10 years agobuild: add xkbcommon-keysyms.h to sources
David Herrmann [Sat, 17 Aug 2013 13:00:08 +0000 (15:00 +0200)]
build: add xkbcommon-keysyms.h to sources

We need to add this file to the list of source files. Otherwise, dists
might not include it.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
10 years agoInclude libtsm.h instead of sub-headers
David Herrmann [Sat, 17 Aug 2013 12:59:29 +0000 (14:59 +0200)]
Include libtsm.h instead of sub-headers

Move all source files to include libtsm.h directly. This will get rid of
the recently introduced warnings if sub-headers are included directly.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
10 years agoMove all public header information into libtsm.h
David Herrmann [Sat, 17 Aug 2013 12:56:04 +0000 (14:56 +0200)]
Move all public header information into libtsm.h

Avoid splitting all information across different headers. But keep the old
headers and add #warning's before including libtsm.h.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
10 years agoMove tsm.h to libtsm.h
David Herrmann [Sat, 17 Aug 2013 12:49:43 +0000 (14:49 +0200)]
Move tsm.h to libtsm.h

I want to get rid of the header mess and move everything public into a
proper single public header. There is no reason to keep everything
separate once we make libtsm a proper library.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
10 years agobuild: fix logic in msg regarding optimizations
David Herrmann [Sat, 17 Aug 2013 12:02:20 +0000 (14:02 +0200)]
build: fix logic in msg regarding optimizations

While we enable optimizations by default and thus invert the logic in help
text, the actual check still is non-inverted. Hence, print the correct
message during ./configure.

Reported-by: Marcin Kulik
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
10 years agoInitial import of libtsm
David Herrmann [Tue, 13 Aug 2013 14:50:38 +0000 (16:50 +0200)]
Initial import of libtsm

This is a copy of libtsm from the kmscon repository. It has no external
dependencies except glibc. libxkbcommon should be provided during
compile-time. If not, a fallback header is used.

The library interface is not stable, yet! There is still a lot to do
before we release libtsm-1.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>