evas: make gl_x11 rely on gl_generic.
authorCedric BAIL <c.bail@partner.samsung.com>
Fri, 11 Jul 2014 13:16:03 +0000 (15:16 +0200)
committerCedric BAIL <c.bail@partner.samsung.com>
Fri, 11 Jul 2014 13:32:51 +0000 (15:32 +0200)
Note that we can't access gl_common directly as it is not possible to link it
2 times. I also didn't want to force evas to be linked with GL/EGL. So I rely
now on dlsym on about 20 symbols to get that backend going.

src/modules/evas/engines/gl_common/evas_gl_core_private.h
src/modules/evas/engines/gl_x11/evas_engine.c
src/modules/evas/engines/gl_x11/evas_engine.h
src/modules/evas/engines/gl_x11/evas_x_main.c

index fce0fab..74712e9 100644 (file)
@@ -242,7 +242,7 @@ struct _EVGL_Engine
 {
    int initted;
 
-   EVGL_Interface     *funcs;
+   const EVGL_Interface     *funcs;
 
    EVGL_Cap            caps;
 
index 0b67453..c8a1f1d 100644 (file)
@@ -1,6 +1,5 @@
 #include "evas_common_private.h" /* Also includes international specific stuff */
 #include "evas_engine.h"
-#include "evas_gl_core_private.h"
 
 //#define TIMDBG 1
 #ifdef TIMDBG
@@ -29,18 +28,7 @@ typedef struct _Render_Engine               Render_Engine;
 
 struct _Render_Engine
 {
-   Render_Engine_Software_Generic generic;
-
-   Eina_Bool                evgl_initted : 1;
-
-   struct {
-      Evas_Object_Image_Pixels_Get_Cb  get_pixels;
-      void                            *get_pixels_data;
-      Evas_Object                     *obj;
-   } func;
-
-   Evas_GL_X11_Context     *context_3d;
-   E3D_Renderer            *renderer_3d;
+   Render_Engine_GL_Generic generic;
 };
 
 const char *debug_dir;
@@ -63,6 +51,29 @@ typedef int             (*glsym_func_int) ();
 typedef unsigned int    (*glsym_func_uint) ();
 typedef const char     *(*glsym_func_const_char_ptr) ();
 
+Evas_GL_Common_Image_Call glsym_evas_gl_common_image_ref = NULL;
+Evas_GL_Common_Image_Call glsym_evas_gl_common_image_unref = NULL;
+Evas_GL_Common_Image_Call glsym_evas_gl_common_image_free = NULL;
+Evas_GL_Common_Image_Call glsym_evas_gl_common_image_native_disable = NULL;
+Evas_GL_Common_Image_Call glsym_evas_gl_common_image_native_enable = NULL;
+Evas_GL_Common_Image_New_From_Data glsym_evas_gl_common_image_new_from_data = NULL;
+Evas_GL_Common_Context_Call glsym_evas_gl_common_image_all_unload = NULL;
+Evas_GL_Preload glsym_evas_gl_preload_init = NULL;
+Evas_GL_Preload glsym_evas_gl_preload_shutdown = NULL;
+EVGL_Engine_Call glsym_evgl_engine_shutdown = NULL;
+
+Evas_GL_Common_Context_New glsym_evas_gl_common_context_new = NULL;
+Evas_GL_Common_Context_Call glsym_evas_gl_common_context_flush = NULL;
+Evas_GL_Common_Context_Call glsym_evas_gl_common_context_free = NULL;
+Evas_GL_Common_Context_Call glsym_evas_gl_common_context_use = NULL;
+Evas_GL_Common_Context_Call glsym_evas_gl_common_context_newframe = NULL;
+Evas_GL_Common_Context_Call glsym_evas_gl_common_context_done = NULL;
+Evas_GL_Common_Context_Resize_Call glsym_evas_gl_common_context_resize = NULL;
+Evas_GL_Common_Buffer_Dump_Call glsym_evas_gl_common_buffer_dump = NULL;
+Evas_GL_Preload_Render_Call glsym_evas_gl_preload_render_lock = NULL;
+Evas_GL_Preload_Render_Call glsym_evas_gl_preload_render_unlock = NULL;
+Evas_GL_Preload_Render_Call glsym_evas_gl_preload_render_relax = NULL;
+
 #ifdef GL_GLES
 
 #ifndef EGL_NATIVE_PIXMAP_KHR
@@ -141,9 +152,11 @@ measure(int end, const char *name)
 }
 #endif
 
-static int evgl_init(Render_Engine *re);
-
-#define EVGLINIT(_re, _ret) if (!evgl_init(_re)) return _ret
+static inline Outbuf *
+eng_get_ob(Render_Engine *re)
+{
+   return re->generic.software.ob;
+}
 
 //----------------------------------------------------------//
 // NEW_EVAS_GL Engine Functions
@@ -152,7 +165,7 @@ evgl_eng_display_get(void *data)
 {
    Render_Engine *re = (Render_Engine *)data;
 
-   EVGLINIT(re, NULL);
+   /* EVGLINIT(re, NULL); */
    if (!re)
      {
         ERR("Invalid Render Engine Data!");
@@ -160,11 +173,11 @@ evgl_eng_display_get(void *data)
      }
 
 #ifdef GL_GLES
-   if (re->generic.ob)
-      return (void*)re->generic.ob->egl_disp;
+   if (eng_get_ob(re))
+      return (void*)eng_get_ob(re)->egl_disp;
 #else
-   if (re->generic.ob->info)
-      return (void*)re->generic.ob->info->info.display;
+   if (eng_get_ob(re)->info)
+      return (void*)eng_get_ob(re)->info->info.display;
 #endif
    else
       return NULL;
@@ -175,7 +188,7 @@ evgl_eng_evas_surface_get(void *data)
 {
    Render_Engine *re = (Render_Engine *)data;
 
-   EVGLINIT(re, NULL);
+   /* EVGLINIT(re, NULL); */
    if (!re)
      {
         ERR("Invalid Render Engine Data!");
@@ -183,11 +196,11 @@ evgl_eng_evas_surface_get(void *data)
      }
 
 #ifdef GL_GLES
-   if (re->generic.ob)
-      return (void*)re->generic.ob->egl_surface[0];
+   if (eng_get_ob(re))
+      return (void*)eng_get_ob(re)->egl_surface[0];
 #else
-   if (re->generic.ob)
-      return (void*)re->generic.ob->win;
+   if (eng_get_ob(re))
+      return (void*)eng_get_ob(re)->win;
 #endif
    else
       return NULL;
@@ -199,7 +212,7 @@ evgl_eng_make_current(void *data, void *surface, void *context, int flush)
    Render_Engine *re = (Render_Engine *)data;
    int ret = 0;
 
-   EVGLINIT(re, 0);
+   /* EVGLINIT(re, 0); */
    if (!re)
      {
         ERR("Invalid Render Engine Data!");
@@ -210,7 +223,7 @@ evgl_eng_make_current(void *data, void *surface, void *context, int flush)
 #ifdef GL_GLES
    EGLContext ctx = (EGLContext)context;
    EGLSurface sfc = (EGLSurface)surface;
-   EGLDisplay dpy = re->generic.ob->egl_disp; //eglGetCurrentDisplay();
+   EGLDisplay dpy = eng_get_ob(re)->egl_disp; //eglGetCurrentDisplay();
 
    if ((!context) && (!surface))
      {
@@ -249,7 +262,7 @@ evgl_eng_make_current(void *data, void *surface, void *context, int flush)
 
    if ((!context) && (!surface))
      {
-        ret = glXMakeCurrent(re->generic.ob->info->info.display, None, NULL);
+        ret = glXMakeCurrent(eng_get_ob(re)->info->info.display, None, NULL);
         if (!ret)
           {
              ERR("glXMakeCurrent() failed!");
@@ -266,7 +279,7 @@ evgl_eng_make_current(void *data, void *surface, void *context, int flush)
         if (flush) eng_window_use(NULL);
 
         // Do a make current
-        ret = glXMakeCurrent(re->generic.ob->info->info.display, sfc, ctx);
+        ret = glXMakeCurrent(eng_get_ob(re)->info->info.display, sfc, ctx);
 
         if (!ret)
           {
@@ -285,7 +298,7 @@ evgl_eng_native_window_create(void *data)
 {
    Render_Engine *re = (Render_Engine *)data;
 
-   EVGLINIT(re, NULL);
+   /* EVGLINIT(re, NULL); */
    if (!re)
      {
         ERR("Invalid Render Engine Data!");
@@ -305,8 +318,8 @@ evgl_eng_native_window_create(void *data)
    attr.do_not_propagate_mask = NoEventMask;
    attr.event_mask = 0; 
 
-   win = XCreateWindow(re->generic.ob->info->info.display,
-                       DefaultRootWindow(re->generic.ob->info->info.display),
+   win = XCreateWindow(eng_get_ob(re)->info->info.display,
+                       DefaultRootWindow(eng_get_ob(re)->info->info.display),
                        0, 0, 2, 2, 0,
                        CopyFromParent, InputOutput, CopyFromParent, 
                        CWBackingStore | CWOverrideRedirect |
@@ -328,7 +341,7 @@ evgl_eng_native_window_destroy(void *data, void *native_window)
 {
    Render_Engine *re = (Render_Engine *)data;
 
-   EVGLINIT(re, 0);
+   /* EVGLINIT(re, 0); */
    if (!re)
      {
         ERR("Invalid Render Engine Data!");
@@ -341,7 +354,7 @@ evgl_eng_native_window_destroy(void *data, void *native_window)
         return 0;
      }
 
-   XDestroyWindow(re->generic.ob->info->info.display, (Window)native_window);
+   XDestroyWindow(eng_get_ob(re)->info->info.display, (Window)native_window);
 
    native_window = NULL;
 
@@ -356,7 +369,7 @@ evgl_eng_window_surface_create(void *data, void *native_window)
 {
    Render_Engine *re = (Render_Engine *)data;
 
-   EVGLINIT(re, NULL);
+   /* EVGLINIT(re, NULL); */
    if (!re)
      {
         ERR("Invalid Render Engine Data!");
@@ -367,8 +380,8 @@ evgl_eng_window_surface_create(void *data, void *native_window)
    EGLSurface surface = EGL_NO_SURFACE;
 
    // Create resource surface for EGL
-   surface = eglCreateWindowSurface(re->generic.ob->egl_disp,
-                                    re->generic.ob->egl_config,
+   surface = eglCreateWindowSurface(eng_get_ob(re)->egl_disp,
+                                    eng_get_ob(re)->egl_config,
                                     (EGLNativeWindowType)native_window,
                                     NULL);
    if (!surface)
@@ -383,7 +396,7 @@ evgl_eng_window_surface_create(void *data, void *native_window)
    // We don't need to create new one for GLX
    Window surface;
 
-   surface = re->generic.ob->win;
+   surface = eng_get_ob(re)->win;
 
    return (void *)surface;
    */
@@ -397,7 +410,7 @@ evgl_eng_window_surface_destroy(void *data, void *surface)
 {
    Render_Engine *re = (Render_Engine *)data;
 
-   EVGLINIT(re, 0);
+   /* EVGLINIT(re, 0); */
    if (!re)
      {
         ERR("Invalid Render Engine Data!");
@@ -411,7 +424,7 @@ evgl_eng_window_surface_destroy(void *data, void *surface)
         return 0;
      }
 
-   eglDestroySurface(re->generic.ob->egl_disp, (EGLSurface)surface);
+   eglDestroySurface(eng_get_ob(re)->egl_disp, (EGLSurface)surface);
 #endif
 
    return 1;
@@ -423,7 +436,7 @@ evgl_eng_context_create(void *data, void *share_ctx)
 {
    Render_Engine *re = (Render_Engine *)data;
 
-   EVGLINIT(re, NULL);
+   /* EVGLINIT(re, NULL); */
    if (!re)
      {
         ERR("Invalid Render Engine Data!");
@@ -441,16 +454,16 @@ evgl_eng_context_create(void *data, void *share_ctx)
    // Share context already assumes that it's sharing with evas' context
    if (share_ctx)
      {
-        context = eglCreateContext(re->generic.ob->egl_disp,
-                                   re->generic.ob->egl_config,
+        context = eglCreateContext(eng_get_ob(re)->egl_disp,
+                                   eng_get_ob(re)->egl_config,
                                    (EGLContext)share_ctx,
                                    context_attrs);
      }
    else
      {
-        context = eglCreateContext(re->generic.ob->egl_disp,
-                                   re->generic.ob->egl_config,
-                                   re->generic.ob->egl_context[0], // Evas' GL Context
+        context = eglCreateContext(eng_get_ob(re)->egl_disp,
+                                   eng_get_ob(re)->egl_config,
+                                   eng_get_ob(re)->egl_context[0], // Evas' GL Context
                                    context_attrs);
      }
 
@@ -467,16 +480,16 @@ evgl_eng_context_create(void *data, void *share_ctx)
    // Share context already assumes that it's sharing with evas' context
    if (share_ctx)
      {
-        context = glXCreateContext(re->generic.ob->info->info.display,
-                                   re->generic.ob->visualinfo,
+        context = glXCreateContext(eng_get_ob(re)->info->info.display,
+                                   eng_get_ob(re)->visualinfo,
                                    (GLXContext)share_ctx,
                                    1);
      }
    else
      {
-        context = glXCreateContext(re->generic.ob->info->info.display,
-                                   re->generic.ob->visualinfo,
-                                   re->generic.ob->context,      // Evas' GL Context
+        context = glXCreateContext(eng_get_ob(re)->info->info.display,
+                                   eng_get_ob(re)->visualinfo,
+                                   eng_get_ob(re)->context,      // Evas' GL Context
                                    1);
      }
 
@@ -496,7 +509,7 @@ evgl_eng_context_destroy(void *data, void *context)
 {
    Render_Engine *re = (Render_Engine *)data;
 
-   EVGLINIT(re, 0);
+   /* EVGLINIT(re, 0); */
    if ((!re) || (!context))
      {
         ERR("Invalid Render Input Data. Engine: %p, Context: %p", data, context);
@@ -504,9 +517,9 @@ evgl_eng_context_destroy(void *data, void *context)
      }
 
 #ifdef GL_GLES
-   eglDestroyContext(re->generic.ob->egl_disp, (EGLContext)context);
+   eglDestroyContext(eng_get_ob(re)->egl_disp, (EGLContext)context);
 #else
-   glXDestroyContext(re->generic.ob->info->info.display, (GLXContext)context);
+   glXDestroyContext(eng_get_ob(re)->info->info.display, (GLXContext)context);
 #endif
 
    return 1;
@@ -517,7 +530,7 @@ evgl_eng_string_get(void *data)
 {
    Render_Engine *re = (Render_Engine *)data;
 
-   EVGLINIT(re, NULL);
+   /* EVGLINIT(re, NULL); */
    if (!re)
      {
         ERR("Invalid Render Engine Data!");
@@ -525,10 +538,10 @@ evgl_eng_string_get(void *data)
      }
 
 #ifdef GL_GLES
-   return eglQueryString(re->generic.ob->egl_disp, EGL_EXTENSIONS);
+   return eglQueryString(eng_get_ob(re)->egl_disp, EGL_EXTENSIONS);
 #else
-   return glXQueryExtensionsString(re->generic.ob->info->info.display,
-                                   re->generic.ob->info->info.screen);
+   return glXQueryExtensionsString(eng_get_ob(re)->info->info.display,
+                                   eng_get_ob(re)->info->info.screen);
 #endif
 }
 
@@ -549,15 +562,15 @@ evgl_eng_rotation_angle_get(void *data)
 {
    Render_Engine *re = (Render_Engine *)data;
 
-   EVGLINIT(re, 0);
+   /* EVGLINIT(re, 0); */
    if (!re)
      {
         ERR("Invalid Render Engine Data!");
         return 0;
      }
 
-   if ((re->generic.ob) && (re->generic.ob->gl_context))
-      return re->generic.ob->gl_context->rot;
+   if ((eng_get_ob(re)) && (eng_get_ob(re)->gl_context))
+      return eng_get_ob(re)->gl_context->rot;
    else
      {
         ERR("Unable to retrieve rotation angle.");
@@ -565,7 +578,7 @@ evgl_eng_rotation_angle_get(void *data)
      }
 }
 
-static EVGL_Interface evgl_funcs =
+static const EVGL_Interface evgl_funcs =
 {
    evgl_eng_display_get,
    evgl_eng_evas_surface_get,
@@ -591,6 +604,32 @@ gl_symbols(void)
 
    if (done) return;
 
+#define LINK2GENERIC(sym) \
+   glsym_##sym = dlsym(RTLD_DEFAULT, #sym);
+
+   // Get function pointer to evas_gl_common that is now provided through the link of GL_Generic.
+   LINK2GENERIC(evas_gl_common_image_all_unload);
+   LINK2GENERIC(evas_gl_common_image_ref);
+   LINK2GENERIC(evas_gl_common_image_unref);
+   LINK2GENERIC(evas_gl_common_image_new_from_data);
+   LINK2GENERIC(evas_gl_common_image_native_disable);
+   LINK2GENERIC(evas_gl_common_image_free);
+   LINK2GENERIC(evas_gl_common_image_native_enable);
+   LINK2GENERIC(evas_gl_common_context_new);
+   LINK2GENERIC(evas_gl_common_context_flush);
+   LINK2GENERIC(evas_gl_common_context_free);
+   LINK2GENERIC(evas_gl_common_context_use);
+   LINK2GENERIC(evas_gl_common_context_newframe);
+   LINK2GENERIC(evas_gl_common_context_done);
+   LINK2GENERIC(evas_gl_common_context_resize);
+   LINK2GENERIC(evas_gl_common_buffer_dump);
+   LINK2GENERIC(evas_gl_preload_render_lock);
+   LINK2GENERIC(evas_gl_preload_render_unlock);
+   LINK2GENERIC(evas_gl_preload_render_relax);
+   LINK2GENERIC(evas_gl_preload_init);
+   LINK2GENERIC(evas_gl_preload_shutdown);
+   LINK2GENERIC(evgl_engine_shutdown);
+
 #ifdef GL_GLES
 #define FINDSYM(dst, sym, typ) \
    if (glsym_eglGetProcAddress) { \
@@ -674,7 +713,7 @@ gl_extn_veto(Render_Engine *re)
 {
    const char *str = NULL;
 #ifdef GL_GLES
-   str = eglQueryString(re->generic.ob->egl_disp, EGL_EXTENSIONS);
+   str = eglQueryString(eng_get_ob(re)->egl_disp, EGL_EXTENSIONS);
    if (str)
      {
         if (getenv("EVAS_GL_INFO"))
@@ -718,8 +757,8 @@ gl_extn_veto(Render_Engine *re)
         extn_have_buffer_age = 0;
      }
 #else
-   str = glXQueryExtensionsString(re->generic.ob->info->info.display,
-                                  re->generic.ob->info->info.screen);
+   str = glXQueryExtensionsString(eng_get_ob(re)->info->info.display,
+                                  eng_get_ob(re)->info->info.screen);
    if (str)
      {
         if (getenv("EVAS_GL_INFO"))
@@ -798,18 +837,9 @@ eng_info_free(Evas *eo_e EINA_UNUSED, void *info)
 static void
 _re_winfree(Render_Engine *re)
 {
-   if (!re->generic.ob->surf) return;
-   evas_gl_preload_render_relax(eng_preload_make_current, re->generic.ob);
-   eng_window_unsurf(re->generic.ob);
-}
-
-static int
-evgl_init(Render_Engine *re)
-{
-   if (re->evgl_initted) return 1;
-   if (!evgl_engine_init(re, &evgl_funcs)) return 0;
-   re->evgl_initted = EINA_TRUE;
-   return 1;
+   if (!eng_get_ob(re)->surf) return;
+   glsym_evas_gl_preload_render_relax(eng_preload_make_current, eng_get_ob(re));
+   eng_window_unsurf(eng_get_ob(re));
 }
 
 static int
@@ -925,6 +955,25 @@ eng_setup(Evas *eo_e, void *in)
      {
         Outbuf *ob;
         Render_Engine_Merge_Mode merge_mode = MERGE_BOUNDING;
+
+        if (!initted)
+          {
+             gl_symbols();
+
+             evas_common_cpu_init();
+             evas_common_blend_init();
+             evas_common_image_init();
+             evas_common_convert_init();
+             evas_common_scale_init();
+             evas_common_rectangle_init();
+             evas_common_polygon_init();
+             evas_common_line_init();
+             evas_common_font_init();
+             evas_common_draw_init();
+             evas_common_tilebuf_init();
+             glsym_evas_gl_preload_init();
+          }
+
 #ifdef GL_GLES
 #else
         int eb, evb;
@@ -951,18 +1000,24 @@ eng_setup(Evas *eo_e, void *in)
              return 0;
           }
 
-        if (!evas_render_engine_software_generic_init(&re->generic, ob,
-                                                      eng_outbuf_swap_mode,
-                                                      eng_outbuf_get_rot,
-                                                      eng_outbuf_reconfigure,
-                                                      eng_outbuf_region_first_rect,
-                                                      eng_outbuf_new_region_for_update,
-                                                      eng_outbuf_push_updated_region,
-                                                      eng_outbuf_push_free_region_for_update,
-                                                      NULL,
-                                                      eng_outbuf_flush,
-                                                      eng_window_free,
-                                                      e->output.w, e->output.h))
+        if (!evas_render_engine_gl_generic_init(&re->generic, ob,
+                                                eng_outbuf_swap_mode,
+                                                eng_outbuf_get_rot,
+                                                eng_outbuf_reconfigure,
+                                                eng_outbuf_region_first_rect,
+                                                eng_outbuf_new_region_for_update,
+                                                eng_outbuf_push_updated_region,
+                                                eng_outbuf_push_free_region_for_update,
+                                                NULL,
+                                                eng_outbuf_flush,
+                                                eng_window_free,
+                                                eng_window_use,
+                                                eng_outbuf_gl_context_get,
+                                                eng_outbuf_egl_display_get,
+                                                eng_gl_context_new,
+                                                eng_gl_context_use,
+                                                &evgl_funcs,
+                                                e->output.w, e->output.h))
           {
              free(re);
              return 0;
@@ -981,88 +1036,75 @@ eng_setup(Evas *eo_e, void *in)
                merge_mode = MERGE_FULL;
           }
 
-        evas_render_engine_software_generic_merge_mode_set(&re->generic, merge_mode);
+        evas_render_engine_software_generic_merge_mode_set(&re->generic.software, merge_mode);
 
         if (!initted)
           {
-             gl_symbols();
-
-             evas_common_cpu_init();
-             evas_common_blend_init();
-             evas_common_image_init();
-             evas_common_convert_init();
-             evas_common_scale_init();
-             evas_common_rectangle_init();
-             evas_common_polygon_init();
-             evas_common_line_init();
-             evas_common_font_init();
-             evas_common_draw_init();
-             evas_common_tilebuf_init();
-             evas_gl_preload_init();
              gl_extn_veto(re);
 //             evgl_engine_init(re, &evgl_funcs);
              initted = 1;
           }
+
      }
    else
      {
         re = e->engine.data.output;
-        if (re->generic.ob && _re_wincheck(re->generic.ob))
+        if (eng_get_ob(re) && _re_wincheck(eng_get_ob(re)))
           {
-             if ((re->generic.ob->info->info.display != re->generic.ob->disp) ||
-                 (re->generic.ob->info->info.drawable != re->generic.ob->win) ||
-                 (re->generic.ob->info->info.screen != re->generic.ob->screen) ||
-                 (re->generic.ob->info->info.visual != re->generic.ob->visual) ||
-                 (re->generic.ob->info->info.colormap != re->generic.ob->colormap) ||
-                 (re->generic.ob->info->info.depth != re->generic.ob->depth) ||
-                 (re->generic.ob->info->info.destination_alpha != re->generic.ob->alpha))
+             if ((eng_get_ob(re)->info->info.display != eng_get_ob(re)->disp) ||
+                 (eng_get_ob(re)->info->info.drawable != eng_get_ob(re)->win) ||
+                 (eng_get_ob(re)->info->info.screen != eng_get_ob(re)->screen) ||
+                 (eng_get_ob(re)->info->info.visual != eng_get_ob(re)->visual) ||
+                 (eng_get_ob(re)->info->info.colormap != eng_get_ob(re)->colormap) ||
+                 (eng_get_ob(re)->info->info.depth != eng_get_ob(re)->depth) ||
+                 (eng_get_ob(re)->info->info.destination_alpha != eng_get_ob(re)->alpha))
                {
                   Outbuf *ob;
 
-                  re->generic.ob->gl_context->references++;
+                  eng_get_ob(re)->gl_context->references++;
                   gl_wins--;
 
                   ob = eng_window_new(info, eo_e,
-                                      re->generic.ob->info->info.display,
-                                      re->generic.ob->info->info.drawable,
-                                      re->generic.ob->info->info.screen,
-                                      re->generic.ob->info->info.visual,
-                                      re->generic.ob->info->info.colormap,
-                                      re->generic.ob->info->info.depth,
+                                      eng_get_ob(re)->info->info.display,
+                                      eng_get_ob(re)->info->info.drawable,
+                                      eng_get_ob(re)->info->info.screen,
+                                      eng_get_ob(re)->info->info.visual,
+                                      eng_get_ob(re)->info->info.colormap,
+                                      eng_get_ob(re)->info->info.depth,
                                       e->output.w, e->output.h,
-                                      re->generic.ob->info->indirect,
-                                      re->generic.ob->info->info.destination_alpha,
-                                      re->generic.ob->info->info.rotation,
+                                      eng_get_ob(re)->info->indirect,
+                                      eng_get_ob(re)->info->info.destination_alpha,
+                                      eng_get_ob(re)->info->info.rotation,
                                       swap_mode);
 
-                  eng_window_free(re->generic.ob);
-                  re->generic.ob = NULL;
+                  eng_window_free(eng_get_ob(re));
+                  re->generic.software.ob = NULL;
 
                   eng_window_use(ob);
                   if (ob)
                     {
-                       evas_render_engine_software_generic_update(&re->generic, ob,
+                       evas_render_engine_software_generic_update(&re->generic.software, ob,
                                                                   e->output.w, e->output.h);
 
                        gl_wins++;
-                       re->generic.ob->gl_context->references--;
+                       eng_get_ob(re)->gl_context->references--;
                     }
                }
-             else if ((re->generic.ob->w != e->output.w) ||
-                      (re->generic.ob->h != e->output.h) ||
-                      (re->generic.ob->info->info.rotation != re->generic.ob->rot))
+             else if ((eng_get_ob(re)->w != e->output.w) ||
+                      (eng_get_ob(re)->h != e->output.h) ||
+                      (eng_get_ob(re)->info->info.rotation != eng_get_ob(re)->rot))
                {
-                  eng_outbuf_reconfigure(re->generic.ob, e->output.w, e->output.h, re->generic.ob->info->info.rotation, 0);
-                  if (re->generic.tb)
-                    evas_common_tilebuf_free(re->generic.tb);
-                  re->generic.tb = evas_common_tilebuf_new(e->output.w, e->output.h);
-                  if (re->generic.tb)
-                    evas_common_tilebuf_set_tile_size(re->generic.tb,
+                  eng_outbuf_reconfigure(eng_get_ob(re), e->output.w, e->output.h, eng_get_ob(re)->info->info.rotation, 0);
+                  if (re->generic.software.tb)
+                    evas_common_tilebuf_free(re->generic.software.tb);
+                  re->generic.software.tb = evas_common_tilebuf_new(e->output.w, e->output.h);
+                  if (re->generic.software.tb)
+                    evas_common_tilebuf_set_tile_size(re->generic.software.tb,
                                                       TILESIZE, TILESIZE);
                }
           }
      }
-   if (!re->generic.ob)
+   if (!eng_get_ob(re))
      {
         free(re);
         return 0;
@@ -1070,21 +1112,21 @@ eng_setup(Evas *eo_e, void *in)
 
    if (!e->engine.data.output)
      {
-        if (re->generic.ob)
+        if (eng_get_ob(re))
           {
-             eng_window_free(re->generic.ob);
+             eng_window_free(eng_get_ob(re));
              gl_wins--;
           }
         free(re);
         return 0;
      }
 
-   evas_render_engine_software_generic_tile_strict_set(&re->generic, EINA_TRUE);
+   evas_render_engine_software_generic_tile_strict_set(&re->generic.software, EINA_TRUE);
 
    if (!e->engine.data.context)
      e->engine.data.context =
      e->engine.func->context_new(e->engine.data.output);
-   eng_window_use(re->generic.ob);
+   eng_window_use(eng_get_ob(re));
 
    return 1;
 }
@@ -1099,27 +1141,27 @@ eng_output_free(void *data)
    if (re)
      {
 #ifndef GL_GLES
-        Display *disp = re->generic.ob->disp;
-        Window win = re->generic.ob->win;
+        Display *disp = eng_get_ob(re)->disp;
+        Window win = eng_get_ob(re)->win;
 #endif
 
-        evas_gl_preload_render_relax(eng_preload_make_current, re->generic.ob);
+        glsym_evas_gl_preload_render_relax(eng_preload_make_current, eng_get_ob(re));
 
 #if 0
 #ifdef GL_GLES
         // Destroy the resource surface
         // Only required for EGL case
         if (re->surface)
-           eglDestroySurface(re->generic.ob->egl_disp, re->surface);
+           eglDestroySurface(eng_get_ob(re)->egl_disp, re->surface);
 #endif
 
         // Destroy the resource context
         _destroy_internal_context(re, context);
 #endif
 
-        if (gl_wins == 1) evgl_engine_shutdown(re);
+        if (gl_wins == 1) glsym_evgl_engine_shutdown(re);
 
-        evas_render_engine_software_generic_clean(&re->generic);
+        evas_render_engine_software_generic_clean(&re->generic.software);
 
 #ifndef GL_GLES
         if (glsym_glXReleaseBuffersMESA)
@@ -1131,7 +1173,7 @@ eng_output_free(void *data)
      }
    if ((initted == 1) && (gl_wins == 0))
      {
-        evas_gl_preload_shutdown();
+        glsym_evas_gl_preload_shutdown();
         evas_common_image_shutdown();
         evas_common_font_shutdown();
         initted = 0;
@@ -1177,6 +1219,13 @@ eng_preload_make_current(void *data, void *doit)
    return EINA_TRUE;
 }
 
+static Eina_Bool
+eng_canvas_alpha_get(void *data, void *info EINA_UNUSED)
+{
+   Render_Engine *re = (Render_Engine *)data;
+   return re->generic.software.ob->alpha;
+}
+
 static void
 eng_output_dump(void *data)
 {
@@ -1185,238 +1234,10 @@ eng_output_dump(void *data)
    re = (Render_Engine *)data;
    evas_common_image_image_all_unload();
    evas_common_font_font_all_unload();
-   evas_gl_common_image_all_unload(re->generic.ob->gl_context);
+   glsym_evas_gl_common_image_all_unload(eng_get_ob(re)->gl_context);
    _re_winfree(re);
 }
 
-static void
-eng_rectangle_draw(void *data, void *context, void *surface, int x, int y, int w, int h, Eina_Bool do_async EINA_UNUSED)
-{
-   Render_Engine *re;
-
-   re = (Render_Engine *)data;
-   eng_window_use(re->generic.ob);
-   evas_gl_common_context_target_surface_set(re->generic.ob->gl_context, surface);
-   re->generic.ob->gl_context->dc = context;
-   evas_gl_common_rect_draw(re->generic.ob->gl_context, x, y, w, h);
-}
-
-static void
-eng_line_draw(void *data, void *context, void *surface, int p1x, int p1y, int p2x, int p2y, Eina_Bool do_async EINA_UNUSED)
-{
-   Render_Engine *re;
-
-   re = (Render_Engine *)data;
-   eng_window_use(re->generic.ob);
-   evas_gl_common_context_target_surface_set(re->generic.ob->gl_context, surface);
-   re->generic.ob->gl_context->dc = context;
-   evas_gl_common_line_draw(re->generic.ob->gl_context, p1x, p1y, p2x, p2y);
-}
-
-static void *
-eng_polygon_point_add(void *data, void *context EINA_UNUSED, void *polygon, int x, int y)
-{
-   Render_Engine *re;
-
-   re = (Render_Engine *)data;
-   (void) re;
-   return evas_gl_common_poly_point_add(polygon, x, y);
-}
-
-static void *
-eng_polygon_points_clear(void *data, void *context EINA_UNUSED, void *polygon)
-{
-   Render_Engine *re;
-
-   re = (Render_Engine *)data;
-   (void) re;
-   return evas_gl_common_poly_points_clear(polygon);
-}
-
-static void
-eng_polygon_draw(void *data, void *context, void *surface EINA_UNUSED, void *polygon, int x, int y, Eina_Bool do_async EINA_UNUSED)
-{
-   Render_Engine *re;
-
-   re = (Render_Engine *)data;
-   eng_window_use(re->generic.ob);
-   evas_gl_common_context_target_surface_set(re->generic.ob->gl_context, surface);
-   re->generic.ob->gl_context->dc = context;
-   evas_gl_common_poly_draw(re->generic.ob->gl_context, polygon, x, y);
-}
-
-static int
-eng_image_alpha_get(void *data EINA_UNUSED, void *image)
-{
-//   Render_Engine *re;
-   Evas_GL_Image *im;
-
-//   re = (Render_Engine *)data;
-   if (!image) return 1;
-   im = image;
-   return im->alpha;
-}
-
-static Evas_Colorspace
-eng_image_colorspace_get(void *data EINA_UNUSED, void *image)
-{
-//   Render_Engine *re;
-   Evas_GL_Image *im;
-
-//   re = (Render_Engine *)data;
-   if (!image) return EVAS_COLORSPACE_ARGB8888;
-   im = image;
-   return im->cs.space;
-}
-
-static void *
-eng_image_alpha_set(void *data, void *image, int has_alpha)
-{
-   Render_Engine *re;
-   Evas_GL_Image *im;
-
-   re = (Render_Engine *)data;
-   if (!image) return NULL;
-   im = image;
-   if (im->alpha == has_alpha) return image;
-   if (im->native.data)
-     {
-        im->alpha = has_alpha;
-        return image;
-     }
-   eng_window_use(re->generic.ob);
-   if ((im->tex) && (im->tex->pt->dyn.img))
-     {
-        im->alpha = has_alpha;
-        im->tex->alpha = im->alpha;
-        return image;
-     }
-   /* FIXME: can move to gl_common */
-   if (im->cs.space != EVAS_COLORSPACE_ARGB8888) return im;
-   if ((has_alpha) && (im->im->cache_entry.flags.alpha)) return image;
-   else if ((!has_alpha) && (!im->im->cache_entry.flags.alpha)) return image;
-   if (im->references > 1)
-     {
-        Evas_GL_Image *im_new;
-
-        if (!im->im->image.data)
-          {
-#ifdef EVAS_CSERVE2
-             if (evas_cserve2_use_get() && evas_cache2_image_cached(&im->im->cache_entry))
-               evas_cache2_image_load_data(&im->im->cache_entry);
-             else
-#endif
-               evas_cache_image_load_data(&im->im->cache_entry);
-          }
-        evas_gl_common_image_alloc_ensure(im);
-        im_new = evas_gl_common_image_new_from_copied_data
-           (im->gc, im->im->cache_entry.w, im->im->cache_entry.h,
-               im->im->image.data,
-               eng_image_alpha_get(data, image),
-               eng_image_colorspace_get(data, image));
-        if (!im_new) return im;
-        evas_gl_common_image_free(im);
-        im = im_new;
-     }
-   else
-     evas_gl_common_image_dirty(im, 0, 0, 0, 0);
-   return evas_gl_common_image_alpha_set(im, has_alpha ? 1 : 0);
-//   im->im->cache_entry.flags.alpha = has_alpha ? 1 : 0;
-//   return image;
-}
-
-static void *
-eng_image_border_set(void *data EINA_UNUSED, void *image, int l EINA_UNUSED, int r EINA_UNUSED, int t EINA_UNUSED, int b EINA_UNUSED)
-{
-//   Render_Engine *re;
-//
-//   re = (Render_Engine *)data;
-   return image;
-}
-
-static void
-eng_image_border_get(void *data EINA_UNUSED, void *image EINA_UNUSED, int *l EINA_UNUSED, int *r EINA_UNUSED, int *t EINA_UNUSED, int *b EINA_UNUSED)
-{
-//   Render_Engine *re;
-//
-//   re = (Render_Engine *)data;
-}
-
-static char *
-eng_image_comment_get(void *data EINA_UNUSED, void *image, char *key EINA_UNUSED)
-{
-//   Render_Engine *re;
-   Evas_GL_Image *im;
-
-//   re = (Render_Engine *)data;
-   if (!image) return NULL;
-   im = image;
-   if (!im->im) return NULL;
-   return im->im->info.comment;
-}
-
-static char *
-eng_image_format_get(void *data EINA_UNUSED, void *image)
-{
-//   Render_Engine *re;
-   Evas_GL_Image *im;
-
-//   re = (Render_Engine *)data;
-   im = image;
-   (void) im;
-   return NULL;
-}
-
-static void
-eng_image_colorspace_set(void *data, void *image, Evas_Colorspace cspace)
-{
-   Render_Engine *re;
-   Evas_GL_Image *im;
-
-   re = (Render_Engine *)data;
-   if (!image) return;
-   im = image;
-   if (im->native.data) return;
-   /* FIXME: can move to gl_common */
-   if (im->cs.space == cspace) return;
-   eng_window_use(re->generic.ob);
-   evas_gl_common_image_alloc_ensure(im);
-   evas_cache_image_colorspace(&im->im->cache_entry, cspace);
-   switch (cspace)
-     {
-      case EVAS_COLORSPACE_ARGB8888:
-         if (im->cs.data)
-           {
-              if (!im->cs.no_free) free(im->cs.data);
-              im->cs.data = NULL;
-              im->cs.no_free = 0;
-           }
-         break;
-      case EVAS_COLORSPACE_YCBCR422P601_PL:
-      case EVAS_COLORSPACE_YCBCR422P709_PL:
-      case EVAS_COLORSPACE_YCBCR422601_PL:
-      case EVAS_COLORSPACE_YCBCR420NV12601_PL:
-      case EVAS_COLORSPACE_YCBCR420TM12601_PL:
-         if (im->tex) evas_gl_common_texture_free(im->tex, EINA_TRUE);
-         im->tex = NULL;
-         if (im->cs.data)
-           {
-              if (!im->cs.no_free) free(im->cs.data);
-           }
-         if (im->im->cache_entry.h > 0)
-           im->cs.data =
-              calloc(1, im->im->cache_entry.h * sizeof(unsigned char *) * 2);
-         else
-           im->cs.data = NULL;
-         im->cs.no_free = 0;
-         break;
-      default:
-         abort();
-         break;
-     }
-   im->cs.space = cspace;
-}
-
 /////////////////////////////////////////////////////////////////////////
 //
 //
@@ -1471,7 +1292,7 @@ _native_bind_cb(void *data, void *image)
 
       if (glsym_glXBindTexImage)
         {
-          glsym_glXBindTexImage(re->generic.ob->disp, n->glx_pixmap,
+          glsym_glXBindTexImage(eng_get_ob(re)->disp, n->glx_pixmap,
                                 GLX_FRONT_LEFT_EXT, NULL);
           GLERR(__FUNCTION__, __FILE__, __LINE__, "");
         }
@@ -1505,7 +1326,7 @@ _native_unbind_cb(void *data, void *image)
 
       if (glsym_glXReleaseTexImage)
         {
-          glsym_glXReleaseTexImage(re->generic.ob->disp, n->glx_pixmap,
+          glsym_glXReleaseTexImage(eng_get_ob(re)->disp, n->glx_pixmap,
                                    GLX_FRONT_LEFT_EXT);
           GLERR(__FUNCTION__, __FILE__, __LINE__, "");
         }
@@ -1534,13 +1355,13 @@ _native_free_cb(void *data, void *image)
   if (n->ns.type == EVAS_NATIVE_SURFACE_X11)
     {
       pmid = n->pixmap;
-      eina_hash_del(re->generic.ob->gl_context->shared->native_pm_hash, &pmid, im);
+      eina_hash_del(eng_get_ob(re)->gl_context->shared->native_pm_hash, &pmid, im);
 #ifdef GL_GLES
       if (n->egl_surface)
         {
           if (glsym_eglDestroyImage)
             {
-              glsym_eglDestroyImage(re->generic.ob->egl_disp,
+              glsym_eglDestroyImage(eng_get_ob(re)->egl_disp,
                                     n->egl_surface);
               if (eglGetError() != EGL_SUCCESS)
                 ERR("eglDestroyImage() failed.");
@@ -1556,7 +1377,7 @@ _native_free_cb(void *data, void *image)
             {
               if (glsym_glXReleaseTexImage)
                 {
-                  glsym_glXReleaseTexImage(re->generic.ob->disp, n->glx_pixmap,
+                  glsym_glXReleaseTexImage(eng_get_ob(re)->disp, n->glx_pixmap,
                                            GLX_FRONT_LEFT_EXT);
                   GLERR(__FUNCTION__, __FILE__, __LINE__, "");
                 }
@@ -1565,7 +1386,7 @@ _native_free_cb(void *data, void *image)
             }
           if (glsym_glXDestroyPixmap)
             {
-              glsym_glXDestroyPixmap(re->generic.ob->disp, n->glx_pixmap);
+              glsym_glXDestroyPixmap(eng_get_ob(re)->disp, n->glx_pixmap);
               GLERR(__FUNCTION__, __FILE__, __LINE__, "");
             }
           else
@@ -1578,7 +1399,7 @@ _native_free_cb(void *data, void *image)
   else if (n->ns.type == EVAS_NATIVE_SURFACE_OPENGL)
     {
       texid = n->ns.data.opengl.texture_id;
-      eina_hash_del(re->generic.ob->gl_context->shared->native_tex_hash, &texid, im);
+      eina_hash_del(eng_get_ob(re)->gl_context->shared->native_tex_hash, &texid, im);
     }
   im->native.data        = NULL;
   im->native.func.data   = NULL;
@@ -1605,7 +1426,7 @@ eng_image_native_set(void *data, void *image, void *native)
     {
        if ((ns) && (ns->type == EVAS_NATIVE_SURFACE_OPENGL))
          {
-            im = evas_gl_common_image_new_from_data(re->generic.ob->gl_context,
+            im = glsym_evas_gl_common_image_new_from_data(eng_get_ob(re)->gl_context,
                                                     ns->data.opengl.w,
                                                     ns->data.opengl.h,
                                                     NULL, 1,
@@ -1644,13 +1465,13 @@ eng_image_native_set(void *data, void *image, void *native)
     }
   if ((!ns) && (!im->native.data)) return im;
 
-  eng_window_use(re->generic.ob);
+  eng_window_use(eng_get_ob(re));
 
   if (im->native.data)
     {
       if (im->native.func.free)
         im->native.func.free(im->native.func.data, im);
-      evas_gl_common_image_native_disable(im);
+      glsym_evas_gl_common_image_native_disable(im);
     }
 
   if (!ns) return im;
@@ -1658,15 +1479,15 @@ eng_image_native_set(void *data, void *image, void *native)
   if (ns->type == EVAS_NATIVE_SURFACE_X11)
     {
       pmid = pm;
-      im2 = eina_hash_find(re->generic.ob->gl_context->shared->native_pm_hash, &pmid);
+      im2 = eina_hash_find(eng_get_ob(re)->gl_context->shared->native_pm_hash, &pmid);
       if (im2 == im) return im;
       if (im2)
         {
            n = im2->native.data;
            if (n)
              {
-                evas_gl_common_image_ref(im2);
-                evas_gl_common_image_free(im);
+                glsym_evas_gl_common_image_ref(im2);
+                glsym_evas_gl_common_image_free(im);
                 return im2;
              }
         }
@@ -1674,24 +1495,24 @@ eng_image_native_set(void *data, void *image, void *native)
   else if (ns->type == EVAS_NATIVE_SURFACE_OPENGL)
     {
        texid = tex;
-       im2 = eina_hash_find(re->generic.ob->gl_context->shared->native_tex_hash, &texid);
+       im2 = eina_hash_find(eng_get_ob(re)->gl_context->shared->native_tex_hash, &texid);
        if (im2 == im) return im;
        if (im2)
          {
             n = im2->native.data;
             if (n)
               {
-                 evas_gl_common_image_ref(im2);
-                 evas_gl_common_image_free(im);
+                 glsym_evas_gl_common_image_ref(im2);
+                 glsym_evas_gl_common_image_free(im);
                  return im2;
               }
          }
 
     }
-  im2 = evas_gl_common_image_new_from_data(re->generic.ob->gl_context,
+  im2 = glsym_evas_gl_common_image_new_from_data(eng_get_ob(re)->gl_context,
                                            im->w, im->h, NULL, im->alpha,
                                            EVAS_COLORSPACE_ARGB8888);
-  evas_gl_common_image_free(im);
+  glsym_evas_gl_common_image_free(im);
   im = im2;
   if (!im) return NULL;
   if (ns->type == EVAS_NATIVE_SURFACE_X11)
@@ -1707,7 +1528,7 @@ eng_image_native_set(void *data, void *image, void *native)
               int num_config, i = 0;
               int yinvert = 1;
 
-              eina_hash_add(re->generic.ob->gl_context->shared->native_pm_hash, &pmid, im);
+              eina_hash_add(eng_get_ob(re)->gl_context->shared->native_pm_hash, &pmid, im);
 
               // assume 32bit pixmap! :)
               config_attrs[i++] = EGL_RED_SIZE;
@@ -1728,14 +1549,14 @@ eng_image_native_set(void *data, void *image, void *native)
               config_attrs[i++] = EGL_PIXMAP_BIT;
               config_attrs[i++] = EGL_NONE;
 
-              if (!eglChooseConfig(re->generic.ob->egl_disp, config_attrs,
+              if (!eglChooseConfig(eng_get_ob(re)->egl_disp, config_attrs,
                                    &egl_config, 1, &num_config))
                 ERR("eglChooseConfig() failed for pixmap 0x%x, num_config = %i", (unsigned int)pm, num_config);
               else
                 {
                   int val;
                   if (extn_have_y_inverted &&
-                      eglGetConfigAttrib(re->generic.ob->egl_disp, egl_config,
+                      eglGetConfigAttrib(eng_get_ob(re)->egl_disp, egl_config,
                                          EGL_Y_INVERTED_NOK, &val))
                         yinvert = val;
                 }
@@ -1744,7 +1565,7 @@ eng_image_native_set(void *data, void *image, void *native)
               n->pixmap = pm;
               n->visual = vis;
               if (glsym_eglCreateImage)
-                n->egl_surface = glsym_eglCreateImage(re->generic.ob->egl_disp,
+                n->egl_surface = glsym_eglCreateImage(eng_get_ob(re)->egl_disp,
                                                       EGL_NO_CONTEXT,
                                                       EGL_NATIVE_PIXMAP_KHR,
                                                       (void *)pm,
@@ -1762,7 +1583,7 @@ eng_image_native_set(void *data, void *image, void *native)
               im->native.func.free   = _native_free_cb;
               im->native.target      = GL_TEXTURE_2D;
               im->native.mipmap      = 0;
-              evas_gl_common_image_native_enable(im);
+              glsym_evas_gl_common_image_native_enable(im);
             }
         }
 #else
@@ -1774,7 +1595,7 @@ eng_image_native_set(void *data, void *image, void *native)
             Window wdummy;
             
             // fixme: round trip :(
-            XGetGeometry(re->generic.ob->disp, pm, &wdummy, &dummy, &dummy,
+            XGetGeometry(eng_get_ob(re)->disp, pm, &wdummy, &dummy, &dummy,
                          &w, &h, &border, &depth);
             if (depth <= 32)
               {
@@ -1822,8 +1643,8 @@ eng_image_native_set(void *data, void *image, void *native)
                       
                       config_attrs[i++] = 0;
                       
-                      configs = glXChooseFBConfig(re->generic.ob->disp,
-                                                  re->generic.ob->screen,
+                      configs = glXChooseFBConfig(eng_get_ob(re)->disp,
+                                                  eng_get_ob(re)->screen,
                                                   config_attrs,
                                                   &num);
                       if (configs)
@@ -1837,42 +1658,42 @@ eng_image_native_set(void *data, void *image, void *native)
                                   {
                                      XVisualInfo *vi;
                                      
-                                     vi = glXGetVisualFromFBConfig(re->generic.ob->disp, configs[j]);
+                                     vi = glXGetVisualFromFBConfig(eng_get_ob(re)->disp, configs[j]);
                                      if (!vi) continue;
                                      if (vi->depth != (int)depth) continue;
                                      XFree(vi);
                                      
-                                     glXGetFBConfigAttrib(re->generic.ob->disp, configs[j],
+                                     glXGetFBConfigAttrib(eng_get_ob(re)->disp, configs[j],
                                                           GLX_BUFFER_SIZE, &val);
                                      if (val != (int) depth) continue;
                                   }
-                                glXGetFBConfigAttrib(re->generic.ob->disp, configs[j],
+                                glXGetFBConfigAttrib(eng_get_ob(re)->disp, configs[j],
                                                      GLX_DRAWABLE_TYPE, &val);
                                 if (!(val & GLX_PIXMAP_BIT)) continue;
                                 tex_format = GLX_TEXTURE_FORMAT_RGB_EXT;
-                                glXGetFBConfigAttrib(re->generic.ob->disp, configs[j],
+                                glXGetFBConfigAttrib(eng_get_ob(re)->disp, configs[j],
                                                      GLX_ALPHA_SIZE, &val);
                                 if ((depth == 32) && (!val)) continue;
                                 if (val > 0)
                                   {
-                                     glXGetFBConfigAttrib(re->generic.ob->disp, configs[j],
+                                     glXGetFBConfigAttrib(eng_get_ob(re)->disp, configs[j],
                                                           GLX_BIND_TO_TEXTURE_RGBA_EXT, &val);
                                      if (val) tex_format = GLX_TEXTURE_FORMAT_RGBA_EXT;
                                   }
                                 else
                                   {
-                                     glXGetFBConfigAttrib(re->generic.ob->disp, configs[j],
+                                     glXGetFBConfigAttrib(eng_get_ob(re)->disp, configs[j],
                                                           GLX_BIND_TO_TEXTURE_RGB_EXT, &val);
                                      if (val) tex_format = GLX_TEXTURE_FORMAT_RGB_EXT;
                                   }
-                                glXGetFBConfigAttrib(re->generic.ob->disp, configs[j],
+                                glXGetFBConfigAttrib(eng_get_ob(re)->disp, configs[j],
                                                      GLX_Y_INVERTED_EXT, &val);
                                 yinvert = val;
-                                glXGetFBConfigAttrib(re->generic.ob->disp, configs[j],
+                                glXGetFBConfigAttrib(eng_get_ob(re)->disp, configs[j],
                                                      GLX_BIND_TO_TEXTURE_TARGETS_EXT,
                                                      &val);
                                 tex_target = val;
-                                glXGetFBConfigAttrib(re->generic.ob->disp, configs[j],
+                                glXGetFBConfigAttrib(eng_get_ob(re)->disp, configs[j],
                                                      GLX_BIND_TO_MIPMAP_TEXTURE_EXT, &val);
                                 mipmap = val;
                                 n->fbc = configs[j];
@@ -1887,7 +1708,7 @@ eng_image_native_set(void *data, void *image, void *native)
                            XFree(configs);
                         }
                       
-                      eina_hash_add(re->generic.ob->gl_context->shared->native_pm_hash, &pmid, im);
+                      eina_hash_add(eng_get_ob(re)->gl_context->shared->native_pm_hash, &pmid, im);
                       if ((tex_target & GLX_TEXTURE_2D_BIT_EXT))
                         target = GLX_TEXTURE_2D_EXT;
                       else if ((tex_target & GLX_TEXTURE_RECTANGLE_BIT_EXT))
@@ -1920,7 +1741,7 @@ eng_image_native_set(void *data, void *image, void *native)
                       n->pixmap = pm;
                       n->visual = vis;
                       if (glsym_glXCreatePixmap)
-                        n->glx_pixmap = glsym_glXCreatePixmap(re->generic.ob->disp,
+                        n->glx_pixmap = glsym_glXCreatePixmap(eng_get_ob(re)->disp,
                                                               n->fbc,
                                                               n->pixmap,
                                                               pixmap_att);
@@ -1934,7 +1755,7 @@ eng_image_native_set(void *data, void *image, void *native)
                              {
                                 ERR("no target :(");
                                 if (glsym_glXQueryDrawable)
-                                  glsym_glXQueryDrawable(re->generic.ob->disp,
+                                  glsym_glXQueryDrawable(eng_get_ob(re)->disp,
                                                          n->pixmap,
                                                          GLX_TEXTURE_TARGET_EXT,
                                                          &target);
@@ -1961,14 +1782,14 @@ eng_image_native_set(void *data, void *image, void *native)
                       else
                         ERR("GLX Pixmap create fail");
                       im->native.yinvert     = yinvert;
-                      im->native.loose       = re->generic.ob->detected.loose_binding;
+                      im->native.loose       = eng_get_ob(re)->detected.loose_binding;
                       im->native.data        = n;
                       im->native.func.data   = re;
                       im->native.func.bind   = _native_bind_cb;
                       im->native.func.unbind = _native_unbind_cb;
                       im->native.func.free   = _native_free_cb;
                       
-                      evas_gl_common_image_native_enable(im);
+                      glsym_evas_gl_common_image_native_enable(im);
                    }
               }
          }
@@ -1984,7 +1805,7 @@ eng_image_native_set(void *data, void *image, void *native)
             {
               memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface));
 
-              eina_hash_add(re->generic.ob->gl_context->shared->native_tex_hash, &texid, im);
+              eina_hash_add(eng_get_ob(re)->gl_context->shared->native_tex_hash, &texid, im);
 
               n->pixmap = 0;
               n->visual = 0;
@@ -2008,7 +1829,7 @@ eng_image_native_set(void *data, void *image, void *native)
               // FIXME: need to implement mapping sub texture regions
               // x, y, w, h for possible texture atlasing
 
-              evas_gl_common_image_native_enable(im);
+              glsym_evas_gl_common_image_native_enable(im);
             }
         }
 
@@ -2016,1417 +1837,46 @@ eng_image_native_set(void *data, void *image, void *native)
    return im;
 }
 
-static void *
-eng_image_native_get(void *data EINA_UNUSED, void *image)
-{
-   Evas_GL_Image *im = image;
-   Native *n;
-   if (!im) return NULL;
-   n = im->native.data;
-   if (!n) return NULL;
-   return &(n->ns);
-}
-
-
-//
-//
-/////////////////////////////////////////////////////////////////////////
-
-static void *
-eng_image_load(void *data, const char *file, const char *key, int *error, Evas_Image_Load_Opts *lo)
-{
-   Render_Engine *re;
-
-   re = (Render_Engine *)data;
-   *error = EVAS_LOAD_ERROR_NONE;
-   eng_window_use(re->generic.ob);
-   return evas_gl_common_image_load(re->generic.ob->gl_context, file, key, lo, error);
-}
-
-static void *
-eng_image_mmap(void *data, Eina_File *f, const char *key, int *error, Evas_Image_Load_Opts *lo)
-{
-   Render_Engine *re;
-
-   re = (Render_Engine *)data;
-   *error = EVAS_LOAD_ERROR_NONE;
-   eng_window_use(re->generic.ob);
-   return evas_gl_common_image_mmap(re->generic.ob->gl_context, f, key, lo, error);
-}
-
-static void *
-eng_image_new_from_data(void *data, int w, int h, DATA32 *image_data, int alpha, Evas_Colorspace cspace)
-{
-   Render_Engine *re;
-
-   re = (Render_Engine *)data;
-   eng_window_use(re->generic.ob);
-   return evas_gl_common_image_new_from_data(re->generic.ob->gl_context, w, h, image_data, alpha, cspace);
-}
-
-static void *
-eng_image_new_from_copied_data(void *data, int w, int h, DATA32 *image_data, int alpha, Evas_Colorspace cspace)
-{
-   Render_Engine *re;
-
-   re = (Render_Engine *)data;
-   eng_window_use(re->generic.ob);
-   return evas_gl_common_image_new_from_copied_data(re->generic.ob->gl_context, w, h, image_data, alpha, cspace);
-}
-
-static void
-eng_image_free(void *data, void *image)
-{
-   Render_Engine *re;
-
-   re = (Render_Engine *)data;
-   if (!image) return;
-   eng_window_use(re->generic.ob);
-   evas_gl_common_image_free(image);
-}
-
-static void
-eng_image_size_get(void *data EINA_UNUSED, void *image, int *w, int *h)
-{
-   if (!image)
-     {
-        *w = 0;
-        *h = 0;
-        return;
-     }
-   if (w) *w = ((Evas_GL_Image *)image)->w;
-   if (h) *h = ((Evas_GL_Image *)image)->h;
-}
-
-static void *
-eng_image_size_set(void *data, void *image, int w, int h)
+static int
+module_open(Evas_Module *em)
 {
-   Render_Engine *re;
-   Evas_GL_Image *im = image;
-   Evas_GL_Image *im_old;
-
-   re = (Render_Engine *)data;
-   if (!im) return NULL;
-   if (im->native.data)
-     {
-        im->w = w;
-        im->h = h;
-        return image;
-     }
-   eng_window_use(re->generic.ob);
-   if ((im->tex) && (im->tex->pt->dyn.img))
-     {
-        evas_gl_common_texture_free(im->tex, EINA_TRUE);
-        im->tex = NULL;
-        im->w = w;
-        im->h = h;
-        im->tex = evas_gl_common_texture_dynamic_new(im->gc, im);
-        return image;
-     }
-   im_old = image;
-
-   switch (eng_image_colorspace_get(data, image))
+   static Eina_Bool xrm_inited = EINA_FALSE;
+   if (!xrm_inited)
      {
-      case EVAS_COLORSPACE_YCBCR422P601_PL:
-      case EVAS_COLORSPACE_YCBCR422P709_PL:
-      case EVAS_COLORSPACE_YCBCR422601_PL:
-      case EVAS_COLORSPACE_YCBCR420NV12601_PL:
-      case EVAS_COLORSPACE_YCBCR420TM12601_PL:
-         w &= ~0x1;
-         break;
-      default: break;
+        xrm_inited = EINA_TRUE;
+        XrmInitialize();
      }
 
-   evas_gl_common_image_alloc_ensure(im_old);
-   if ((im_old->im) &&
-       ((int)im_old->im->cache_entry.w == w) &&
-       ((int)im_old->im->cache_entry.h == h))
-     return image;
-   if (im_old)
+   if (!em) return 0;
+   /* get whatever engine module we inherit from */
+   if (!_evas_module_engine_inherit(&pfunc, "gl_generic")) return 0;
+   if (_evas_engine_GL_X11_log_dom < 0)
+     _evas_engine_GL_X11_log_dom = eina_log_domain_register
+       ("evas-gl_x11", EVAS_DEFAULT_LOG_COLOR);
+   if (_evas_engine_GL_X11_log_dom < 0)
      {
-        im = evas_gl_common_image_new(re->generic.ob->gl_context, w, h,
-                                      eng_image_alpha_get(data, image),
-                                      eng_image_colorspace_get(data, image));
-        evas_gl_common_image_free(im_old);
+        EINA_LOG_ERR("Can not create a module log domain.");
+        return 0;
      }
-   else
-     im = evas_gl_common_image_new(re->generic.ob->gl_context, w, h, 1, EVAS_COLORSPACE_ARGB8888);
-   return im;
-}
-
-static void *
-eng_image_dirty_region(void *data, void *image, int x, int y, int w, int h)
-{
-   Render_Engine *re;
-   Evas_GL_Image *im = image;
-
-   re = (Render_Engine *)data;
-   if (!image) return NULL;
-   if (im->native.data) return image;
-   eng_window_use(re->generic.ob);
-   evas_gl_common_image_dirty(image, x, y, w, h);
-   return image;
-}
-
-static void *
-eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data, int *err)
-{
-   Render_Engine *re;
-   Evas_GL_Image *im;
-   int error;
 
-   re = (Render_Engine *)data;
-   if (!image)
-     {
-        *image_data = NULL;
-        if (err) *err = EVAS_LOAD_ERROR_GENERIC;
-        return NULL;
-     }
-   im = image;
-   if (im->native.data)
+   if (partial_render_debug == -1)
      {
-        *image_data = NULL;
-        if (err) *err = EVAS_LOAD_ERROR_NONE;
-        return im;
+        if (getenv("EVAS_GL_PARTIAL_DEBUG")) partial_render_debug = 1;
+        else partial_render_debug = 0;
      }
 
-#ifdef GL_GLES
-   eng_window_use(re->generic.ob);
-
-   if ((im->tex) && (im->tex->pt) && (im->tex->pt->dyn.img) && (im->cs.space == EVAS_COLORSPACE_ARGB8888))
-     {
-        if (im->tex->pt->dyn.checked_out > 0)
-          {
-             im->tex->pt->dyn.checked_out++;
-             *image_data = im->tex->pt->dyn.data;
-             if (err) *err = EVAS_LOAD_ERROR_NONE;
-             return im;
-          }
-        *image_data = im->tex->pt->dyn.data = secsym_eglMapImageSEC(re->generic.ob->egl_disp, 
-                                                                   im->tex->pt->dyn.img, 
-                                                                   EGL_MAP_GL_TEXTURE_DEVICE_CPU_SEC, 
-                                                                   EGL_MAP_GL_TEXTURE_OPTION_WRITE_SEC);
-
-        if (!im->tex->pt->dyn.data)
-          {
-             if (err) *err = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
-             GLERR(__FUNCTION__, __FILE__, __LINE__, "");
-             return im;
-          }
-        im->tex->pt->dyn.checked_out++;
+   /* store it for later use */
+   func = pfunc;
+   /* now to override methods */
+   #define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_)
+   ORD(info);
+   ORD(info_free);
+   ORD(setup);
+   ORD(canvas_alpha_get);
+   ORD(output_free);
+   ORD(output_dump);
 
-        if (err) *err = EVAS_LOAD_ERROR_NONE;
-        return im;
-     }
-#else
-   if ((im->tex) && (im->tex->pt) && (im->tex->pt->dyn.data))
-     {
-        *image_data = im->tex->pt->dyn.data;
-        if (err) *err = EVAS_LOAD_ERROR_NONE;
-        return im;
-     }
-
-   eng_window_use(re->generic.ob);
-#endif
-
-   /* Engine can be fail to create texture after cache drop like eng_image_content_hint_set function,
-        so it is need to add code which check im->im's NULL value*/
-
-   if (!im->im)
-    {
-       *image_data = NULL;
-       if (err) *err = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
-       return NULL;
-    }
-
-#ifdef EVAS_CSERVE2
-   if (evas_cserve2_use_get() && evas_cache2_image_cached(&im->im->cache_entry))
-     error = evas_cache2_image_load_data(&im->im->cache_entry);
-   else
-#endif
-     error = evas_cache_image_load_data(&im->im->cache_entry);
-   evas_gl_common_image_alloc_ensure(im);
-   switch (im->cs.space)
-     {
-      case EVAS_COLORSPACE_ARGB8888:
-      case EVAS_COLORSPACE_AGRY88:
-      case EVAS_COLORSPACE_GRY8:
-         if (to_write)
-           {
-              if (im->references > 1)
-                {
-                   Evas_GL_Image *im_new;
-
-                   im_new = evas_gl_common_image_new_from_copied_data
-                      (im->gc, im->im->cache_entry.w, im->im->cache_entry.h,
-                       im->im->image.data,
-                       eng_image_alpha_get(data, image),
-                       eng_image_colorspace_get(data, image));
-                   if (!im_new)
-                     {
-                        *image_data = NULL;
-                        if (err) *err = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
-                        return NULL;
-                     }
-                   evas_gl_common_image_free(im);
-                   im = im_new;
-                }
-              else
-                evas_gl_common_image_dirty(im, 0, 0, 0, 0);
-           }
-         *image_data = im->im->image.data;
-         break;
-      case EVAS_COLORSPACE_YCBCR422P601_PL:
-      case EVAS_COLORSPACE_YCBCR422P709_PL:
-      case EVAS_COLORSPACE_YCBCR422601_PL:
-      case EVAS_COLORSPACE_YCBCR420NV12601_PL:
-      case EVAS_COLORSPACE_YCBCR420TM12601_PL:
-         *image_data = im->cs.data;
-         break;
-      case EVAS_COLORSPACE_ETC1:
-      case EVAS_COLORSPACE_RGB8_ETC2:
-      case EVAS_COLORSPACE_RGBA8_ETC2_EAC:
-      case EVAS_COLORSPACE_ETC1_ALPHA:
-         ERR("This image is encoded in ETC1 or ETC2, not returning any data");
-         error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT;
-         *image_data = NULL;
-         break;
-      default:
-         abort();
-         break;
-     }
-   if (err) *err = error;
-   return im;
-}
-
-static void *
-eng_image_data_put(void *data, void *image, DATA32 *image_data)
-{
-   Render_Engine *re;
-   Evas_GL_Image *im, *im2;
-
-   re = (Render_Engine *)data;
-   if (!image) return NULL;
-   im = image;
-   if (im->native.data) return image;
-   eng_window_use(re->generic.ob);
-   evas_gl_common_image_alloc_ensure(im);
-   if ((im->tex) && (im->tex->pt)
-       && (im->tex->pt->dyn.data)
-       && (im->cs.space == EVAS_COLORSPACE_ARGB8888))
-     {
-        if (im->tex->pt->dyn.data == image_data)
-          {
-             if (im->tex->pt->dyn.checked_out > 0)
-               {
-                 im->tex->pt->dyn.checked_out--;
-#ifdef GL_GLES
-                 if (im->tex->pt->dyn.checked_out == 0)
-                   secsym_eglUnmapImageSEC(re->generic.ob->egl_disp, im->tex->pt->dyn.img, EGL_MAP_GL_TEXTURE_DEVICE_CPU_SEC);
-#endif
-               }
-
-             return image;
-          }
-        im2 = eng_image_new_from_data(data, im->w, im->h, image_data,
-                                      eng_image_alpha_get(data, image),
-                                      eng_image_colorspace_get(data, image));
-        if (!im2) return im;
-        evas_gl_common_image_free(im);
-        im = im2;
-        evas_gl_common_image_dirty(im, 0, 0, 0, 0);
-        return im;
-     }
-   switch (im->cs.space)
-     {
-      case EVAS_COLORSPACE_ARGB8888:
-         if ((!im->im) || (image_data != im->im->image.data))
-           {
-              im2 = eng_image_new_from_data(data, im->w, im->h, image_data,
-                                            eng_image_alpha_get(data, image),
-                                            eng_image_colorspace_get(data, image));
-              if (!im2) return im;
-              evas_gl_common_image_free(im);
-              im = im2;
-           }
-         break;
-      case EVAS_COLORSPACE_YCBCR422P601_PL:
-      case EVAS_COLORSPACE_YCBCR422P709_PL:
-      case EVAS_COLORSPACE_YCBCR422601_PL:
-      case EVAS_COLORSPACE_YCBCR420NV12601_PL:
-      case EVAS_COLORSPACE_YCBCR420TM12601_PL:
-         if (image_data != im->cs.data)
-           {
-              if (im->cs.data)
-                {
-                   if (!im->cs.no_free) free(im->cs.data);
-                }
-              im->cs.data = image_data;
-           }
-         evas_gl_common_image_dirty(im, 0, 0, 0, 0);
-         break;
-      default:
-         abort();
-         break;
-     }
-   return im;
-}
-
-static void
-eng_image_data_preload_request(void *data, void *image, const Eo *target)
-{
-   Evas_GL_Image *gim = image;
-   Render_Engine *re = data;
-   RGBA_Image *im;
-
-   if (!gim) return;
-   if (gim->native.data) return;
-   im = (RGBA_Image *)gim->im;
-   if (!im) return;
-
-#ifdef EVAS_CSERVE2
-   if (evas_cserve2_use_get() && evas_cache2_image_cached(&im->cache_entry))
-     evas_cache2_image_preload_data(&im->cache_entry, target);
-   else
-#endif
-     evas_cache_image_preload_data(&im->cache_entry, target, NULL, NULL, NULL);
-   if (!gim->tex)
-     gim->tex = evas_gl_common_texture_new(re->generic.ob->gl_context, gim->im);
-   evas_gl_preload_target_register(gim->tex, (Eo*) target);
-}
-
-static void
-eng_image_data_preload_cancel(void *data EINA_UNUSED, void *image, const Eo *target)
-{
-   Evas_GL_Image *gim = image;
-   RGBA_Image *im;
-
-   if (!gim) return;
-   if (gim->native.data) return;
-   im = (RGBA_Image *)gim->im;
-   if (!im) return;
-
-#ifdef EVAS_CSERVE2
-   if (evas_cserve2_use_get() && evas_cache2_image_cached(&im->cache_entry))
-     evas_cache2_image_preload_cancel(&im->cache_entry, target);
-   else
-#endif
-     evas_cache_image_preload_cancel(&im->cache_entry, target);
-   evas_gl_preload_target_unregister(gim->tex, (Eo*) target);
-}
-
-static Eina_Bool
-eng_image_draw(void *data, void *context, void *surface, void *image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int smooth, Eina_Bool do_async EINA_UNUSED)
-{
-   Render_Engine *re;
-   re = (Render_Engine *)data;
-   Evas_GL_Image *im = image;
-   Native *n;
-
-   if (!im) return EINA_FALSE;
-   n = im->native.data;
-
-   if ((n) && (n->ns.type == EVAS_NATIVE_SURFACE_OPENGL) &&
-       (n->ns.data.opengl.framebuffer_id == 0) &&
-       re->func.get_pixels)
-     {
-        DBG("Rendering Directly to the window: %p", data);
-
-        re->generic.ob->gl_context->dc = context;
-
-        if (re->func.get_pixels)
-          {
-             if ((re->generic.ob->gl_context->master_clip.enabled) &&
-                 (re->generic.ob->gl_context->master_clip.w > 0) &&
-                 (re->generic.ob->gl_context->master_clip.h > 0))
-               {
-                  // Pass the preserve flag info the evas_gl
-                  evgl_direct_partial_info_set(re->generic.ob->gl_context->preserve_bit);
-               }
-
-             // Set necessary info for direct rendering
-             evgl_direct_info_set(re->generic.ob->gl_context->w,
-                                  re->generic.ob->gl_context->h,
-                                  re->generic.ob->gl_context->rot,
-                                  dst_x, dst_y, dst_w, dst_h,
-                                  re->generic.ob->gl_context->dc->clip.x,
-                                  re->generic.ob->gl_context->dc->clip.y,
-                                  re->generic.ob->gl_context->dc->clip.w,
-                                  re->generic.ob->gl_context->dc->clip.h);
-
-             // Call pixel get function
-             re->func.get_pixels(re->func.get_pixels_data, re->func.obj);
-
-             // Call end tile if it's being used
-             if ((re->generic.ob->gl_context->master_clip.enabled) &&
-                 (re->generic.ob->gl_context->master_clip.w > 0) &&
-                 (re->generic.ob->gl_context->master_clip.h > 0))
-               {
-                  evgl_direct_partial_render_end();
-                  evgl_direct_partial_info_clear();
-                  re->generic.ob->gl_context->preserve_bit = GL_COLOR_BUFFER_BIT0_QCOM;
-               }
-
-             // Reset direct rendering info
-             evgl_direct_info_clear();
-          }
-     }
-   else
-     {
-        eng_window_use(re->generic.ob);
-        evas_gl_common_context_target_surface_set(re->generic.ob->gl_context, surface);
-        re->generic.ob->gl_context->dc = context;
-        evas_gl_common_image_draw(re->generic.ob->gl_context, image,
-                                  src_x, src_y, src_w, src_h,
-                                  dst_x, dst_y, dst_w, dst_h,
-                                  smooth);
-     }
-
-   return EINA_FALSE;
-}
-
-static void
-eng_image_scale_hint_set(void *data EINA_UNUSED, void *image, int hint)
-{
-   if (image) evas_gl_common_image_scale_hint_set(image, hint);
-}
-
-static int
-eng_image_scale_hint_get(void *data EINA_UNUSED, void *image)
-{
-   Evas_GL_Image *gim = image;
-   if (!gim) return EVAS_IMAGE_SCALE_HINT_NONE;
-   return gim->scale_hint;
-}
-
-static Eina_Bool
-eng_image_map_draw(void *data, void *context, void *surface, void *image, RGBA_Map *m, int smooth, int level, Eina_Bool do_async)
-{
-   Evas_GL_Image *gim = image;
-   Render_Engine *re;
-
-   re = (Render_Engine *)data;
-   if (!image) return EINA_FALSE;
-   eng_window_use(re->generic.ob);
-   evas_gl_common_context_target_surface_set(re->generic.ob->gl_context, surface);
-   re->generic.ob->gl_context->dc = context;
-   if (m->count != 4)
-     {
-        // FIXME: nash - you didn't fix this
-        abort();
-     }
-   if ((m->pts[0].x == m->pts[3].x) &&
-       (m->pts[1].x == m->pts[2].x) &&
-       (m->pts[0].y == m->pts[1].y) &&
-       (m->pts[3].y == m->pts[2].y) &&
-       (m->pts[0].x <= m->pts[1].x) &&
-       (m->pts[0].y <= m->pts[2].y) &&
-       (m->pts[0].u == 0) &&
-       (m->pts[0].v == 0) &&
-       (m->pts[1].u == (gim->w << FP)) &&
-       (m->pts[1].v == 0) &&
-       (m->pts[2].u == (gim->w << FP)) &&
-       (m->pts[2].v == (gim->h << FP)) &&
-       (m->pts[3].u == 0) &&
-       (m->pts[3].v == (gim->h << FP)) &&
-       (m->pts[0].col == 0xffffffff) &&
-       (m->pts[1].col == 0xffffffff) &&
-       (m->pts[2].col == 0xffffffff) &&
-       (m->pts[3].col == 0xffffffff))
-     {
-        int dx, dy, dw, dh;
-
-        dx = m->pts[0].x >> FP;
-        dy = m->pts[0].y >> FP;
-        dw = (m->pts[2].x >> FP) - dx;
-        dh = (m->pts[2].y >> FP) - dy;
-        eng_image_draw(data, context, surface, image,
-                       0, 0, gim->w, gim->h, dx, dy, dw, dh, smooth, do_async);
-     }
-   else
-     {
-        evas_gl_common_image_map_draw(re->generic.ob->gl_context, image, m->count, &m->pts[0],
-                                      smooth, level);
-     }
-
-   return EINA_FALSE;
-}
-
-static void
-eng_image_map_clean(void *data EINA_UNUSED, RGBA_Map *m EINA_UNUSED)
-{
-}
-
-static void *
-eng_image_map_surface_new(void *data, int w, int h, int alpha)
-{
-   Render_Engine *re;
-
-   re = (Render_Engine *)data;
-   eng_window_use(re->generic.ob);
-   return evas_gl_common_image_surface_new(re->generic.ob->gl_context, w, h, alpha);
-}
-
-static void
-eng_image_map_surface_free(void *data, void *surface)
-{
-   Render_Engine *re;
-
-   re = (Render_Engine *)data;
-   eng_window_use(re->generic.ob);
-   evas_gl_common_image_free(surface);
-}
-
-static void
-eng_image_content_hint_set(void *data, void *image, int hint)
-{
-   Render_Engine *re;
-   re = (Render_Engine *)data;
-
-   if (re) eng_window_use(re->generic.ob);
-   if (image) evas_gl_common_image_content_hint_set(image, hint);
-}
-
-static int
-eng_image_content_hint_get(void *data EINA_UNUSED, void *image)
-{
-   Evas_GL_Image *gim = image;
-   if (!gim) return EVAS_IMAGE_CONTENT_HINT_NONE;
-   return gim->content_hint;
-}
-
-static void
-eng_image_cache_flush(void *data)
-{
-   Render_Engine *re;
-   int tmp_size;
-
-   re = (Render_Engine *)data;
-
-   eng_window_use(re->generic.ob);
-
-   tmp_size = evas_common_image_get_cache();
-   evas_common_image_set_cache(0);
-   evas_common_rgba_image_scalecache_flush();
-   evas_gl_common_image_cache_flush(re->generic.ob->gl_context);
-   evas_common_image_set_cache(tmp_size);
-}
-
-static void
-eng_image_cache_set(void *data, int bytes)
-{
-   Render_Engine *re;
-
-   re = (Render_Engine *)data;
-
-   eng_window_use(re->generic.ob);
-
-   evas_common_image_set_cache(bytes);
-   evas_common_rgba_image_scalecache_size_set(bytes);
-   evas_gl_common_image_cache_flush(re->generic.ob->gl_context);
-}
-
-static int
-eng_image_cache_get(void *data EINA_UNUSED)
-{
-   return evas_common_image_get_cache();
-}
-
-static void
-eng_image_stride_get(void *data EINA_UNUSED, void *image, int *stride)
-{
-   Evas_GL_Image *im = image;
-
-   if ((im->tex) && (im->tex->pt->dyn.img))
-     *stride = im->tex->pt->dyn.stride;
-   else
-     {
-        switch (im->cs.space)
-          {
-           case EVAS_COLORSPACE_ARGB8888:
-             *stride = im->w * 4;
-             return;
-           case EVAS_COLORSPACE_AGRY88:
-             *stride = im->w * 2;
-             return;
-           case EVAS_COLORSPACE_GRY8:
-             *stride = im->w * 1;
-             return;
-           case EVAS_COLORSPACE_YCBCR422P601_PL:
-           case EVAS_COLORSPACE_YCBCR422P709_PL:
-           case EVAS_COLORSPACE_YCBCR422601_PL:
-           case EVAS_COLORSPACE_YCBCR420NV12601_PL:
-           case EVAS_COLORSPACE_YCBCR420TM12601_PL:
-             *stride = im->w * 1;
-             return;
-           default:
-             ERR("Requested stride on an invalid format %d", im->cs.space);
-             *stride = 0;
-             return;
-          }
-     }
-}
-
-static Eina_Bool
-eng_font_draw(void *data, void *context, void *surface, Evas_Font_Set *font EINA_UNUSED, int x, int y, int w EINA_UNUSED, int h EINA_UNUSED, int ow EINA_UNUSED, int oh EINA_UNUSED, Evas_Text_Props *intl_props, Eina_Bool do_async EINA_UNUSED)
-{
-   Render_Engine *re;
-
-   re = (Render_Engine *)data;
-   eng_window_use(re->generic.ob);
-   evas_gl_common_context_target_surface_set(re->generic.ob->gl_context, surface);
-   re->generic.ob->gl_context->dc = context;
-     {
-        // FIXME: put im into context so we can free it
-        static RGBA_Image *im = NULL;
-
-        if (!im)
-          im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
-        im->cache_entry.w = re->generic.ob->gl_context->shared->w;
-        im->cache_entry.h = re->generic.ob->gl_context->shared->h;
-
-        evas_common_draw_context_font_ext_set(context,
-                                              re->generic.ob->gl_context,
-                                              evas_gl_font_texture_new,
-                                              evas_gl_font_texture_free,
-                                              evas_gl_font_texture_draw);
-        evas_common_font_draw_prepare(intl_props);
-        evas_common_font_draw(im, context, x, y, intl_props->glyphs);
-        evas_common_draw_context_font_ext_set(context,
-                                              NULL,
-                                              NULL,
-                                              NULL,
-                                              NULL);
-     }
-
-   return EINA_FALSE;
-}
-
-static Eina_Bool
-eng_canvas_alpha_get(void *data, void *info EINA_UNUSED)
-{
-   Render_Engine *re = (Render_Engine *)data;
-   return re->generic.ob->alpha;
-}
-
-//--------------------------------//
-// Evas GL Related Code
-static void *
-eng_gl_surface_create(void *data, void *config, int w, int h)
-{
-   Evas_GL_Config *cfg = (Evas_GL_Config *)config;
-
-   EVGLINIT(data, NULL);
-   return evgl_surface_create(data, cfg, w, h);
-}
-
-static int
-eng_gl_surface_destroy(void *data, void *surface)
-{
-   EVGL_Surface  *sfc = (EVGL_Surface *)surface;
-
-   EVGLINIT(data, 0);
-   return evgl_surface_destroy(data, sfc);
-}
-
-static void *
-eng_gl_context_create(void *data, void *share_context)
-{
-   EVGL_Context  *sctx = (EVGL_Context *)share_context;
-
-   EVGLINIT(data, NULL);
-   return evgl_context_create(data, sctx);
-}
-
-static int
-eng_gl_context_destroy(void *data, void *context)
-{
-   EVGL_Context  *ctx = (EVGL_Context *)context;
-
-   EVGLINIT(data, 0);
-   return evgl_context_destroy(data, ctx);
-}
-
-static int
-eng_gl_make_current(void *data, void *surface, void *context)
-{
-   Render_Engine *re  = (Render_Engine *)data;
-   EVGL_Surface  *sfc = (EVGL_Surface *)surface;
-   EVGL_Context  *ctx = (EVGL_Context *)context;
-
-   EVGLINIT(data, 0);
-   if ((sfc) && (ctx))
-     {
-        if ((re->generic.ob->gl_context->havestuff) ||
-            (re->generic.ob->gl_context->master_clip.used))
-          {
-             eng_window_use(re->generic.ob);
-             evas_gl_common_context_flush(re->generic.ob->gl_context);
-             if (re->generic.ob->gl_context->master_clip.used)
-                evas_gl_common_context_done(re->generic.ob->gl_context);
-          }
-     }
-
-   return evgl_make_current(data, sfc, ctx);
-}
-
-static void *
-eng_gl_string_query(void *data, int name)
-{
-   EVGLINIT(data, NULL);
-   return (void *)evgl_string_query(name);
-}
-
-// Need to deprecate this function..
-static void *
-eng_gl_proc_address_get(void *data EINA_UNUSED, const char *name EINA_UNUSED)
-{
-   return NULL;
-}
-
-static int
-eng_gl_native_surface_get(void *data EINA_UNUSED, void *surface, void *native_surface)
-{
-   EVGL_Surface  *sfc = (EVGL_Surface *)surface;
-   Evas_Native_Surface *ns = (Evas_Native_Surface *)native_surface;
-
-   return evgl_native_surface_get(sfc, ns);
-}
-
-static void *
-eng_gl_api_get(void *data)
-{
-   EVGLINIT(data, NULL);
-   return evgl_api_get();
-}
-
-
-static void
-eng_gl_direct_override_get(void *data, int *override, int *force_off)
-{
-   EVGLINIT(data, );
-   evgl_direct_override_get(override, force_off);
-}
-
-static void
-eng_gl_get_pixels_set(void *data, void *get_pixels, void *get_pixels_data, void *obj)
-{
-   Render_Engine *re = (Render_Engine *)data;
-
-   EVGLINIT(data, );
-   re->func.get_pixels = get_pixels;
-   re->func.get_pixels_data = get_pixels_data;
-   re->func.obj = (Evas_Object*)obj;
-}
-
-static Eina_Bool
-eng_gl_surface_lock(void *data, void *surface)
-{
-   Render_Engine *re = data;
-   Evas_GL_Image *im = surface;
-
-   EVGLINIT(re, EINA_FALSE);
-   if (!im->tex || !im->tex->pt)
-     {
-        ERR("Can not lock image that is not a surface!");
-        return EINA_FALSE;
-     }
-
-   evas_gl_common_context_flush(im->gc);
-   im->locked = EINA_TRUE;
-   return EINA_TRUE;
-}
-
-static Eina_Bool
-eng_gl_surface_unlock(void *data, void *surface)
-{
-   Render_Engine *re = data;
-   Evas_GL_Image *im = surface;
-
-   EVGLINIT(re, EINA_FALSE);
-   im->locked = EINA_FALSE;
-   return EINA_TRUE;
-}
-
-static Eina_Bool
-eng_gl_surface_read_pixels(void *data, void *surface,
-                           int x, int y, int w, int h,
-                           Evas_Colorspace cspace, void *pixels)
-{
-   Render_Engine *re = data;
-   Evas_GL_Image *im = surface;
-
-   EINA_SAFETY_ON_NULL_RETURN_VAL(pixels, EINA_FALSE);
-
-   EVGLINIT(re, EINA_FALSE);
-   if (!im->locked)
-     {
-        // For now, this is useless, but let's force clients to lock :)
-        CRI("The surface must be locked before reading its pixels!");
-        return EINA_FALSE;
-     }
-
-   if (cspace != EVAS_COLORSPACE_ARGB8888)
-     {
-        ERR("Conversion to colorspace %d is not supported!", (int) cspace);
-        return EINA_FALSE;
-     }
-
-#ifdef GL_GLES
-# ifndef GL_FRAMEBUFFER
-#  define GL_FRAMEBUFFER GL_FRAMEBUFFER_OES
-# endif
-#else
-# ifndef GL_FRAMEBUFFER
-#  define GL_FRAMEBUFFER GL_FRAMEBUFFER_EXT
-# endif
-#endif
-
-   /* Since this is an FBO, the pixels are already in the right Y order.
-    * But some devices don't support GL_BGRA, so we still need to convert.
-    */
-
-   glsym_glBindFramebuffer(GL_FRAMEBUFFER, im->tex->pt->fb);
-   if (im->tex->pt->format == GL_BGRA)
-     glReadPixels(x, y, w, h, GL_BGRA, GL_UNSIGNED_BYTE, pixels);
-   else
-     {
-        DATA32 *ptr = pixels;
-        int k;
-
-        glReadPixels(x, y, w, h, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
-        for (k = w * h; k; --k)
-          {
-             const DATA32 v = *ptr;
-             *ptr++ = (v & 0xFF00FF00)
-                   | ((v & 0x00FF0000) >> 16)
-                   | ((v & 0x000000FF) << 16);
-          }
-     }
-   glsym_glBindFramebuffer(GL_FRAMEBUFFER, 0);
-
-   return EINA_TRUE;
-}
-//--------------------------------//
-
-static int
-eng_image_load_error_get(void *data EINA_UNUSED, void *image)
-{
-   Evas_GL_Image *im;
-
-   if (!image) return EVAS_LOAD_ERROR_NONE;
-   im = image;
-   return im->im->cache_entry.load_error;
-}
-
-static Eina_Bool
-eng_image_animated_get(void *data EINA_UNUSED, void *image)
-{
-   Evas_GL_Image *gim = image;
-   Image_Entry *im;
-
-   if (!gim) return EINA_FALSE;
-   im = (Image_Entry *)gim->im;
-   if (!im) return EINA_FALSE;
-
-   return im->animated.animated;
-}
-
-static int
-eng_image_animated_frame_count_get(void *data EINA_UNUSED, void *image)
-{
-   Evas_GL_Image *gim = image;
-   Image_Entry *im;
-
-   if (!gim) return -1;
-   im = (Image_Entry *)gim->im;
-   if (!im) return -1;
-
-   if (!im->animated.animated) return -1;
-   return im->animated.frame_count;
-}
-
-static Evas_Image_Animated_Loop_Hint
-eng_image_animated_loop_type_get(void *data EINA_UNUSED, void *image)
-{
-   Evas_GL_Image *gim = image;
-   Image_Entry *im;
-
-   if (!gim) return EVAS_IMAGE_ANIMATED_HINT_NONE;
-   im = (Image_Entry *)gim->im;
-   if (!im) return EVAS_IMAGE_ANIMATED_HINT_NONE;
-
-   if (!im->animated.animated) return EVAS_IMAGE_ANIMATED_HINT_NONE;
-   return im->animated.loop_hint;
-}
-
-static int
-eng_image_animated_loop_count_get(void *data EINA_UNUSED, void *image)
-{
-   Evas_GL_Image *gim = image;
-   Image_Entry *im;
-
-   if (!gim) return -1;
-   im = (Image_Entry *)gim->im;
-   if (!im) return -1;
-
-   if (!im->animated.animated) return -1;
-   return im->animated.loop_count;
-}
-
-static double
-eng_image_animated_frame_duration_get(void *data EINA_UNUSED, void *image, int start_frame, int frame_num)
-{
-   Evas_GL_Image *gim = image;
-   Image_Entry *im;
-
-   if (!gim) return -1;
-   im = (Image_Entry *)gim->im;
-   if (!im) return -1;
-
-   if (!im->animated.animated) return -1;
-   return evas_common_load_rgba_image_frame_duration_from_file(im, start_frame, frame_num);
-}
-
-static Eina_Bool
-eng_image_animated_frame_set(void *data EINA_UNUSED, void *image, int frame_index)
-{
-   Evas_GL_Image *gim = image;
-   Image_Entry *im;
-
-   if (!gim) return EINA_FALSE;
-   im = (Image_Entry *)gim->im;
-   if (!im) return EINA_FALSE;
-
-   if (!im->animated.animated) return EINA_FALSE;
-   if (im->animated.cur_frame == frame_index) return EINA_FALSE;
-
-   im->animated.cur_frame = frame_index;
-   return EINA_TRUE;
-}
-
-static Eina_Bool
-eng_image_can_region_get(void *data EINA_UNUSED, void *image)
-{
-   Evas_GL_Image *gim = image;
-   Image_Entry *im;
-   if (!gim) return EINA_FALSE;
-   im = (Image_Entry *)gim->im;
-   if (!im) return EINA_FALSE;
-   return ((Evas_Image_Load_Func*) im->info.loader)->do_region;
-}
-
-
-static void
-eng_image_max_size_get(void *data, int *maxw, int *maxh)
-{
-   Render_Engine *re = (Render_Engine *)data;
-   if (maxw) *maxw = re->generic.ob->gl_context->shared->info.max_texture_size;
-   if (maxh) *maxh = re->generic.ob->gl_context->shared->info.max_texture_size;
-}
-
-static Eina_Bool
-eng_pixel_alpha_get(void *image, int x, int y, DATA8 *alpha, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h)
-{
-   Evas_GL_Image *im = image;
-   int px, py, dx, dy, sx, sy, src_w, src_h;
-   double scale_w, scale_h;
-
-   if (!im) return EINA_FALSE;
-
-   if ((dst_region_x > x) || (x >= (dst_region_x + dst_region_w)) ||
-       (dst_region_y > y) || (y >= (dst_region_y + dst_region_h)))
-     {
-        *alpha = 0;
-        return EINA_FALSE;
-     }
-
-   evas_gl_common_image_alloc_ensure(im);
-   src_w = im->im->cache_entry.w;
-   src_h = im->im->cache_entry.h;
-   if ((src_w == 0) || (src_h == 0))
-     {
-        *alpha = 0;
-        return EINA_TRUE;
-     }
-
-   EINA_SAFETY_ON_TRUE_GOTO(src_region_x < 0, error_oob);
-   EINA_SAFETY_ON_TRUE_GOTO(src_region_y < 0, error_oob);
-   EINA_SAFETY_ON_TRUE_GOTO(src_region_x + src_region_w > src_w, error_oob);
-   EINA_SAFETY_ON_TRUE_GOTO(src_region_y + src_region_h > src_h, error_oob);
-
-   scale_w = (double)dst_region_w / (double)src_region_w;
-   scale_h = (double)dst_region_h / (double)src_region_h;
-
-   /* point at destination */
-   dx = x - dst_region_x;
-   dy = y - dst_region_y;
-
-   /* point at source */
-   sx = dx / scale_w;
-   sy = dy / scale_h;
-
-   /* pixel point (translated) */
-   px = src_region_x + sx;
-   py = src_region_y + sy;
-   EINA_SAFETY_ON_TRUE_GOTO(px >= src_w, error_oob);
-   EINA_SAFETY_ON_TRUE_GOTO(py >= src_h, error_oob);
-
-   switch (im->im->cache_entry.space)
-     {
-     case EVAS_COLORSPACE_ARGB8888:
-       {
-          DATA32 *pixel;
-
-#ifdef EVAS_CSERVE2
-          if (evas_cserve2_use_get() && evas_cache2_image_cached(&im->im->cache_entry))
-            evas_cache2_image_load_data(&im->im->cache_entry);
-          else
-#endif
-            evas_cache_image_load_data(&im->im->cache_entry);
-          if (!im->im->cache_entry.flags.loaded)
-            {
-               ERR("im %p has no pixels loaded yet", im);
-               return EINA_FALSE;
-            }
-
-          pixel = im->im->image.data;
-          pixel += ((py * src_w) + px);
-          *alpha = ((*pixel) >> 24) & 0xff;
-       }
-       break;
-
-     default:
-        ERR("Colorspace %d not supported.", im->im->cache_entry.space);
-        *alpha = 0;
-     }
-
-   return EINA_TRUE;
-
- error_oob:
-   ERR("Invalid region src=(%d, %d, %d, %d), dst=(%d, %d, %d, %d), image=%dx%d",
-       src_region_x, src_region_y, src_region_w, src_region_h,
-       dst_region_x, dst_region_y, dst_region_w, dst_region_h,
-       src_w, src_h);
-   *alpha = 0;
-   return EINA_TRUE;
-}
-
-static void
-eng_context_flush(void *data)
-{
-   Render_Engine *re;
-   re = (Render_Engine *)data;
-
-   if ((re->generic.ob->gl_context->havestuff) ||
-     (re->generic.ob->gl_context->master_clip.used))
-   {
-      eng_window_use(re->generic.ob);
-      evas_gl_common_context_flush(re->generic.ob->gl_context);
-      if (re->generic.ob->gl_context->master_clip.used)
-         evas_gl_common_context_done(re->generic.ob->gl_context);
-   }
-}
-
-static void
-eng_context_3d_use(void *data)
-{
-   Render_Engine *re = (Render_Engine *)data;
-
-   if (!re->context_3d)
-     re->context_3d = eng_gl_context_new(re->generic.ob);
-   if (re->context_3d) eng_gl_context_use(re->context_3d);
-}
-
-static E3D_Renderer *
-eng_renderer_3d_get(void *data)
-{
-   Render_Engine *re = (Render_Engine *)data;
-
-   if (!re->renderer_3d)
-     re->renderer_3d = e3d_renderer_new();
-   return re->renderer_3d;
-}
-
-static void *
-eng_drawable_new(void *data, int w, int h, int alpha)
-{
-   eng_context_3d_use(data);
-#ifdef GL_GLES
-   return e3d_drawable_new(w, h, alpha, GL_DEPTH_STENCIL_OES, GL_NONE);
-#else
-   return e3d_drawable_new(w, h, alpha, GL_DEPTH24_STENCIL8, GL_NONE);
-#endif
-}
-
-static void
-eng_drawable_free(void *data, void *drawable)
-{
-   eng_context_3d_use(data);
-   e3d_drawable_free(drawable);
-}
-
-static void
-eng_drawable_size_get(void *data EINA_UNUSED, void *drawable, int *w, int *h)
-{
-   e3d_drawable_size_get((E3D_Drawable *)drawable, w, h);
-}
-
-static void *
-eng_image_drawable_set(void *data, void *image, void *drawable)
-{
-   E3D_Drawable *d = (E3D_Drawable *)drawable;
-   Evas_Native_Surface ns;
-   int w, h;
-
-   ns.type = EVAS_NATIVE_SURFACE_OPENGL;
-   ns.data.opengl.texture_id = e3d_drawable_texture_id_get(d);
-   ns.data.opengl.framebuffer_id = 0;
-   ns.data.opengl.internal_format = e3d_drawable_format_get(d);
-   ns.data.opengl.format = e3d_drawable_format_get(d);
-   ns.data.opengl.x = 0;
-   ns.data.opengl.y = 0;
-   e3d_drawable_size_get(d, &w, &h);
-   ns.data.opengl.w = w;
-   ns.data.opengl.h = h;
-
-   return eng_image_native_set(data, image, &ns);
-}
-
-static void
-eng_drawable_scene_render(void *data, void *drawable, void *scene_data)
-{
-   Render_Engine *re = (Render_Engine *)data;
-   E3D_Renderer *renderer = NULL;
-
-   eng_window_use(re->generic.ob);
-   evas_gl_common_context_flush(re->generic.ob->gl_context);
-
-   eng_context_3d_use(data);
-   renderer = eng_renderer_3d_get(data);
-   e3d_drawable_scene_render(drawable, renderer, scene_data);
-}
-
-static void *
-eng_texture_new(void *data EINA_UNUSED)
-{
-   return e3d_texture_new();
-}
-
-static void
-eng_texture_free(void *data EINA_UNUSED, void *texture)
-{
-   e3d_texture_free((E3D_Texture *)texture);
-}
-
-static void
-eng_texture_data_set(void *data, void *texture, Evas_3D_Color_Format color_format,
-                     Evas_3D_Pixel_Format pixel_format, int w, int h, const void *pixels)
-{
-   Render_Engine *re = (Render_Engine *)data;
-   eng_window_use(re->generic.ob);
-   evas_gl_common_context_flush(re->generic.ob->gl_context);
-   eng_context_3d_use(data);
-
-   e3d_texture_data_set((E3D_Texture *)texture, color_format, pixel_format, w, h, pixels);
-}
-
-static void
-eng_texture_file_set(void *data, void *texture, const char *file, const char *key)
-{
-   Render_Engine *re = (Render_Engine *)data;
-   eng_window_use(re->generic.ob);
-   evas_gl_common_context_flush(re->generic.ob->gl_context);
-   eng_context_3d_use(data);
-
-   e3d_texture_file_set((E3D_Texture *)texture, file, key);
-}
-
-static void
-eng_texture_color_format_get(void *data EINA_UNUSED, void *texture, Evas_3D_Color_Format *format)
-{
-   *format = e3d_texture_color_format_get((E3D_Texture *)texture);
-}
-
-static void
-eng_texture_size_get(void *data EINA_UNUSED, void *texture, int *w, int *h)
-{
-   e3d_texture_size_get((E3D_Texture *)texture, w, h);
-}
-
-static void
-eng_texture_wrap_set(void *data EINA_UNUSED, void *texture,
-                     Evas_3D_Wrap_Mode s, Evas_3D_Wrap_Mode t)
-{
-   e3d_texture_wrap_set((E3D_Texture *)texture, s, t);
-}
-
-static void
-eng_texture_wrap_get(void *data EINA_UNUSED, void *texture,
-                     Evas_3D_Wrap_Mode *s, Evas_3D_Wrap_Mode *t)
-{
-   e3d_texture_wrap_get((E3D_Texture *)texture, s, t);
-}
-
-static void
-eng_texture_filter_set(void *data EINA_UNUSED, void *texture,
-                       Evas_3D_Texture_Filter min, Evas_3D_Texture_Filter mag)
-{
-   e3d_texture_filter_set((E3D_Texture *)texture, min, mag);
-}
-
-static void
-eng_texture_filter_get(void *data EINA_UNUSED, void *texture,
-                       Evas_3D_Texture_Filter *min, Evas_3D_Texture_Filter *mag)
-{
-   e3d_texture_filter_get((E3D_Texture *)texture, min, mag);
-}
-
-static void
-eng_texture_image_set(void *data EINA_UNUSED, void *texture, void *image)
-{
-   Evas_GL_Image *im = (Evas_GL_Image *)image;
-   e3d_texture_import((E3D_Texture *)texture, im->tex->pt->texture);
-}
-
-static int
-module_open(Evas_Module *em)
-{
-   static Eina_Bool xrm_inited = EINA_FALSE;
-   if (!xrm_inited)
-     {
-        xrm_inited = EINA_TRUE;
-        XrmInitialize();
-     }
-
-   if (!em) return 0;
-   if (!evas_gl_common_module_open()) return 0;
-   /* get whatever engine module we inherit from */
-   if (!_evas_module_engine_inherit(&pfunc, "software_generic")) return 0;
-   if (_evas_engine_GL_X11_log_dom < 0)
-     _evas_engine_GL_X11_log_dom = eina_log_domain_register
-       ("evas-gl_x11", EVAS_DEFAULT_LOG_COLOR);
-   if (_evas_engine_GL_X11_log_dom < 0)
-     {
-        EINA_LOG_ERR("Can not create a module log domain.");
-        return 0;
-     }
-
-   if (partial_render_debug == -1)
-     {
-        if (getenv("EVAS_GL_PARTIAL_DEBUG")) partial_render_debug = 1;
-        else partial_render_debug = 0;
-     }
-
-   /* store it for later use */
-   func = pfunc;
-   /* now to override methods */
-   #define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_)
-   ORD(info);
-   ORD(info_free);
-   ORD(setup);
-   ORD(canvas_alpha_get);
-   ORD(output_free);
-   ORD(output_dump);
-   ORD(rectangle_draw);
-   ORD(line_draw);
-   ORD(polygon_point_add);
-   ORD(polygon_points_clear);
-   ORD(polygon_draw);
-
-   ORD(image_load);
-   ORD(image_mmap);
-   ORD(image_new_from_data);
-   ORD(image_new_from_copied_data);
-   ORD(image_free);
-   ORD(image_size_get);
-   ORD(image_size_set);
-   ORD(image_dirty_region);
-   ORD(image_data_get);
-   ORD(image_data_put);
-   ORD(image_data_preload_request);
-   ORD(image_data_preload_cancel);
-   ORD(image_alpha_set);
-   ORD(image_alpha_get);
-   ORD(image_border_set);
-   ORD(image_border_get);
-   ORD(image_draw);
-   ORD(image_comment_get);
-   ORD(image_format_get);
-   ORD(image_colorspace_set);
-   ORD(image_colorspace_get);
-   ORD(image_can_region_get);
    ORD(image_native_set);
-   ORD(image_native_get);
-
-   ORD(font_draw);
-
-   ORD(image_scale_hint_set);
-   ORD(image_scale_hint_get);
-   ORD(image_stride_get);
-
-   ORD(image_map_draw);
-   ORD(image_map_surface_new);
-   ORD(image_map_surface_free);
-   ORD(image_map_clean);
-
-   ORD(image_content_hint_set);
-   ORD(image_content_hint_get);
-
-   ORD(image_cache_flush);
-   ORD(image_cache_set);
-   ORD(image_cache_get);
-
-   ORD(gl_surface_create);
-   ORD(gl_surface_destroy);
-   ORD(gl_context_create);
-   ORD(gl_context_destroy);
-   ORD(gl_make_current);
-   ORD(gl_string_query);
-   ORD(gl_proc_address_get);
-   ORD(gl_native_surface_get);
-   ORD(gl_api_get);
-   ORD(gl_direct_override_get);
-   ORD(gl_get_pixels_set);
-   ORD(gl_surface_lock);
-   ORD(gl_surface_read_pixels);
-   ORD(gl_surface_unlock);
-
-   ORD(image_load_error_get);
-
-   /* now advertise out own api */
-   ORD(image_animated_get);
-   ORD(image_animated_frame_count_get);
-   ORD(image_animated_loop_type_get);
-   ORD(image_animated_loop_count_get);
-   ORD(image_animated_frame_duration_get);
-   ORD(image_animated_frame_set);
-
-   ORD(image_max_size_get);
-
-   ORD(pixel_alpha_get);
-
-   ORD(context_flush);
-
-   /* 3D features */
-   ORD(drawable_new);
-   ORD(drawable_free);
-   ORD(drawable_size_get);
-   ORD(image_drawable_set);
-
-   ORD(drawable_scene_render);
-
-   ORD(texture_new);
-   ORD(texture_free);
-   ORD(texture_data_set);
-   ORD(texture_file_set);
-   ORD(texture_color_format_get);
-   ORD(texture_size_get);
-   ORD(texture_wrap_set);
-   ORD(texture_wrap_get);
-   ORD(texture_filter_set);
-   ORD(texture_filter_get);
-   ORD(texture_image_set);
 
    /* now advertise out own api */
    em->functions = (void *)(&func);
@@ -3437,7 +1887,6 @@ static void
 module_close(Evas_Module *em EINA_UNUSED)
 {
     eina_log_domain_unregister(_evas_engine_GL_X11_log_dom);
-    evas_gl_common_module_close();
 }
 
 static Evas_Module_Api evas_modapi =
index 17f43dd..4ea9645 100644 (file)
@@ -4,7 +4,6 @@
 #include "config.h"
 #include "evas_common_private.h"
 #include "evas_private.h"
-#include "evas_gl_common.h"
 #include "Evas.h"
 #include "Evas_Engine_GL_X11.h"
 
@@ -31,7 +30,7 @@
 # include <GL/glx.h>
 #endif
 
-#include "../software_generic/Evas_Engine_Software_Generic.h"
+#include "../gl_generic/Evas_Engine_GL_Generic.h"
 
 extern int _evas_engine_GL_X11_log_dom ;
 #ifdef ERR
@@ -60,7 +59,6 @@ extern int _evas_engine_GL_X11_log_dom ;
 #define CRI(...) EINA_LOG_DOM_CRIT(_evas_engine_GL_X11_log_dom, __VA_ARGS__)
 
 typedef struct _Outbuf Outbuf;
-typedef struct _Evas_GL_X11_Context Evas_GL_X11_Context;
 
 struct _Outbuf
 {
@@ -105,7 +103,7 @@ struct _Outbuf
    } draw;
 };
 
-struct _Evas_GL_X11_Context
+struct _Context_3D
 {
 #ifdef GL_GLES
    EGLDisplay      display;
@@ -125,6 +123,17 @@ extern int swap_buffer_debug_mode;
 extern int swap_buffer_debug;
 extern const char *debug_dir;
 
+extern Evas_GL_Common_Context_New glsym_evas_gl_common_context_new;
+extern Evas_GL_Common_Context_Call glsym_evas_gl_common_context_flush;
+extern Evas_GL_Common_Context_Call glsym_evas_gl_common_context_free;
+extern Evas_GL_Common_Context_Call glsym_evas_gl_common_context_use;
+extern Evas_GL_Common_Context_Call glsym_evas_gl_common_context_newframe;
+extern Evas_GL_Common_Context_Call glsym_evas_gl_common_context_done;
+extern Evas_GL_Common_Context_Resize_Call glsym_evas_gl_common_context_resize;
+extern Evas_GL_Common_Buffer_Dump_Call glsym_evas_gl_common_buffer_dump;
+extern Evas_GL_Preload_Render_Call glsym_evas_gl_preload_render_lock;
+extern Evas_GL_Preload_Render_Call glsym_evas_gl_preload_render_unlock;
+
 #ifdef GL_GLES
 
 #ifndef EGL_BUFFER_AGE_EXT
@@ -162,9 +171,9 @@ void     *eng_best_visual_get(Evas_Engine_Info_GL_X11 *einfo);
 Colormap  eng_best_colormap_get(Evas_Engine_Info_GL_X11 *einfo);
 int       eng_best_depth_get(Evas_Engine_Info_GL_X11 *einfo);
 
-Evas_GL_X11_Context *eng_gl_context_new(Outbuf *win);
-void      eng_gl_context_free(Evas_GL_X11_Context *context);
-void      eng_gl_context_use(Evas_GL_X11_Context *context);
+Context_3D *eng_gl_context_new(Outbuf *win);
+void      eng_gl_context_free(Context_3D *context);
+void      eng_gl_context_use(Context_3D *context);
 
 void eng_outbuf_reconfigure(Outbuf *ob, int w, int h, int rot, Outbuf_Depth depth);
 int eng_outbuf_get_rot(Outbuf *ob);
@@ -177,6 +186,8 @@ void eng_outbuf_push_free_region_for_update(Outbuf *ob, RGBA_Image *update);
 void eng_outbuf_push_updated_region(Outbuf *ob, RGBA_Image *update,
                                     int x, int y, int w, int h);
 void eng_outbuf_flush(Outbuf *ob, Tilebuf_Rect *rects, Evas_Render_Mode render_mode);
+Evas_Engine_GL_Context *eng_outbuf_gl_context_get(Outbuf *ob);
+void *eng_outbuf_egl_display_get(Outbuf *ob);
 
 Eina_Bool eng_preload_make_current(void *data, void *doit);
 
index 19e826e..4a0cf62 100644 (file)
@@ -404,7 +404,7 @@ eng_window_new(Evas_Engine_Info_GL_X11 *info,
      }
 #endif
 
-   gw->gl_context = evas_gl_common_context_new();
+   gw->gl_context = glsym_evas_gl_common_context_new();
    if (!gw->gl_context)
      {
         eng_window_free(gw);
@@ -415,7 +415,7 @@ eng_window_new(Evas_Engine_Info_GL_X11 *info,
    gw->gl_context->eglctxt = gw->egl_context[0];
 #endif
    eng_window_use(gw);
-   evas_gl_common_context_resize(gw->gl_context, w, h, rot);
+   glsym_evas_gl_common_context_resize(gw->gl_context, w, h, rot);
    gw->surf = 1;
    return gw;
    (void) (indirect = 0);
@@ -431,7 +431,7 @@ eng_window_free(Outbuf *gw)
    if (gw->gl_context)
      {
         ref = gw->gl_context->references - 1;
-        evas_gl_common_context_free(gw->gl_context);
+        glsym_evas_gl_common_context_free(gw->gl_context);
      }
 #ifdef GL_GLES
    eglMakeCurrent(gw->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
@@ -511,7 +511,7 @@ eng_window_use(Outbuf *gw)
 {
    Eina_Bool force_use = EINA_FALSE;
 
-   evas_gl_preload_render_lock(eng_window_make_current, gw);
+   glsym_evas_gl_preload_render_lock(eng_window_make_current, gw);
 #ifdef GL_GLES
    if (_evas_gl_x11_window)
      {
@@ -529,8 +529,8 @@ eng_window_use(Outbuf *gw)
      {
         if (_evas_gl_x11_window)
           {
-             evas_gl_common_context_use(_evas_gl_x11_window->gl_context);
-             evas_gl_common_context_flush(_evas_gl_x11_window->gl_context);
+             glsym_evas_gl_common_context_use(_evas_gl_x11_window->gl_context);
+             glsym_evas_gl_common_context_flush(_evas_gl_x11_window->gl_context);
           }
         _evas_gl_x11_window = gw;
         if (gw)
@@ -567,7 +567,7 @@ eng_window_use(Outbuf *gw)
 #endif
           }
      }
-   if (gw) evas_gl_common_context_use(gw->gl_context);
+   if (gw) glsym_evas_gl_common_context_use(gw->gl_context);
 }
 
 void
@@ -579,7 +579,7 @@ eng_window_unsurf(Outbuf *gw)
       printf("unsurf %p\n", gw);
 #ifdef GL_GLES
    if (_evas_gl_x11_window)
-      evas_gl_common_context_flush(_evas_gl_x11_window->gl_context);
+      glsym_evas_gl_common_context_flush(_evas_gl_x11_window->gl_context);
    if (_evas_gl_x11_window == gw)
      {
         eglMakeCurrent(gw->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
@@ -856,17 +856,17 @@ eng_best_depth_get(Evas_Engine_Info_GL_X11 *einfo)
    return _evas_gl_x11_vi->depth;
 }
 
-Evas_GL_X11_Context *
+Context_3D *
 eng_gl_context_new(Outbuf *win)
 {
-   Evas_GL_X11_Context *ctx;
+   Context_3D *ctx;
 #if GL_GLES
    int context_attrs[3] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE };
 #endif
 
    if (!win) return NULL;
 
-   ctx = calloc(1, sizeof(Evas_GL_X11_Context));
+   ctx = calloc(1, sizeof(Context_3D));
    if (!ctx) return NULL;
 
 #if GL_GLES
@@ -903,7 +903,7 @@ error:
 }
 
 void
-eng_gl_context_free(Evas_GL_X11_Context *ctx)
+eng_gl_context_free(Context_3D *ctx)
 {
 #if GL_GLES
    eglDestroyContext(ctx->display, ctx->context);
@@ -915,7 +915,7 @@ eng_gl_context_free(Evas_GL_X11_Context *ctx)
 }
 
 void
-eng_gl_context_use(Evas_GL_X11_Context *ctx)
+eng_gl_context_use(Context_3D *ctx)
 {
 #if GL_GLES
    if (eglMakeCurrent(ctx->display, ctx->surface,
@@ -953,7 +953,7 @@ eng_outbuf_reconfigure(Outbuf *ob, int w, int h, int rot, Outbuf_Depth depth EIN
    ob->h = h;
    ob->rot = rot;
    eng_window_use(ob);
-   evas_gl_common_context_resize(ob->gl_context, w, h, rot);
+   glsym_evas_gl_common_context_resize(ob->gl_context, w, h, rot);
 }
 
 int
@@ -1011,7 +1011,7 @@ eng_outbuf_region_first_rect(Outbuf *ob)
 {
    ob->gl_context->preserve_bit = GL_COLOR_BUFFER_BIT0_QCOM;
 
-   evas_gl_preload_render_lock(eng_preload_make_current, ob);
+   glsym_evas_gl_preload_render_lock(eng_preload_make_current, ob);
 #ifdef GL_GLES
              // dont need to for egl - eng_window_use() can check for other ctxt's
 #else
@@ -1020,12 +1020,12 @@ eng_outbuf_region_first_rect(Outbuf *ob)
    eng_window_use(ob);
    if (!_re_wincheck(ob)) return EINA_TRUE;
 
-   evas_gl_common_context_resize(ob->gl_context,
+   glsym_evas_gl_common_context_resize(ob->gl_context,
                                  ob->w, ob->h,
                                  ob->rot);
 
-   evas_gl_common_context_flush(ob->gl_context);
-   evas_gl_common_context_newframe(ob->gl_context);
+   glsym_evas_gl_common_context_flush(ob->gl_context);
+   glsym_evas_gl_common_context_newframe(ob->gl_context);
    if (partial_render_debug == 1)
      {
         glClearColor(0.2, 0.5, 1.0, 1.0);
@@ -1064,7 +1064,7 @@ eng_outbuf_push_updated_region(Outbuf *ob, RGBA_Image *update EINA_UNUSED,
       still do that for the full canvas when doing partial update */
    if (!_re_wincheck(ob)) return;
    ob->draw.drew = 1;
-   evas_gl_common_context_flush(ob->gl_context);
+   glsym_evas_gl_common_context_flush(ob->gl_context);
 #ifdef GL_GLES
    // this is needed to make sure all previous rendering is flushed to
    // buffers/surfaces
@@ -1097,7 +1097,7 @@ eng_outbuf_flush(Outbuf *ob, Tilebuf_Rect *rects, Evas_Render_Mode render_mode)
 
    ob->draw.drew = 0;
    eng_window_use(ob);
-   evas_gl_common_context_done(ob->gl_context);
+   glsym_evas_gl_common_context_done(ob->gl_context);
 
    // Save contents of the framebuffer to a file
    if (swap_buffer_debug_mode == 1)
@@ -1108,11 +1108,11 @@ eng_outbuf_flush(Outbuf *ob, Tilebuf_Rect *rects, Evas_Render_Mode render_mode)
              int ret = 0;
              snprintf(fname, sizeof(fname), "%p", (void*)ob);
 
-             ret = evas_gl_common_buffer_dump(ob->gl_context,
-                                              (const char*)debug_dir,
-                                              (const char*)fname,
-                                              ob->frame_cnt,
-                                              NULL);
+             ret = glsym_evas_gl_common_buffer_dump(ob->gl_context,
+                                                    (const char*)debug_dir,
+                                                    (const char*)fname,
+                                                    ob->frame_cnt,
+                                                    NULL);
              if (!ret) swap_buffer_debug_mode = 0;
           }
      }
@@ -1249,5 +1249,22 @@ eng_outbuf_flush(Outbuf *ob, Tilebuf_Rect *rects, Evas_Render_Mode render_mode)
    ob->frame_cnt++;
 
  end:
-   evas_gl_preload_render_unlock(eng_preload_make_current, ob);
+   glsym_evas_gl_preload_render_unlock(eng_preload_make_current, ob);
+}
+
+Evas_Engine_GL_Context *
+eng_outbuf_gl_context_get(Outbuf *ob)
+{
+   return ob->gl_context;
+}
+
+void *
+eng_outbuf_egl_display_get(Outbuf *ob)
+{
+#ifdef GL_GLES
+   return ob->egl_disp;
+#else
+   (void) ob;
+   return NULL;
+#endif
 }