From d9db2680298c01a82b768dc19e75bf4f2ef1b56e Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Fri, 25 Sep 2020 18:47:25 -0700 Subject: fb: track zeroed state in fb_fragment_t This adds a bit flag for tracking if the fragment has been zeroed since its last flip/present. When a fresh frame comes back from flipping, its zeroed state is reset to false. When fb_fragment_zero() is called, it checks if zeroed is true, and skips the zeroing if so. If zeroed is false, fb_fragment_zero() will zero the fragment and set the zeroed flag to 1. This change is preparatory for layering the output of modules in a compositing fashion. Not all modules are amenable to being used as upper layers, since they inherently fill the screen with new pixels every frame. Those modules make good bottom or bg layers. Other modules perform fb_fragment_zero() every frame and add relatively few pixels atop a clean slate. These modules make good candidates for upper layers where this change becomes relevant. --- src/fb.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/fb.c') diff --git a/src/fb.c b/src/fb.c index c909f6a..f7076a3 100644 --- a/src/fb.c +++ b/src/fb.c @@ -191,6 +191,7 @@ static inline _fb_page_t * _fb_page_get(fb_t *fb) pthread_mutex_unlock(&fb->inactive_mutex); page->next = NULL; + page->public_page.fragment.zeroed = 0; return page; } @@ -329,6 +330,7 @@ int fb_fragment_slice_single(const fb_fragment_t *fragment, unsigned n_fragments res_fragment->stride = fragment->stride; res_fragment->pitch = fragment->pitch; res_fragment->number = number; + res_fragment->zeroed = fragment->zeroed; return 1; } -- cgit v1.2.3