summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@googlemail.com>2012-09-18 15:58:54 +0200
committerDavid Herrmann <dh.herrmann@googlemail.com>2012-09-18 15:58:54 +0200
commit3e71989955e1c410bfa47ab6851abba5cc76a3e3 (patch)
treee282e34a92dabcf2945d1207ae78803b171935b9
parent0ee83010ff6ac9366fdb1c5115a334cda6082def (diff)
tsm: screen: introduce TSM_SCREEN_OPT_RENDER_TIMING
Instead of accessing kmscon state from TSM, we now introduce options to control the behavior of TSM-screens. Apart from logging, TSM is now independent of any kmscon state/code. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
-rw-r--r--src/terminal.c3
-rw-r--r--src/tsm_screen.c15
-rw-r--r--src/tsm_screen.h2
3 files changed, 12 insertions, 8 deletions
diff --git a/src/terminal.c b/src/terminal.c
index 78504d4..2a9f844 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -425,6 +425,9 @@ int kmscon_terminal_new(struct kmscon_terminal **out,
if (ret)
goto err_free;
tsm_screen_set_max_sb(term->console, kmscon_conf.sb_size);
+ if (kmscon_conf.render_timing)
+ tsm_screen_set_opts(term->console,
+ TSM_SCREEN_OPT_RENDER_TIMING);
ret = kmscon_vte_new(&term->vte, term->console, write_event, term);
if (ret)
diff --git a/src/tsm_screen.c b/src/tsm_screen.c
index c2990a7..0f1cb5e 100644
--- a/src/tsm_screen.c
+++ b/src/tsm_screen.c
@@ -36,7 +36,6 @@
#include <stdlib.h>
#include <string.h>
#include "log.h"
-#include "main.h"
#include "shl_llog.h"
#include "shl_timer.h"
#include "tsm_screen.h"
@@ -1299,7 +1298,7 @@ void tsm_screen_draw(struct tsm_screen *con,
/* render preparation */
if (prepare_cb) {
- if (kmscon_conf.render_timing)
+ if (con->opts & TSM_SCREEN_OPT_RENDER_TIMING)
shl_timer_reset(con->timer);
ret = prepare_cb(con, data);
@@ -1308,7 +1307,7 @@ void tsm_screen_draw(struct tsm_screen *con,
return;
}
- if (kmscon_conf.render_timing)
+ if (con->opts & TSM_SCREEN_OPT_RENDER_TIMING)
time_prep = shl_timer_elapsed(con->timer);
} else {
time_prep = 0;
@@ -1316,7 +1315,7 @@ void tsm_screen_draw(struct tsm_screen *con,
/* push each character into rendering pipeline */
- if (kmscon_conf.render_timing)
+ if (con->opts & TSM_SCREEN_OPT_RENDER_TIMING)
shl_timer_reset(con->timer);
iter = con->sb_pos;
@@ -1371,26 +1370,26 @@ void tsm_screen_draw(struct tsm_screen *con,
}
}
- if (kmscon_conf.render_timing)
+ if (con->opts & TSM_SCREEN_OPT_RENDER_TIMING)
time_draw = shl_timer_elapsed(con->timer);
/* perform final rendering steps */
if (render_cb) {
- if (kmscon_conf.render_timing)
+ if (con->opts & TSM_SCREEN_OPT_RENDER_TIMING)
shl_timer_reset(con->timer);
ret = render_cb(con, data);
if (ret)
log_warning("cannot render via text-renderer");
- if (kmscon_conf.render_timing)
+ if (con->opts & TSM_SCREEN_OPT_RENDER_TIMING)
time_rend = shl_timer_elapsed(con->timer);
} else {
time_rend = 0;
}
- if (kmscon_conf.render_timing)
+ if (con->opts & TSM_SCREEN_OPT_RENDER_TIMING)
log_debug("timing: prepare: %llu draw: %llu render: %llu",
time_prep, time_draw, time_rend);
}
diff --git a/src/tsm_screen.h b/src/tsm_screen.h
index 688b70c..fa9c2d6 100644
--- a/src/tsm_screen.h
+++ b/src/tsm_screen.h
@@ -71,6 +71,8 @@ typedef void (*tsm_log_t) (const char *file,
#define TSM_SCREEN_HIDE_CURSOR 0x10
#define TSM_SCREEN_FIXED_POS 0x20
+#define TSM_SCREEN_OPT_RENDER_TIMING 0x01
+
struct tsm_screen_attr {
int8_t fccode; /* foreground color code or <0 for rgb */
int8_t bccode; /* background color code or <0 for rgb */