evas: Move engine data to native.
authorMinkyoung Kim <mer.kim@samsung.com>
Wed, 30 Mar 2016 05:01:18 +0000 (14:01 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Wed, 30 Mar 2016 06:09:27 +0000 (15:09 +0900)
Summary:
native_xx_cbs must be independent to evas render engine.
This was applied to only gl_x11 backend.
Propagate to others.

Test Plan: Tizen3.0 Mobile

Reviewers: wonsik, spacegrapher, jpeg

Reviewed By: jpeg

Subscribers: cedric, dkdk

Differential Revision: https://phab.enlightenment.org/D3840

src/modules/evas/engines/gl_drm/evas_engine.c
src/modules/evas/engines/gl_generic/evas_engine.c
src/modules/evas/engines/wayland_egl/evas_engine.c

index 3973a5f..2550873 100644 (file)
@@ -656,29 +656,26 @@ _native_cb_unbind(void *data EINA_UNUSED, void *image)
 }
 
 static void
-_native_cb_free(void *data, void *image)
+_native_cb_free(void *data EINA_UNUSED, void *image)
 {
-   Render_Engine *re;
-   Outbuf *ob;
    Evas_GL_Image *img;
    Native *n;
    uint32_t texid;
    void *wlid;
 
-   if (!(re = (Render_Engine *)data)) return;
    if (!(img = image)) return;
    if (!(n = img->native.data)) return;
-   if (!(ob = eng_get_ob(re))) return;
+   if (!(img->native.shared)) return;
 
    if (n->ns.type == EVAS_NATIVE_SURFACE_WL)
      {
         wlid = (void*)n->ns_data.wl_surface.wl_buf;
-        eina_hash_del(ob->gl_context->shared->native_wl_hash, &wlid, img);
+        eina_hash_del(img->native.shared->native_wl_hash, &wlid, img);
         if (n->ns_data.wl_surface.surface)
           {
              if (glsym_eglDestroyImage)
                {
-                  glsym_eglDestroyImage(ob->egl.disp, n->ns_data.wl_surface.surface);
+                  glsym_eglDestroyImage(img->native.disp, n->ns_data.wl_surface.surface);
                   if (eglGetError() != EGL_SUCCESS)
                     ERR("eglDestroyImage() failed.");
                }
@@ -689,7 +686,7 @@ _native_cb_free(void *data, void *image)
    else if (n->ns.type == EVAS_NATIVE_SURFACE_OPENGL)
      {
         texid = n->ns.data.opengl.texture_id;
-        eina_hash_del(ob->gl_context->shared->native_tex_hash, &texid, img);
+        eina_hash_del(img->native.shared->native_tex_hash, &texid, img);
      }
 
    img->native.data = NULL;
@@ -1219,6 +1216,8 @@ eng_image_native_set(void *data, void *image, void *native)
                   //img->native.yinvert = yinvert;
                   img->native.yinvert = 1;
                   img->native.loose = 0;
+                  img->native.disp = ob->egl.disp;
+                  img->native.shared = ob->gl_context->shared;
                   img->native.data = n;
                   img->native.func.data = re;
                   img->native.func.bind = _native_cb_bind;
@@ -1245,6 +1244,8 @@ eng_image_native_set(void *data, void *image, void *native)
 
                   img->native.yinvert = 0;
                   img->native.loose = 0;
+                  img->native.disp = ob->egl.disp;
+                  img->native.shared = ob->gl_context->shared;
                   img->native.data = n;
                   img->native.func.data = re;
                   img->native.func.bind = _native_cb_bind;
index c46fb75..45682ef 100644 (file)
@@ -323,20 +323,16 @@ _native_unbind_cb(void *data EINA_UNUSED, void *image)
 }
 
 static void
-_native_free_cb(void *data, void *image)
+_native_free_cb(void *data EINA_UNUSED, void *image)
 {
-  Evas_Engine_GL_Context *gl_context;
-  Render_Engine_GL_Generic *re = data;
   Evas_GL_Image *im = image;
   Evas_Native_Surface *n = im->native.data;
   uint32_t texid;
 
   if (n->type == EVAS_NATIVE_SURFACE_OPENGL)
     {
-       gl_context = re->window_gl_context_get(re->software.ob);
-
        texid = n->data.opengl.texture_id;
-       eina_hash_del(gl_context->shared->native_tex_hash, &texid, im);
+       eina_hash_del(im->native.shared->native_tex_hash, &texid, im);
     }
   im->native.data        = NULL;
   im->native.func.data   = NULL;
@@ -464,6 +460,7 @@ eng_image_native_set(void *data, void *image, void *native)
 
               im->native.yinvert     = 0;
               im->native.loose       = 0;
+              im->native.shared      = gl_context->shared;
               im->native.data        = n;
               im->native.func.data   = re;
               im->native.func.bind   = _native_bind_cb;
index 0aab3af..d6ee043 100644 (file)
@@ -894,29 +894,26 @@ _native_cb_unbind(void *data EINA_UNUSED, void *image)
 }
 
 static void
-_native_cb_free(void *data, void *image)
+_native_cb_free(void *data EINA_UNUSED, void *image)
 {
-   Render_Engine *re;
-   Outbuf *ob;
    Evas_GL_Image *img;
    Native *n;
    uint32_t texid;
    void *wlid;
 
-   if (!(re = (Render_Engine *)data)) return;
    if (!(img = image)) return;
    if (!(n = img->native.data)) return;
-   if (!(ob = eng_get_ob(re))) return;
+   if (!(img->native.shared)) return;
 
    if (n->ns.type == EVAS_NATIVE_SURFACE_WL)
      {
         wlid = (void*)n->ns_data.wl_surface.wl_buf;
-        eina_hash_del(ob->gl_context->shared->native_wl_hash, &wlid, img);
+        eina_hash_del(img->native.shared->native_wl_hash, &wlid, img);
         if (n->ns_data.wl_surface.surface)
           {
              if (glsym_eglDestroyImage)
                {
-                  glsym_eglDestroyImage(ob->egl_disp, n->ns_data.wl_surface.surface);
+                  glsym_eglDestroyImage(img->native.disp, n->ns_data.wl_surface.surface);
                   if (eglGetError() != EGL_SUCCESS)
                     ERR("eglDestroyImage() failed.");
                }
@@ -927,22 +924,22 @@ _native_cb_free(void *data, void *image)
    else if (n->ns.type == EVAS_NATIVE_SURFACE_OPENGL)
      {
         texid = n->ns.data.opengl.texture_id;
-        eina_hash_del(ob->gl_context->shared->native_tex_hash, &texid, img);
+        eina_hash_del(img->native.shared->native_tex_hash, &texid, img);
      }
   else if (n->ns.type == EVAS_NATIVE_SURFACE_EVASGL)
     {
-      eina_hash_del(eng_get_ob(re)->gl_context->shared->native_evasgl_hash, &n->ns_data.evasgl.surface, img);
+      eina_hash_del(img->native.shared->native_evasgl_hash, &n->ns_data.evasgl.surface, img);
     }
   else if (n->ns.type == EVAS_NATIVE_SURFACE_TBM)
     {
-       eina_hash_del(ob->gl_context->shared->native_tbm_hash, &n->ns_data.tbm.buffer, img);
+       eina_hash_del(img->native.shared->native_tbm_hash, &n->ns_data.tbm.buffer, img);
 #ifdef GL_GLES
       if (n->ns_data.tbm.surface)
         {
            int err;
            if (glsym_eglDestroyImage)
              {
-                glsym_eglDestroyImage(ob->egl_disp,
+                glsym_eglDestroyImage(img->native.disp,
                                       n->ns_data.tbm.surface);
                 if ((err = eglGetError()) != EGL_SUCCESS)
                   {
@@ -1263,6 +1260,8 @@ eng_image_native_set(void *data, void *image, void *native)
                   //img->native.yinvert = yinvert;
                   img->native.yinvert = 1;
                   img->native.loose = 0;
+                  img->native.disp = ob->egl_disp;
+                  img->native.shared = ob->gl_context->shared;
                   img->native.data = n;
                   img->native.func.data = re;
                   img->native.func.bind = _native_cb_bind;
@@ -1288,6 +1287,8 @@ eng_image_native_set(void *data, void *image, void *native)
 
                   img->native.yinvert = 0;
                   img->native.loose = 0;
+                  img->native.disp = ob->egl_disp;
+                  img->native.shared = ob->gl_context->shared;
                   img->native.data = n;
                   img->native.func.data = re;
                   img->native.func.bind = _native_cb_bind;
@@ -1315,6 +1316,8 @@ eng_image_native_set(void *data, void *image, void *native)
                n->ns_data.evasgl.surface = ns->data.evasgl.surface;
                img->native.yinvert     = 0;
                img->native.loose       = 0;
+               img->native.disp        = ob->egl_disp;
+               img->native.shared      = ob->gl_context->shared;
                img->native.data        = n;
                img->native.func.data   = re;
                img->native.func.bind   = _native_cb_bind;
@@ -1352,6 +1355,8 @@ eng_image_native_set(void *data, void *image, void *native)
                  ERR("eglCreateImage() for %p failed", buffer);
                img->native.yinvert     = 1;
                img->native.loose       = 0;
+               img->native.disp        = ob->egl_disp;
+               img->native.shared      = ob->gl_context->shared;
                img->native.data        = n;
                img->native.func.data   = re;
                img->native.func.bind   = _native_cb_bind;