screen: add screen-age to API
authorDavid Herrmann <dh.herrmann@gmail.com>
Wed, 23 Oct 2013 13:31:03 +0000 (15:31 +0200)
committerDavid Herrmann <dh.herrmann@gmail.com>
Wed, 23 Oct 2013 13:35:00 +0000 (15:35 +0200)
commit7232760fd9fb8fa5bc2863fd1622f67ea7d73a7b
tree9b246ec2e0087da539cfb407d5c81864d7e1fc24
parent936c62af024089c614e7dca10d6d123c48892300
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>
src/libtsm.h
src/tsm_screen.c