summaryrefslogtreecommitdiff
path: root/src/modules/evas/engines/wayland_shm/evas_shm.c
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2016-10-26 11:53:49 -0400
committerChris Michael <cp.michael@samsung.com>2016-10-26 11:53:49 -0400
commitf3d1b2d7da768a35837564a3ad2f2300f28d100c (patch)
tree76bfab63169b86c1449472fbe7b134dc75087f9d /src/modules/evas/engines/wayland_shm/evas_shm.c
parentbb2a55ead6979781a42f562180b431d8fc61be47 (diff)
evas-wayland-shm: Improve next buffer selection algorithm
When triple buffering it's possible that we'll only need two buffers at a time for long durations. When we finally call upon a third buffer it hasn't been used recently enough to do a partial redraw. By picking the oldest available buffer when multiple buffers are free we can increase the likelihood of doing partial redraws. Based on 79409757c6493738c21015708a1ba5178942ad94 by Derek Foreman. Signed-off-by: Chris Michael <cp.michael@samsung.com>
Diffstat (limited to 'src/modules/evas/engines/wayland_shm/evas_shm.c')
-rw-r--r--src/modules/evas/engines/wayland_shm/evas_shm.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/modules/evas/engines/wayland_shm/evas_shm.c b/src/modules/evas/engines/wayland_shm/evas_shm.c
index e051b2538a..d86d466b7c 100644
--- a/src/modules/evas/engines/wayland_shm/evas_shm.c
+++ b/src/modules/evas/engines/wayland_shm/evas_shm.c
@@ -461,18 +461,19 @@ _evas_shm_surface_reconfigure(Surface *s, int w, int h, uint32_t flags)
461static Shm_Leaf * 461static Shm_Leaf *
462_evas_shm_surface_wait(Shm_Surface *surface) 462_evas_shm_surface_wait(Shm_Surface *surface)
463{ 463{
464 int iterations = 0, i; 464 int i = 0, best = -1, best_age = -1;
465 465
466 while (iterations++ < 10) 466 for (i = 0; i < surface->num_buff; i++)
467 { 467 {
468 for (i = 0; i < surface->num_buff; i++) 468 if (surface->leaf[i].busy) continue;
469 if ((surface->leaf[i].valid) && (surface->leaf[i].age > best_age))
469 { 470 {
470 if (surface->leaf[i].busy) continue; 471 best = i;
471 if (surface->leaf[i].valid) return &surface->leaf[i]; 472 best_age = surface->leaf[i].age;
472 } 473 }
473
474 wl_display_dispatch_pending(surface->disp);
475 } 474 }
475
476 if (best >= 0) return &surface->leaf[best];
476 return NULL; 477 return NULL;
477} 478}
478 479