From eba46d3c401a57c7ca2f95baa0312bfb09543ed0 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Tue, 29 Aug 2023 11:06:42 -0700 Subject: til_fb: track fb page submit-to-present duration Preparatory commit for returning submit-to-present intervals w/til_fb_page_get(). --- src/til_fb.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/til_fb.c b/src/til_fb.c index 1bdb2e7..02259e8 100644 --- a/src/til_fb.c +++ b/src/til_fb.c @@ -4,6 +4,7 @@ #include #include +#include "til.h" #include "til_fb.h" #include "til_settings.h" #include "til_util.h" @@ -117,6 +118,7 @@ struct _til_fb_page_t { _til_fb_page_t *all_next, *all_previous; _til_fb_page_t *next, *previous; _til_fb_fragment_t fragment; + unsigned submitted_ticks, presented_ticks; }; typedef struct til_fb_t { @@ -180,6 +182,8 @@ int til_fb_flip(til_fb_t *fb) if (r < 0) /* TODO: vet this: what happens to this page? */ return r; + next_active_page->presented_ticks = til_ticks_now(); + /* now that we're displaying a new page, make the previously active one inactive so rendering can reuse it */ pthread_mutex_lock(&fb->inactive_mutex); fb->active_page->next = fb->inactive_pages_head; @@ -277,6 +281,7 @@ static void _til_fb_page_submit(til_fb_fragment_t *fragment) fb->put_pages_count++; + page->submitted_ticks = til_ticks_now(); pthread_mutex_lock(&fb->ready_mutex); if (fb->ready_pages_tail) fb->ready_pages_tail->next = page; -- cgit v1.2.1