aboutsummaryrefslogtreecommitdiff
path: root/wayland.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-08-13 16:35:17 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-08-13 16:35:17 +0000
commit17070a0d54e66641839805c68cfe1670c7012525 (patch)
tree874d7bb50be9fd724daf50956a7575cd1c68aebb /wayland.c
parentdoc: footclient.1: move DESCRIPTION up before OPTIONS (diff)
config: add tweak.render-timer option
This can be set to 'none' (the default), 'osd', 'log' or 'both'. When 'osd' is enabled, we'll render the frame rendering time to a sub-surface after each frame. When 'log' is enabled, the frame rendering time is logged on stderr.
Diffstat (limited to 'wayland.c')
-rw-r--r--wayland.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/wayland.c b/wayland.c
index 5f12d531..a10ed2b3 100644
--- a/wayland.c
+++ b/wayland.c
@@ -1197,6 +1197,20 @@ wayl_win_init(struct terminal *term)
}
wl_surface_commit(win->surface);
+
+ if (conf->tweak.render_timer_osd) {
+ win->render_timer_surface = wl_compositor_create_surface(wayl->compositor);
+ if (win->render_timer_surface == NULL) {
+ LOG_ERR("failed to create render timer surface");
+ goto out;
+ }
+ win->render_timer_sub_surface = wl_subcompositor_get_subsurface(
+ wayl->sub_compositor, win->render_timer_surface, win->surface);
+ wl_subsurface_set_sync(win->render_timer_sub_surface);
+ wl_surface_set_user_data(win->render_timer_surface, win);
+ wl_subsurface_set_position(win->render_timer_sub_surface, 10, 10);
+ wl_surface_commit(win->render_timer_surface);
+ }
return win;
out:
@@ -1223,6 +1237,11 @@ wayl_win_destroy(struct wl_window *win)
* nor mouse focus).
*/
+ if (win->render_timer_surface != NULL) {
+ wl_surface_attach(win->render_timer_surface, NULL, 0, 0);
+ wl_surface_commit(win->render_timer_surface);
+ }
+
if (win->scrollback_indicator_surface != NULL) {
wl_surface_attach(win->scrollback_indicator_surface, NULL, 0, 0);
wl_surface_commit(win->scrollback_indicator_surface);
@@ -1252,6 +1271,10 @@ wayl_win_destroy(struct wl_window *win)
tll_free(win->on_outputs);
csd_destroy(win);
+ if (win->render_timer_sub_surface != NULL)
+ wl_subsurface_destroy(win->render_timer_sub_surface);
+ if (win->render_timer_surface != NULL)
+ wl_surface_destroy(win->render_timer_surface);
if (win->scrollback_indicator_sub_surface != NULL)
wl_subsurface_destroy(win->scrollback_indicator_sub_surface);
if (win->scrollback_indicator_surface != NULL)