wayland: Put Ecore_Wl2_Win instead of wl_surface into the engines

We'll need to track some state in a common way, so attaching it to the
window seems like a good idea.
This commit is contained in:
Derek Foreman 2017-08-14 17:07:31 -05:00
parent ccc4ffc80d
commit e3b9fbaed8
9 changed files with 31 additions and 19 deletions

View File

@ -136,7 +136,7 @@ _ee_display_unset(Ecore_Evas *ee)
if (!einfo) return;
einfo->info.wl_display = NULL;
einfo->info.wl_surface = NULL;
einfo->info.wl2_win = NULL;
wdata = ee->engine.data;
if (!strcmp(ee->driver, "wayland_egl"))
@ -1663,7 +1663,7 @@ _ecore_evas_wl_common_render_flush_pre(void *data, Evas *evas, void *event EINA_
einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(evas);
if (!einfo) return;
surf = einfo->info.wl_surface;
surf = ecore_wl2_window_surface_get(einfo->info.wl2_win);
if (!surf) return;
wdata = ee->engine.data;
@ -2018,7 +2018,7 @@ _ecore_evas_wl_common_show(Ecore_Evas *ee)
einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(ee->evas);
if (einfo)
{
einfo->info.wl_surface = ecore_wl2_window_surface_get(wdata->win);
einfo->info.wl2_win = wdata->win;
einfo->info.hidden = wdata->win->pending.configure; //EINA_FALSE;
einfo->www_avail = !!wdata->win->www_surface;
if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
@ -2147,7 +2147,7 @@ _ee_cb_sync_done(void *data, int type EINA_UNUSED, void *event EINA_UNUSED)
ecore_wl2_display_compositor_version_get(wdata->display);
einfo->info.destination_alpha = EINA_TRUE;
einfo->info.rotation = ee->rotation;
einfo->info.wl_surface = ecore_wl2_window_surface_get(wdata->win);
einfo->info.wl2_win = wdata->win;
if (wdata->reset_pending)
{
@ -2447,7 +2447,7 @@ _ecore_evas_wl_common_new_internal(const char *disp_name, unsigned int parent, i
einfo->info.destination_alpha = EINA_TRUE;
einfo->info.rotation = ee->rotation;
einfo->info.depth = 32;
einfo->info.wl_surface = ecore_wl2_window_surface_get(wdata->win);
einfo->info.wl2_win = wdata->win;
einfo->info.wl_dmabuf = ecore_wl2_display_dmabuf_get(ewd);
einfo->info.wl_shm = ecore_wl2_display_shm_get(ewd);
einfo->info.compositor_version =

View File

@ -18,7 +18,7 @@ struct _Evas_Engine_Info_Wayland
struct wl_shm *wl_shm;
struct zwp_linux_dmabuf_v1 *wl_dmabuf;
struct wl_display *wl_display;
struct wl_surface *wl_surface;
Ecore_Wl2_Window *wl2_win;
int depth, rotation, edges;
int compositor_version;
Eina_Bool destination_alpha : 1;

View File

@ -279,11 +279,13 @@ evgl_eng_native_window_create(void *data)
Render_Engine *re;
Outbuf *ob;
struct wl_egl_window *win;
struct wl_surface *wls;
if (!(re = (Render_Engine *)data)) return NULL;
if (!(ob = eng_get_ob(re))) return NULL;
if (!(win = wl_egl_window_create(ob->info->info.wl_surface, 1, 1)))
wls = ecore_wl2_window_surface_get(ob->info->info.wl2_win);
if (!(win = wl_egl_window_create(wls, 1, 1)))
{
ERR("Could not create wl_egl window");
return NULL;
@ -671,6 +673,7 @@ static int
eng_update(void *engine EINA_UNUSED, void *data, void *info, unsigned int w, unsigned int h)
{
Evas_Engine_Info_Wayland *inf = info;
struct wl_surface *wls;
Render_Engine *re = data;
Outbuf *ob;
@ -689,13 +692,14 @@ eng_update(void *engine EINA_UNUSED, void *data, void *info, unsigned int w, uns
return 1;
}
if (!inf->info.wl_surface && (ob->egl_surface != EGL_NO_SURFACE))
wls = ecore_wl2_window_surface_get(inf->info.wl2_win);
if (!wls && (ob->egl_surface != EGL_NO_SURFACE))
{
eglDestroySurface(ob->egl_disp, ob->egl_surface);
eglMakeCurrent(ob->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE,
EGL_NO_CONTEXT);
ob->egl_surface = EGL_NO_SURFACE;
ob->surface = NULL;
ob->wl2_win = NULL;
evas_render_engine_software_generic_update(&re->generic.software,
NULL, w, h);
return 1;
@ -705,7 +709,7 @@ eng_update(void *engine EINA_UNUSED, void *data, void *info, unsigned int w, uns
{
ob->info = inf;
if ((ob->info->info.wl_display != ob->disp) ||
(ob->info->info.wl_surface != ob->surface) ||
(ob->info->info.wl2_win != ob->wl2_win) ||
/* FIXME: comment out below line.
* since there is no place set the info->info.win for now,
* it causes renew the window unnecessarily.

View File

@ -57,7 +57,7 @@ struct _Outbuf
{
struct wl_display *disp;
struct wl_egl_window *win;
struct wl_surface *surface;
Ecore_Wl2_Window *wl2_win;
int w, h;
int depth, screen, rot, alpha;

View File

@ -29,10 +29,10 @@ eng_window_new(Evas_Engine_Info_Wayland *einfo, int w, int h, Render_Engine_Swap
gw->h = h;
gw->swap_mode = swap_mode;
gw->disp = einfo->info.wl_display;
gw->wl2_win = einfo->info.wl2_win;
if (display && (display != gw->disp))
context = EGL_NO_CONTEXT;
display = gw->disp;
gw->surface = einfo->info.wl_surface;
gw->depth = einfo->info.depth;
gw->alpha = einfo->info.destination_alpha;
gw->rot = einfo->info.rotation;
@ -277,15 +277,18 @@ eng_window_unsurf(Outbuf *gw)
void
eng_window_resurf(Outbuf *gw)
{
struct wl_surface *wls;
if (gw->surf) return;
if (getenv("EVAS_GL_INFO")) printf("resurf %p\n", gw);
if ((!gw->w) || (!gw->h)) return;
if (!gw->win)
{
wls = ecore_wl2_window_surface_get(gw->wl2_win);
if ((gw->rot == 0) || (gw->rot == 180))
gw->win = wl_egl_window_create(gw->surface, gw->w, gw->h);
gw->win = wl_egl_window_create(wls, gw->w, gw->h);
else if ((gw->rot == 90) || (gw->rot == 270))
gw->win = wl_egl_window_create(gw->surface, gw->h, gw->w);
gw->win = wl_egl_window_create(wls, gw->h, gw->w);
}
gw->egl_surface =

View File

@ -788,7 +788,7 @@ _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 = s->info->info.wl_surface;
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;

View File

@ -175,10 +175,12 @@ 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;
if (!einfo->info.wl_surface) return 0;
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, einfo->info.wl_surface);
_evas_outbuf_surface_set(re->generic.ob, einfo->info.wl_shm, einfo->info.wl_dmabuf, surf);
eng_output_resize(engine, data, w, h);

View File

@ -639,8 +639,11 @@ _evas_outbuf_update_region_free(Outbuf *ob EINA_UNUSED, RGBA_Image *update EINA_
void
_evas_outbuf_redraws_clear(Outbuf *ob)
{
struct wl_surface *wls;
if (!ob->priv.rect_count) return;
if (ob->info->info.wl_surface)
wls = ecore_wl2_window_surface_get(ob->info->info.wl2_win);
if (wls)
ob->surface->funcs.post(ob->surface, ob->priv.rects, ob->priv.rect_count, ob->hidden);
free(ob->priv.rects);
ob->priv.rect_count = 0;

View File

@ -596,7 +596,7 @@ _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 = s->info->info.wl_surface;
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;