summaryrefslogtreecommitdiff
path: root/src/modules/evas/engines/wayland_shm/evas_shm.c
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2015-07-30 15:37:14 -0400
committerChris Michael <cp.michael@samsung.com>2015-07-30 15:37:21 -0400
commit99af748e4bcc4b20e04d4fcb238e36e48c9652d7 (patch)
treec75f3012e76b12e5c8900975d04c4b3e769dc8c7 /src/modules/evas/engines/wayland_shm/evas_shm.c
parent9c432ca590c3b78dbd83d249dcae8ab5a58b565a (diff)
wayland-shm: When we run out of shm buffers kick the server to get some back
Summary: This fixes a rendering issue with wayland apps. We consume all buffers then drop any attempted renders that take place while we have no buffers. This fix now waits for the server to give us some buffers back. This is the cause of T2612 @fix #Kansas Reviewers: zmike, devilhorns Reviewed By: devilhorns Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D2897
Diffstat (limited to 'src/modules/evas/engines/wayland_shm/evas_shm.c')
-rw-r--r--src/modules/evas/engines/wayland_shm/evas_shm.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/modules/evas/engines/wayland_shm/evas_shm.c b/src/modules/evas/engines/wayland_shm/evas_shm.c
index 705100c42e..bb9f270991 100644
--- a/src/modules/evas/engines/wayland_shm/evas_shm.c
+++ b/src/modules/evas/engines/wayland_shm/evas_shm.c
@@ -406,25 +406,35 @@ _evas_shm_surface_reconfigure(Shm_Surface *surface, int dx, int dy, int w, int h
406 } 406 }
407} 407}
408 408
409Eina_Bool 409static Shm_Leaf *
410_evas_shm_surface_assign(Shm_Surface *surface) 410_evas_shm_surface_wait(Shm_Surface *surface)
411{ 411{
412 int i; 412 int iterations = 0, i;
413 surface->current = NULL;
414 413
415 for (i = 0; i < surface->num_buff; i++) 414 while (iterations++ < 10)
416 { 415 {
417 if (surface->leaf[i].busy) continue; 416 for (i = 0; i < surface->num_buff; i++)
418 if (surface->leaf[i].valid)
419 { 417 {
420 surface->current = &surface->leaf[i]; 418 if (surface->leaf[i].busy) continue;
421 break; 419 if (surface->leaf[i].valid) return &surface->leaf[i];
422 } 420 }
421
422 wl_display_dispatch(surface->disp);
423 } 423 }
424 return NULL;
425}
426
427Eina_Bool
428_evas_shm_surface_assign(Shm_Surface *surface)
429{
430 int i;
431
432 surface->current = _evas_shm_surface_wait(surface);
424 433
425 /* If we ran out of buffers we're in trouble, reset all ages */ 434 /* If we ran out of buffers we're in trouble, reset all ages */
426 if (!surface->current) 435 if (!surface->current)
427 { 436 {
437 WRN("No free SHM buffers, dropping a frame");
428 for (i = 0; i < surface->num_buff; i++) 438 for (i = 0; i < surface->num_buff; i++)
429 { 439 {
430 if (surface->leaf[i].valid) 440 if (surface->leaf[i].valid)