diff options
author | Derek Foreman <derekf@osg.samsung.com> | 2017-08-14 18:21:22 -0500 |
---|---|---|
committer | Derek Foreman <derekf@osg.samsung.com> | 2017-08-18 14:27:32 -0500 |
commit | 972633e7e8bf59d3df4f4c810e7403a05b9f5174 (patch) | |
tree | f0ac0463ae90f62cd6222c58b2827dcf93586461 | |
parent | 8f038b25914b9df738809a4150cf3aa5c6d0798e (diff) | |
download | efl-972633e7e8bf59d3df4f4c810e7403a05b9f5174.tar.gz |
wayland_shm: Remove direct access to wl_surface
Querying it through Ecore_Wl2_Window now
5 files changed, 28 insertions, 31 deletions
diff --git a/src/modules/evas/engines/wayland_shm/evas_dmabuf.c b/src/modules/evas/engines/wayland_shm/evas_dmabuf.c index 2bc5e7ba4a..40867d3a96 100644 --- a/src/modules/evas/engines/wayland_shm/evas_dmabuf.c +++ b/src/modules/evas/engines/wayland_shm/evas_dmabuf.c @@ -72,7 +72,6 @@ struct _Dmabuf_Surface Surface *surface; struct wl_display *wl_display; struct zwp_linux_dmabuf_v1 *dmabuf; - struct wl_surface *wl_surface; int compositor_version; Dmabuf_Buffer *current; @@ -480,6 +479,7 @@ _create_succeeded(void *data, struct zwp_linux_buffer_params_v1 *params, struct wl_buffer *new_buffer) { + struct wl_surface *wls; Dmabuf_Buffer *b = data; b->wl_buffer = new_buffer; @@ -500,10 +500,11 @@ _create_succeeded(void *data, if (b != b->surface->pre) return; /* This buffer was drawn into before it had a handle */ - wl_surface_attach(b->surface->wl_surface, b->wl_buffer, 0, 0); - _evas_surface_damage(b->surface->wl_surface, b->surface->compositor_version, + wls = ecore_wl2_window_surface_get(b->surface->surface->info->info.wl2_win); + wl_surface_attach(wls, b->wl_buffer, 0, 0); + _evas_surface_damage(wls, b->surface->compositor_version, b->w, b->h, NULL, 0); - wl_surface_commit(b->surface->wl_surface); + wl_surface_commit(wls); b->surface->pre = NULL; b->busy = EINA_FALSE; } @@ -668,6 +669,7 @@ _evas_dmabuf_surface_assign(Surface *s) static void _evas_dmabuf_surface_post(Surface *s, Eina_Rectangle *rects, unsigned int count, Eina_Bool hidden) { + struct wl_surface *wls; Dmabuf_Surface *surface; Dmabuf_Buffer *b; @@ -694,16 +696,17 @@ _evas_dmabuf_surface_post(Surface *s, Eina_Rectangle *rects, unsigned int count, } surface->pre = NULL; + wls = ecore_wl2_window_surface_get(s->info->info.wl2_win); if (!hidden) { - wl_surface_attach(surface->wl_surface, b->wl_buffer, 0, 0); - _evas_surface_damage(surface->wl_surface, surface->compositor_version, + wl_surface_attach(wls, b->wl_buffer, 0, 0); + _evas_surface_damage(wls, surface->compositor_version, b->w, b->h, rects, count); } else - wl_surface_attach(surface->wl_surface, NULL, 0, 0); + wl_surface_attach(wls, NULL, 0, 0); - wl_surface_commit(surface->wl_surface); + wl_surface_commit(wls); } static Dmabuf_Buffer * @@ -758,17 +761,16 @@ _evas_dmabuf_surface_destroy(Surface *s) } 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) +_evas_dmabuf_surface_surface_set(Surface *s, struct wl_shm *wl_shm EINA_UNUSED, struct zwp_linux_dmabuf_v1 *wl_dmabuf) { Dmabuf_Surface *surf; surf = s->surf.dmabuf; - if ((surf->dmabuf == wl_dmabuf) && (surf->wl_surface == wl_surface)) + if ((surf->dmabuf == wl_dmabuf)) return EINA_FALSE; surf->dmabuf = wl_dmabuf; - surf->wl_surface = wl_surface; return EINA_TRUE; } @@ -788,7 +790,6 @@ _evas_dmabuf_surface_create(Surface *s, int w, int h, int num_buff) surf->surface = s; surf->wl_display = s->info->info.wl_display; surf->dmabuf = s->info->info.wl_dmabuf; - surf->wl_surface = ecore_wl2_window_surface_get(s->info->info.wl2_win); surf->alpha = s->info->info.destination_alpha; surf->compositor_version = s->info->info.compositor_version; diff --git a/src/modules/evas/engines/wayland_shm/evas_engine.c b/src/modules/evas/engines/wayland_shm/evas_engine.c index 14c1ede348..fbcab307ec 100644 --- a/src/modules/evas/engines/wayland_shm/evas_engine.c +++ b/src/modules/evas/engines/wayland_shm/evas_engine.c @@ -175,12 +175,10 @@ eng_update(void *engine, void *data, void *info, unsigned int w, unsigned int h) { Evas_Engine_Info_Wayland *einfo = info; Render_Engine *re = data; - struct wl_surface *surf; - surf = ecore_wl2_window_surface_get(einfo->info.wl2_win); - if (!surf) return 0; - - _evas_outbuf_surface_set(re->generic.ob, einfo->info.wl_shm, einfo->info.wl_dmabuf, surf); + _evas_outbuf_surface_set(re->generic.ob, + einfo->info.wl_shm, + einfo->info.wl_dmabuf); eng_output_resize(engine, data, w, h); diff --git a/src/modules/evas/engines/wayland_shm/evas_engine.h b/src/modules/evas/engines/wayland_shm/evas_engine.h index e0924e62c1..308e31a413 100644 --- a/src/modules/evas/engines/wayland_shm/evas_engine.h +++ b/src/modules/evas/engines/wayland_shm/evas_engine.h @@ -100,7 +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); + Eina_Bool (*surface_set)(Surface *surface, struct wl_shm *wl_shm, struct zwp_linux_dmabuf_v1 *wl_dmabuf); } funcs; }; @@ -155,7 +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); +void _evas_outbuf_surface_set(Outbuf *ob, struct wl_shm *shm, struct zwp_linux_dmabuf_v1 *dmabuf); Eina_Bool _evas_surface_init(Surface *s, int w, int h, int num_buf); diff --git a/src/modules/evas/engines/wayland_shm/evas_outbuf.c b/src/modules/evas/engines/wayland_shm/evas_outbuf.c index 7aed71f450..a34ddefb67 100644 --- a/src/modules/evas/engines/wayland_shm/evas_outbuf.c +++ b/src/modules/evas/engines/wayland_shm/evas_outbuf.c @@ -650,8 +650,8 @@ _evas_outbuf_redraws_clear(Outbuf *ob) } void -_evas_outbuf_surface_set(Outbuf *ob, struct wl_shm *wl_shm, struct zwp_linux_dmabuf_v1 *wl_dmabuf, struct wl_surface *wl_surface) +_evas_outbuf_surface_set(Outbuf *ob, struct wl_shm *wl_shm, struct zwp_linux_dmabuf_v1 *wl_dmabuf) { - if (ob->surface->funcs.surface_set(ob->surface, wl_shm, wl_dmabuf, wl_surface)) + if (ob->surface->funcs.surface_set(ob->surface, wl_shm, wl_dmabuf)) ob->dirty = EINA_TRUE; } diff --git a/src/modules/evas/engines/wayland_shm/evas_shm.c b/src/modules/evas/engines/wayland_shm/evas_shm.c index df08f90dfa..2edb9ee985 100644 --- a/src/modules/evas/engines/wayland_shm/evas_shm.c +++ b/src/modules/evas/engines/wayland_shm/evas_shm.c @@ -63,7 +63,6 @@ struct _Shm_Surface { struct wl_display *disp; struct wl_shm *shm; - struct wl_surface *surface; int w, h; int num_buff; int compositor_version; @@ -537,6 +536,7 @@ _evas_shm_surface_data_get(Surface *s, int *w, int *h) void _evas_shm_surface_post(Surface *s, Eina_Rectangle *rects, unsigned int count, Eina_Bool hidden) { + struct wl_surface *wls; Shm_Surface *surf; Shm_Leaf *leaf; @@ -546,19 +546,19 @@ _evas_shm_surface_post(Surface *s, Eina_Rectangle *rects, unsigned int count, Ei leaf = surf->current; if (!leaf) return; - if (!surf->surface) return; + wls = ecore_wl2_window_surface_get(s->info->info.wl2_win); if (!hidden) { - wl_surface_attach(surf->surface, leaf->data->buffer, 0, 0); + wl_surface_attach(wls, leaf->data->buffer, 0, 0); - _evas_surface_damage(surf->surface, surf->compositor_version, + _evas_surface_damage(wls, surf->compositor_version, leaf->w, leaf->h, rects, count); } else - wl_surface_attach(surf->surface, NULL, 0, 0); + wl_surface_attach(wls, NULL, 0, 0); - wl_surface_commit(surf->surface); + wl_surface_commit(wls); leaf->busy = EINA_TRUE; leaf->drawn = EINA_TRUE; @@ -567,17 +567,16 @@ _evas_shm_surface_post(Surface *s, Eina_Rectangle *rects, unsigned int count, Ei } 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) +_evas_shm_surface_surface_set(Surface *s, struct wl_shm *wl_shm, struct zwp_linux_dmabuf_v1 *wl_dmabuf EINA_UNUSED) { Shm_Surface *surf; surf = s->surf.shm; - if ((surf->shm == wl_shm) && (surf->surface == wl_surface)) + if ((surf->shm == wl_shm)) return EINA_FALSE; surf->shm = wl_shm; - surf->surface = wl_surface; return EINA_TRUE; } @@ -596,7 +595,6 @@ _evas_shm_surface_create(Surface *s, int w, int h, int num_buff) surf->h = h; surf->disp = s->info->info.wl_display; surf->shm = s->info->info.wl_shm; - surf->surface = ecore_wl2_window_surface_get(s->info->info.wl2_win); surf->num_buff = num_buff; surf->alpha = s->info->info.destination_alpha; surf->compositor_version = s->info->info.compositor_version; |