summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/fb.c2
-rw-r--r--src/fb.h6
-rw-r--r--src/modules/montage/montage.c1
3 files changed, 9 insertions, 0 deletions
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;
}
diff --git a/src/fb.h b/src/fb.h
index 300c134..d9914df 100644
--- a/src/fb.h
+++ b/src/fb.h
@@ -19,6 +19,7 @@ typedef struct fb_fragment_t {
unsigned stride; /* number of bytes from the end of one row to the start of the next */
unsigned pitch; /* number of bytes separating y from y + 1, including any padding */
unsigned number; /* this fragment's number as produced by fragmenting */
+ unsigned zeroed:1; /* if this fragment has been zeroed since last flip */
} fb_fragment_t;
/* This is a page handle object for page flip submission/life-cycle.
@@ -92,9 +93,14 @@ static inline void fb_fragment_zero(fb_fragment_t *fragment)
{
void *buf = fragment->buf;
+ if (fragment->zeroed)
+ return;
+
/* TODO: there should be a fast-path for non-divided fragments where there's no stride to skip */
for (int y = 0; y < fragment->height; y++, buf += fragment->pitch)
memset(buf, 0, fragment->pitch - fragment->stride);
+
+ fragment->zeroed = 1;
}
#endif
diff --git a/src/modules/montage/montage.c b/src/modules/montage/montage.c
index d7dd55f..99c3e66 100644
--- a/src/modules/montage/montage.c
+++ b/src/modules/montage/montage.c
@@ -146,6 +146,7 @@ static int montage_fragment_tile(const fb_fragment_t *fragment, unsigned tile_wi
res_fragment->stride = fragment->stride + ((fragment->width - res_fragment->width) * 4);
res_fragment->pitch = fragment->pitch;
res_fragment->number = number;
+ res_fragment->zeroed = fragment->zeroed;
return 1;
}
© All Rights Reserved