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>
This commit is contained in:
parent
0ee83010ff
commit
3e71989955
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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 */
|
||||
|
Loading…
x
Reference in New Issue
Block a user