ecore_wl2: Add a purge option to surface flush

Summary:
We need to be able to forcibly destroy all surface buffers to make
session recovery work safely for software rendering.

@betabreak
Depends on D6278

Reviewers: devilhorns, zmike

Reviewed By: zmike

Subscribers: cedric, #committers, zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6279
This commit is contained in:
Derek Foreman 2018-06-15 13:18:30 -05:00
parent 551101b4cd
commit a310667bec
5 changed files with 10 additions and 8 deletions

View File

@ -436,7 +436,7 @@ typedef struct _Ecore_Wl2_Surface_Interface
void *(*data_get)(Ecore_Wl2_Surface *surface, void *priv_data, int *w, int *h);
int (*assign)(Ecore_Wl2_Surface *surface, void *priv_data);
void (*post)(Ecore_Wl2_Surface *surface, void *priv_data, Eina_Rectangle *rects, unsigned int count);
void (*flush)(Ecore_Wl2_Surface *surface, void *priv_data);
void (*flush)(Ecore_Wl2_Surface *surface, void *priv_data, Eina_Bool purge);
} Ecore_Wl2_Surface_Interface;
/**
@ -1990,7 +1990,7 @@ EAPI void ecore_wl2_surface_reconfigure(Ecore_Wl2_Surface *surface, int w, int h
EAPI void *ecore_wl2_surface_data_get(Ecore_Wl2_Surface *surface, int *w, int *h);
EAPI int ecore_wl2_surface_assign(Ecore_Wl2_Surface *surface);
EAPI void ecore_wl2_surface_post(Ecore_Wl2_Surface *surface, Eina_Rectangle *rects, unsigned int count);
EAPI void ecore_wl2_surface_flush(Ecore_Wl2_Surface *surface);
EAPI void ecore_wl2_surface_flush(Ecore_Wl2_Surface *surface, Eina_Bool purge);
EAPI void ecore_wl2_window_surface_flush(Ecore_Wl2_Window *window);
EAPI Ecore_Wl2_Buffer *ecore_wl2_surface_buffer_create(Ecore_Wl2_Surface *surface);
EAPI int ecore_wl2_surface_manager_add(Ecore_Wl2_Surface_Interface *intf);

View File

@ -63,11 +63,11 @@ ecore_wl2_surface_post(Ecore_Wl2_Surface *surface, Eina_Rectangle *rects, unsign
}
EAPI void
ecore_wl2_surface_flush(Ecore_Wl2_Surface *surface)
ecore_wl2_surface_flush(Ecore_Wl2_Surface *surface, Eina_Bool purge)
{
EINA_SAFETY_ON_NULL_RETURN(surface);
surface->funcs->flush(surface, surface->private_data);
surface->funcs->flush(surface, surface->private_data, purge);
}
static Eina_Bool
@ -77,7 +77,7 @@ _ecore_wl2_surface_cb_offscreen(void *data, int type EINA_UNUSED, void *event)
Ecore_Wl2_Surface *surf = data;
if (surf->wl2_win->id == (int)ev->win)
ecore_wl2_surface_flush(surf);
ecore_wl2_surface_flush(surf, EINA_FALSE);
return ECORE_CALLBACK_RENEW;
}

View File

@ -217,7 +217,7 @@ _evas_dmabuf_surface_destroy(Ecore_Wl2_Surface *s EINA_UNUSED, void *priv_data)
}
static void
_evas_dmabuf_surface_flush(Ecore_Wl2_Surface *surface EINA_UNUSED, void *priv_data)
_evas_dmabuf_surface_flush(Ecore_Wl2_Surface *surface EINA_UNUSED, void *priv_data, Eina_Bool purge EINA_UNUSED)
{
Ecore_Wl2_Dmabuf_Private *p;
Ecore_Wl2_Buffer *b;

View File

@ -1769,5 +1769,5 @@ ecore_wl2_window_surface_flush(Ecore_Wl2_Window *window)
EINA_SAFETY_ON_NULL_RETURN(window);
if (!window->wl2_surface) return;
ecore_wl2_surface_flush(window->wl2_surface);
ecore_wl2_surface_flush(window->wl2_surface, EINA_FALSE);
}

View File

@ -134,8 +134,10 @@ eng_output_update(void *engine, void *data, void *info, unsigned int w, unsigned
ewd = ecore_wl2_window_display_get(einfo->info.wl2_win);
if (ob->ewd != ewd)
{
/* We don't use a purging flush because we don't want to
* delete a buffer currently being displayed */
if (ewd)
ecore_wl2_surface_flush(ob->surface);
ecore_wl2_surface_flush(ob->surface, EINA_FALSE);
re->generic.ob->ewd = ewd;
}