diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 4 | ||||
-rw-r--r-- | src/til_fb.c | 8 | ||||
-rw-r--r-- | src/til_fb.h | 2 |
3 files changed, 10 insertions, 4 deletions
@@ -326,9 +326,9 @@ static void * rototiller_thread(void *_rt) rototiller_t *rt = _rt; while (til_stream_active(rt->stream)) { - unsigned ticks; + unsigned ticks, delay = 0; - rt->fragment = til_fb_page_get(rt->fb); + rt->fragment = til_fb_page_get(rt->fb, &delay); if (!rt->fragment) { til_stream_end(rt->stream); continue; diff --git a/src/til_fb.c b/src/til_fb.c index 02259e8..8760b84 100644 --- a/src/til_fb.c +++ b/src/til_fb.c @@ -420,7 +420,7 @@ static inline _til_fb_page_t * _til_fb_page_get(til_fb_t *fb) /* public interface */ -til_fb_fragment_t * til_fb_page_get(til_fb_t *fb) +til_fb_fragment_t * til_fb_page_get(til_fb_t *fb, unsigned *res_delay_ticks) { _til_fb_page_t *page; @@ -428,6 +428,12 @@ til_fb_fragment_t * til_fb_page_get(til_fb_t *fb) if (!page) return NULL; + if (res_delay_ticks) { + /* TODO: handle overflows, just asserting for now until it rears its head */ + assert(page->presented_ticks >= page->submitted_ticks); + *res_delay_ticks = page->presented_ticks - page->submitted_ticks; + } + return &page->fragment.public; } diff --git a/src/til_fb.h b/src/til_fb.h index 5ad210f..7c6464e 100644 --- a/src/til_fb.h +++ b/src/til_fb.h @@ -47,7 +47,7 @@ typedef struct til_fb_ops_t { int (*page_flip)(til_fb_t *fb, void *context, void *page); } til_fb_ops_t; -til_fb_fragment_t * til_fb_page_get(til_fb_t *fb); +til_fb_fragment_t * til_fb_page_get(til_fb_t *fb, unsigned *res_delay_ticks); void til_fb_fragment_submit(til_fb_fragment_t *fragment); til_fb_fragment_t * til_fb_fragment_snapshot(til_fb_fragment_t **fragment_ptr, int preserve_original); til_fb_fragment_t * til_fb_fragment_reclaim(til_fb_fragment_t *fragment); |