forked from enlightenment/efl
Create Wl surface for evas gl capability testing
@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
This commit is contained in:
parent
295edfcfb7
commit
5550b595c9
|
@ -567,6 +567,7 @@ EAPI void ecore_wl_window_move(Ecore_Wl_Window *win, int x, int y);
|
||||||
EAPI void ecore_wl_window_resize(Ecore_Wl_Window *win, int w, int h, int location);
|
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_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 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 */
|
/* @since 1.8 */
|
||||||
EAPI void ecore_wl_window_commit(Ecore_Wl_Window *win);
|
EAPI void ecore_wl_window_commit(Ecore_Wl_Window *win);
|
||||||
|
|
|
@ -301,6 +301,12 @@ ecore_wl_registry_get(void)
|
||||||
return _ecore_wl_disp->wl.registry;
|
return _ecore_wl_disp->wl.registry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI struct wl_compositor *
|
||||||
|
ecore_wl_compositor_get(void)
|
||||||
|
{
|
||||||
|
return _ecore_wl_compositor_get();
|
||||||
|
}
|
||||||
|
|
||||||
struct wl_compositor *
|
struct wl_compositor *
|
||||||
_ecore_wl_compositor_get(void)
|
_ecore_wl_compositor_get(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -211,7 +211,9 @@ ecore_evas_wayland_egl_new_internal(const char *disp_name, unsigned int parent,
|
||||||
|
|
||||||
if ((einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas)))
|
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.display = ecore_wl_display_get();
|
||||||
|
einfo->info.compositor = ecore_wl_compositor_get();
|
||||||
einfo->info.destination_alpha = EINA_TRUE;
|
einfo->info.destination_alpha = EINA_TRUE;
|
||||||
einfo->info.rotation = ee->rotation;
|
einfo->info.rotation = ee->rotation;
|
||||||
einfo->info.depth = 32;
|
einfo->info.depth = 32;
|
||||||
|
|
|
@ -27,6 +27,7 @@ struct _Evas_Engine_Info_Wayland_Egl
|
||||||
struct wl_display *display;
|
struct wl_display *display;
|
||||||
struct wl_surface *surface;
|
struct wl_surface *surface;
|
||||||
struct wl_egl_window *win;
|
struct wl_egl_window *win;
|
||||||
|
struct wl_compositor *compositor;
|
||||||
int depth, screen, rotation, edges;
|
int depth, screen, rotation, edges;
|
||||||
unsigned int destination_alpha : 1;
|
unsigned int destination_alpha : 1;
|
||||||
} info;
|
} info;
|
||||||
|
|
|
@ -36,6 +36,14 @@ struct _Native
|
||||||
void *egl_surface;
|
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 */
|
/* local function prototypes */
|
||||||
typedef void (*_eng_fn) (void);
|
typedef void (*_eng_fn) (void);
|
||||||
typedef _eng_fn (*glsym_func_eng_fn) ();
|
typedef _eng_fn (*glsym_func_eng_fn) ();
|
||||||
|
@ -257,33 +265,43 @@ evgl_eng_evas_surface_get(void *data)
|
||||||
static void *
|
static void *
|
||||||
evgl_eng_native_window_create(void *data)
|
evgl_eng_native_window_create(void *data)
|
||||||
{
|
{
|
||||||
|
Evgl_wl_Surface* surface = NULL;
|
||||||
Render_Engine *re;
|
Render_Engine *re;
|
||||||
Outbuf *ob;
|
Outbuf *ob;
|
||||||
struct wl_egl_window *win;
|
|
||||||
|
|
||||||
if (!(re = (Render_Engine *)data)) return NULL;
|
if (!(re = (Render_Engine *)data)) return NULL;
|
||||||
if (!(ob = eng_get_ob(re))) 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");
|
ERR("Could not create wl_egl window: %m");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
return (void *)surface;
|
||||||
return (void *)win;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
evgl_eng_native_window_destroy(void *data, void *win)
|
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;
|
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);
|
free(surface);
|
||||||
win = NULL;
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,7 @@ struct _Outbuf
|
||||||
struct wl_display *disp;
|
struct wl_display *disp;
|
||||||
struct wl_egl_window *win;
|
struct wl_egl_window *win;
|
||||||
struct wl_surface *surface;
|
struct wl_surface *surface;
|
||||||
|
struct wl_compositor *compositor;
|
||||||
int w, h;
|
int w, h;
|
||||||
int depth, screen, rot, alpha;
|
int depth, screen, rot, alpha;
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ eng_window_new(Evas *evas, Evas_Engine_Info_Wayland_Egl *einfo, int w, int h, Re
|
||||||
gw->disp = einfo->info.display;
|
gw->disp = einfo->info.display;
|
||||||
gw->surface = einfo->info.surface;
|
gw->surface = einfo->info.surface;
|
||||||
gw->screen = einfo->info.screen;
|
gw->screen = einfo->info.screen;
|
||||||
|
gw->compositor = einfo->info.compositor;
|
||||||
gw->depth = einfo->info.depth;
|
gw->depth = einfo->info.depth;
|
||||||
gw->alpha = einfo->info.destination_alpha;
|
gw->alpha = einfo->info.destination_alpha;
|
||||||
gw->rot = einfo->info.rotation;
|
gw->rot = einfo->info.rotation;
|
||||||
|
|
Loading…
Reference in New Issue