Create Wl surface for evas gl capability testing 67/39267/3 accepted/tizen/common/20150513.083729 accepted/tizen/mobile/20150514.051108 accepted/tizen/tv/20150513.105551 accepted/tizen/wearable/20150513.110458 submit/tizen/20150513.035729
authorWonsik Jung <sidein@samsung.com>
Tue, 12 May 2015 08:30:48 +0000 (17:30 +0900)
committerGwanglim Lee <gl77.lee@samsung.com>
Wed, 13 May 2015 06:01:45 +0000 (23:01 -0700)
@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

src/lib/ecore_wayland/Ecore_Wayland.h
src/lib/ecore_wayland/ecore_wl.c
src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c
src/modules/evas/engines/wayland_egl/Evas_Engine_Wayland_Egl.h
src/modules/evas/engines/wayland_egl/evas_engine.c
src/modules/evas/engines/wayland_egl/evas_engine.h
src/modules/evas/engines/wayland_egl/evas_wl_main.c

index e33c0b7..703c2a6 100644 (file)
@@ -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_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);
index a19b45a..e4f69dc 100644 (file)
@@ -301,6 +301,12 @@ ecore_wl_registry_get(void)
    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)
 {
index a850c81..f87a6bb 100644 (file)
@@ -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)))
      {
+        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;
index e06f82c..532b5e4 100644 (file)
@@ -27,6 +27,7 @@ struct _Evas_Engine_Info_Wayland_Egl
         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;
index ab8a9c2..b701c96 100644 (file)
@@ -36,6 +36,14 @@ struct _Native
    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) ();
@@ -257,33 +265,43 @@ evgl_eng_evas_surface_get(void *data)
 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;
 }
 
index 0d22968..8595e47 100644 (file)
@@ -54,6 +54,7 @@ struct _Outbuf
    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;
 
index 6d13390..39c3247 100644 (file)
@@ -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->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;