wayland_shm: Add a way to update the stored wayland objects

On session recovery the engine needs to be given new copies of the
surface, dmabuf, and shm objects to run in the new connection.

This fixes session recovery breakage introduced when we stopped recreating
the outbuf on reconfigure.
This commit is contained in:
Derek Foreman 2017-01-05 13:36:35 -06:00
parent 7b0f937880
commit 4c1227433f
5 changed files with 51 additions and 3 deletions

View File

@ -755,6 +755,21 @@ _evas_dmabuf_surface_destroy(Surface *s)
_internal_evas_dmabuf_surface_destroy(s->surf.dmabuf);
}
Eina_Bool
_evas_dmabuf_surface_surface_set(Surface *s, struct wl_shm *wl_shm EINA_UNUSED, struct zwp_linux_dmabuf_v1 *wl_dmabuf, struct wl_surface *wl_surface)
{
Dmabuf_Surface *surf;
surf = s->surf.dmabuf;
if ((surf->dmabuf == wl_dmabuf) && (surf->wl_surface == wl_surface))
return EINA_FALSE;
surf->dmabuf = wl_dmabuf;
surf->wl_surface = wl_surface;
return EINA_TRUE;
}
Eina_Bool
_evas_dmabuf_surface_create(Surface *s, int w, int h, int num_buff)
{
@ -799,6 +814,7 @@ _evas_dmabuf_surface_create(Surface *s, int w, int h, int num_buff)
s->funcs.data_get = _evas_dmabuf_surface_data_get;
s->funcs.assign = _evas_dmabuf_surface_assign;
s->funcs.post = _evas_dmabuf_surface_post;
s->funcs.surface_set = _evas_dmabuf_surface_surface_set;
return EINA_TRUE;

View File

@ -153,6 +153,8 @@ eng_update(void *data, void *info, unsigned int w, unsigned int h)
Render_Engine *re = data;
if (!einfo->info.wl_surface) return 0;
_evas_outbuf_surface_set(re->generic.ob, einfo->info.wl_shm, einfo->info.wl_dmabuf, einfo->info.wl_surface);
if (!einfo->info.hidden) return 1;
eng_output_resize(re, w, h);

View File

@ -100,6 +100,7 @@ struct _Surface
void *(*data_get)(Surface *surface, int *w, int *h);
int (*assign)(Surface *surface);
void (*post)(Surface *surface, Eina_Rectangle *rects, unsigned int count, Eina_Bool hidden);
Eina_Bool (*surface_set)(Surface *surface, struct wl_shm *wl_shm, struct zwp_linux_dmabuf_v1 *wl_dmabuf, struct wl_surface *wl_surface);
} funcs;
};
@ -135,6 +136,7 @@ struct _Outbuf
} priv;
Eina_Bool hidden : 1;
Eina_Bool dirty : 1;
};
Eina_Bool _evas_dmabuf_surface_create(Surface *s, int w, int h, int num_buff);
@ -153,6 +155,7 @@ void _evas_outbuf_update_region_push(Outbuf *ob, RGBA_Image *update, int x, int
void _evas_outbuf_update_region_free(Outbuf *ob, RGBA_Image *update);
void _evas_surface_damage(struct wl_surface *s, int compositor_version, int w, int h, Eina_Rectangle *rects, unsigned int count);
void _evas_outbuf_redraws_clear(Outbuf *ob);
void _evas_outbuf_surface_set(Outbuf *ob, struct wl_shm *shm, struct zwp_linux_dmabuf_v1 *dmabuf, struct wl_surface *surface);
Eina_Bool _evas_surface_init(Surface *s, int w, int h, int num_buf);

View File

@ -346,17 +346,22 @@ _evas_outbuf_rotation_get(Outbuf *ob)
void
_evas_outbuf_reconfigure(Outbuf *ob, int w, int h, int rot, Outbuf_Depth depth, Eina_Bool alpha, Eina_Bool resize, Eina_Bool hidden)
{
Eina_Bool dirty;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if ((depth == OUTBUF_DEPTH_NONE) ||
(depth == OUTBUF_DEPTH_INHERIT))
depth = ob->depth;
if ((ob->w == w) && (ob->h == h) &&
if (!ob->dirty && (ob->w == w) && (ob->h == h) &&
(ob->rotation == rot) && (ob->depth == depth) &&
(ob->priv.destination_alpha == alpha))
return;
dirty = ob->dirty;
ob->dirty = EINA_FALSE;
ob->w = w;
ob->h = h;
ob->rotation = rot;
@ -368,11 +373,11 @@ _evas_outbuf_reconfigure(Outbuf *ob, int w, int h, int rot, Outbuf_Depth depth,
if ((ob->rotation == 0) || (ob->rotation == 180))
{
ob->surface->funcs.reconfigure(ob->surface, w, h, resize, EINA_FALSE);
ob->surface->funcs.reconfigure(ob->surface, w, h, resize, dirty);
}
else if ((ob->rotation == 90) || (ob->rotation == 270))
{
ob->surface->funcs.reconfigure(ob->surface, h, w, resize, EINA_FALSE);
ob->surface->funcs.reconfigure(ob->surface, h, w, resize, dirty);
}
_evas_outbuf_idle_flush(ob);
@ -637,3 +642,9 @@ _evas_outbuf_redraws_clear(Outbuf *ob)
free(ob->priv.rects);
ob->priv.rect_count = 0;
}
void _evas_outbuf_surface_set(Outbuf *ob, struct wl_shm *wl_shm, struct zwp_linux_dmabuf_v1 *wl_dmabuf, struct wl_surface *wl_surface)
{
if (ob->surface->funcs.surface_set(ob->surface, wl_shm, wl_dmabuf, wl_surface))
ob->dirty = EINA_TRUE;
}

View File

@ -576,6 +576,21 @@ _evas_shm_surface_post(Surface *s, Eina_Rectangle *rects, unsigned int count, Ei
surf->current = NULL;
}
Eina_Bool
_evas_shm_surface_surface_set(Surface *s, struct wl_shm *wl_shm, struct zwp_linux_dmabuf_v1 *wl_dmabuf EINA_UNUSED, struct wl_surface *wl_surface)
{
Shm_Surface *surf;
surf = s->surf.shm;
if ((surf->shm == wl_shm) && (surf->surface == wl_surface))
return EINA_FALSE;
surf->shm = wl_shm;
surf->surface = wl_surface;
return EINA_TRUE;
}
Eina_Bool
_evas_shm_surface_create(Surface *s, int w, int h, int num_buff)
{
@ -612,6 +627,7 @@ _evas_shm_surface_create(Surface *s, int w, int h, int num_buff)
s->funcs.data_get = _evas_shm_surface_data_get;
s->funcs.assign = _evas_shm_surface_assign;
s->funcs.post = _evas_shm_surface_post;
s->funcs.surface_set = _evas_shm_surface_surface_set;
return EINA_TRUE;