forked from enlightenment/efl
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 79409757c6
by Derek Foreman.
Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
parent
bb2a55ead6
commit
f3d1b2d7da
|
@ -461,18 +461,19 @@ _evas_shm_surface_reconfigure(Surface *s, int w, int h, uint32_t flags)
|
||||||
static Shm_Leaf *
|
static Shm_Leaf *
|
||||||
_evas_shm_surface_wait(Shm_Surface *surface)
|
_evas_shm_surface_wait(Shm_Surface *surface)
|
||||||
{
|
{
|
||||||
int iterations = 0, i;
|
int i = 0, best = -1, best_age = -1;
|
||||||
|
|
||||||
while (iterations++ < 10)
|
for (i = 0; i < surface->num_buff; i++)
|
||||||
{
|
{
|
||||||
for (i = 0; i < surface->num_buff; i++)
|
if (surface->leaf[i].busy) continue;
|
||||||
|
if ((surface->leaf[i].valid) && (surface->leaf[i].age > best_age))
|
||||||
{
|
{
|
||||||
if (surface->leaf[i].busy) continue;
|
best = i;
|
||||||
if (surface->leaf[i].valid) return &surface->leaf[i];
|
best_age = surface->leaf[i].age;
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_display_dispatch_pending(surface->disp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (best >= 0) return &surface->leaf[best];
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue