ecore_wl2: Add API for querying buffer lock status and use it

Since surfaces will be managed by plug-ins, we need to make sure they
don't rely on internal structures.
This commit is contained in:
Derek Foreman 2018-01-25 15:58:35 -06:00
parent 1c2bb7bda7
commit e3a3e02042
3 changed files with 10 additions and 1 deletions

View File

@ -2007,6 +2007,7 @@ EAPI void ecore_wl2_buffer_unmap(Ecore_Wl2_Buffer *buf);
EAPI void ecore_wl2_buffer_discard(Ecore_Wl2_Buffer *buf);
EAPI void ecore_wl2_buffer_unlock(Ecore_Wl2_Buffer *b);
EAPI void ecore_wl2_buffer_destroy(Ecore_Wl2_Buffer *b);
EAPI Eina_Bool ecore_wl2_buffer_busy_get(Ecore_Wl2_Buffer *buffer);
EAPI Ecore_Wl2_Surface *ecore_wl2_surface_create(Ecore_Wl2_Window *win, Eina_Bool alpha);
EAPI void ecore_wl2_surface_destroy(Ecore_Wl2_Surface *surface);

View File

@ -672,6 +672,14 @@ ecore_wl2_buffer_destroy(Ecore_Wl2_Buffer *b)
free(b);
}
EAPI Eina_Bool
ecore_wl2_buffer_busy_get(Ecore_Wl2_Buffer *buffer)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(buffer, EINA_FALSE);
return (buffer->locked) || (buffer->busy);
}
static Ecore_Wl2_Buffer *
_ecore_wl2_buffer_partial_create(int w, int h, Eina_Bool alpha)
{

View File

@ -87,7 +87,7 @@ _evas_dmabuf_surface_wait(Ecore_Wl2_Surface *s)
EINA_LIST_FOREACH(s->buffers, l, b)
{
if (b->locked || b->busy) continue;
if (ecore_wl2_buffer_busy_get(b)) continue;
if (b->age > best_age)
{
best = b;