Skip to content

Commit

Permalink
Only sync when needed
Browse files Browse the repository at this point in the history
For this we need to track the last page that was panned, try to avoid
it, and if not possible, only then sync.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
  • Loading branch information
felipec committed Sep 19, 2010
1 parent b160510 commit 5154ab7
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions omapfb.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ struct gst_omapfb_sink {
struct page *pages;
int nr_pages;
struct page *cur_page;
struct page *old_page;
};

struct gst_omapfb_sink_class {
Expand Down Expand Up @@ -138,13 +139,18 @@ static struct page *get_page(struct gst_omapfb_sink *self)
for (i = 0; i < self->nr_pages; i++) {
if (&self->pages[i] == self->cur_page)
continue;
if (&self->pages[i] == self->old_page)
continue;
if (!self->pages[i].used) {
page = &self->pages[i];
page->used = true;
ioctl(self->overlay_fd, OMAPFB_WAITFORVSYNC);
break;
}
}
/* old page needs a vsync */
if (!page && self->old_page && !self->old_page->used)
page = self->old_page;
if (page)
page->used = true;
return page;
}

Expand All @@ -169,6 +175,9 @@ buffer_alloc(GstBaseSink *base, guint64 offset, guint size, GstCaps *caps, GstBu

*buf = buffer;

if (page == self->old_page)
ioctl(self->overlay_fd, OMAPFB_WAITFORVSYNC);

return GST_FLOW_OK;
missing:
*buf = NULL;
Expand Down Expand Up @@ -289,7 +298,7 @@ start(GstBaseSink *base)
int fd;

self->nr_pages = 3;
self->cur_page = NULL;
self->cur_page = self->old_page = NULL;

fd = open("/dev/fb0", O_RDWR);

Expand Down Expand Up @@ -384,6 +393,7 @@ render(GstBaseSink *base, GstBuffer *buffer)
if (self->manual_update)
update(self);

self->old_page = self->cur_page;
self->cur_page = page;
page->used = false;

Expand Down

0 comments on commit 5154ab7

Please sign in to comment.