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
This commit is contained in:
Derek Foreman 2015-07-30 15:37:14 -04:00 committed by Chris Michael
parent 9c432ca590
commit 99af748e4b
1 changed files with 20 additions and 10 deletions

View File

@ -406,25 +406,35 @@ _evas_shm_surface_reconfigure(Shm_Surface *surface, int dx, int dy, int w, int h
}
}
static Shm_Leaf *
_evas_shm_surface_wait(Shm_Surface *surface)
{
int iterations = 0, i;
while (iterations++ < 10)
{
for (i = 0; i < surface->num_buff; i++)
{
if (surface->leaf[i].busy) continue;
if (surface->leaf[i].valid) return &surface->leaf[i];
}
wl_display_dispatch(surface->disp);
}
return NULL;
}
Eina_Bool
_evas_shm_surface_assign(Shm_Surface *surface)
{
int i;
surface->current = NULL;
for (i = 0; i < surface->num_buff; i++)
{
if (surface->leaf[i].busy) continue;
if (surface->leaf[i].valid)
{
surface->current = &surface->leaf[i];
break;
}
}
surface->current = _evas_shm_surface_wait(surface);
/* If we ran out of buffers we're in trouble, reset all ages */
if (!surface->current)
{
WRN("No free SHM buffers, dropping a frame");
for (i = 0; i < surface->num_buff; i++)
{
if (surface->leaf[i].valid)