summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2017-11-08 14:15:52 -0600
committerDerek Foreman <derekf@osg.samsung.com>2017-11-08 15:12:51 -0600
commita5c7fbd006b5e4e578e2a938a609c2aa79315fc2 (patch)
tree8b78871b707bf8ba74851ed493086a254289ace7
parent4adf87ae91e56a97fa85694855d90e08c41b83e2 (diff)
wayland_shm: Return oldest buffer for new renders
This is what the old shm code has been doing, and it's probably better than what the dmabuf code was doing. We currently allocate 3 buffers. The usual case has us swapping between two of those buffers and saving that third buffer for emergencies - if we ever need that third buffer it'll require a full redraw. If we return the oldest available buffer the usual case requires a little more damage but we should never hit the full redraw case, which can cause a frame drop on slow hardware.
-rw-r--r--src/modules/evas/engines/wayland_shm/evas_dmabuf.c28
1 files changed, 9 insertions, 19 deletions
diff --git a/src/modules/evas/engines/wayland_shm/evas_dmabuf.c b/src/modules/evas/engines/wayland_shm/evas_dmabuf.c
index 2d263de0c1..77849a4e46 100644
--- a/src/modules/evas/engines/wayland_shm/evas_dmabuf.c
+++ b/src/modules/evas/engines/wayland_shm/evas_dmabuf.c
@@ -600,29 +600,19 @@ _evas_dmabuf_surface_data_get(Surface *s, int *w, int *h)
600static Dmabuf_Buffer * 600static Dmabuf_Buffer *
601_evas_dmabuf_surface_wait(Dmabuf_Surface *s) 601_evas_dmabuf_surface_wait(Dmabuf_Surface *s)
602{ 602{
603 int iterations = 0, i; 603 int i = 0, best = -1, best_age = -1;
604 struct wl_display *disp;
605 604
606 disp = ecore_wl2_display_get(s->surface->info->info.wl2_display); 605 for (i = 0; i < s->nbuf; i++)
607
608 while (iterations++ < 10)
609 { 606 {
610 for (i = 0; i < s->nbuf; i++) 607 if (s->buffer[i]->locked || s->buffer[i]->busy) continue;
611 if (!s->buffer[i]->locked && 608 if (s->buffer[i]->age > best_age)
612 !s->buffer[i]->busy) 609 {
613 return s->buffer[i]; 610 best = i;
614 611 best_age = s->buffer[i]->age;
615 wl_display_dispatch_pending(disp); 612 }
616 } 613 }
617 614
618 /* May be we have a possible render target that just hasn't been 615 if (best >= 0) return s->buffer[best];
619 * given a wl_buffer yet - draw there and let the success handler
620 * figure it out.
621 */
622 for (i = 0; i < s->nbuf; i++)
623 if (!s->buffer[i]->locked && !s->buffer[i]->busy)
624 return s->buffer[i];
625
626 return NULL; 616 return NULL;
627} 617}
628 618