@fix - Current Evas GL native egl surface is created using wl surface of Evas Wayland EGL Backend
If this wl surface is deleted, Evas GL native egl surface will be invalid.
To fix, this patch has the creation of new wl surface for Evas GL.
It is similar to XOrg's Evas GL.
Change-Id: I0a9b1434a51ae80ec882c3db6212081d92ebe2b7
EAPI void ecore_wl_window_resize(Ecore_Wl_Window *win, int w, int h, int location);
EAPI void ecore_wl_window_damage(Ecore_Wl_Window *win, int x, int y, int w, int h);
EAPI void ecore_wl_window_buffer_attach(Ecore_Wl_Window *win, struct wl_buffer *buffer, int x, int y);
+EAPI struct wl_compositor *ecore_wl_compositor_get(void);
/* @since 1.8 */
EAPI void ecore_wl_window_commit(Ecore_Wl_Window *win);
return _ecore_wl_disp->wl.registry;
}
+EAPI struct wl_compositor *
+ecore_wl_compositor_get(void)
+{
+ return _ecore_wl_compositor_get();
+}
+
struct wl_compositor *
_ecore_wl_compositor_get(void)
{
if ((einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas)))
{
+ struct wl_compositor *temp_comp = NULL;
einfo->info.display = ecore_wl_display_get();
+ einfo->info.compositor = ecore_wl_compositor_get();
einfo->info.destination_alpha = EINA_TRUE;
einfo->info.rotation = ee->rotation;
einfo->info.depth = 32;
struct wl_display *display;
struct wl_surface *surface;
struct wl_egl_window *win;
+ struct wl_compositor *compositor;
int depth, screen, rotation, edges;
unsigned int destination_alpha : 1;
} info;
void *egl_surface;
};
+/* Evas GL wl_surface & wl_egl_window */
+typedef struct _Evgl_wl_Surface Evgl_wl_Surface;
+struct _Evgl_wl_Surface
+{
+ struct wl_surface *wl_surf;
+ struct wl_egl_window *egl_win;
+};
+
/* local function prototypes */
typedef void (*_eng_fn) (void);
typedef _eng_fn (*glsym_func_eng_fn) ();
static void *
evgl_eng_native_window_create(void *data)
{
+ Evgl_wl_Surface* surface = NULL;
Render_Engine *re;
Outbuf *ob;
- struct wl_egl_window *win;
if (!(re = (Render_Engine *)data)) return NULL;
if (!(ob = eng_get_ob(re))) return NULL;
- if (!(win = wl_egl_window_create(ob->info->info.surface, 1, 1)))
+ if (!(surface = calloc(1, sizeof(Evgl_wl_Surface))))
+ return NULL;
+ surface->wl_surf = wl_compositor_create_surface(ob->compositor);
+ if (!surface->wl_surf)
+ {
+ ERR("Could not create wl_surface: %m");
+ return NULL;
+ }
+ surface->egl_win = wl_egl_window_create(surface->wl_surf, 1, 1);
+ if (!surface->egl_win)
{
ERR("Could not create wl_egl window: %m");
return NULL;
}
-
- return (void *)win;
+ return (void *)surface;
}
static int
evgl_eng_native_window_destroy(void *data, void *win)
{
- Render_Engine *re;
+ Evgl_wl_Surface* surface = NULL;
- if (!(re = (Render_Engine *)data)) return 0;
if (!win) return 0;
+ surface = (Evgl_wl_Surface*)win;
+ if (surface->egl_win)
+ wl_egl_window_destroy((struct wl_egl_window *)surface->egl_win);
+ if (surface->wl_surf)
+ wl_surface_destroy(surface->wl_surf);
- wl_egl_window_destroy((struct wl_egl_window *)win);
- win = NULL;
-
+ free(surface);
return 1;
}
struct wl_display *disp;
struct wl_egl_window *win;
struct wl_surface *surface;
+ struct wl_compositor *compositor;
int w, h;
int depth, screen, rot, alpha;
gw->disp = einfo->info.display;
gw->surface = einfo->info.surface;
gw->screen = einfo->info.screen;
+ gw->compositor = einfo->info.compositor;
gw->depth = einfo->info.depth;
gw->alpha = einfo->info.destination_alpha;
gw->rot = einfo->info.rotation;