jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=b80d7fa302cf73150235d0f3ff64af624daaa1a8

commit b80d7fa302cf73150235d0f3ff64af624daaa1a8
Author: Jean-Philippe Andre <jp.an...@samsung.com>
Date:   Fri Nov 6 15:28:12 2015 +0900

    Evas GL: Fix linking to 'context_restore_set'
    
    There was a terribly complex mechanism to call this function
    from the gl_x11 engine to gl_common (evas gl core)... and it
    simply didn't work because the function pointer would be NULL.
---
 src/modules/evas/engines/gl_common/evas_gl_common.h |  1 -
 src/modules/evas/engines/gl_common/evas_gl_core.c   |  4 ++--
 src/modules/evas/engines/gl_common/evas_gl_core.h   |  1 +
 src/modules/evas/engines/gl_x11/evas_engine.c       |  2 --
 src/modules/evas/engines/gl_x11/evas_engine.h       |  2 --
 src/modules/evas/engines/gl_x11/evas_x_main.c       | 12 +++++++++++-
 6 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/src/modules/evas/engines/gl_common/evas_gl_common.h 
b/src/modules/evas/engines/gl_common/evas_gl_common.h
index 118bf9f..115ca28 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_common.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_common.h
@@ -872,6 +872,5 @@ _comp_tex_sub_2d(Evas_Engine_GL_Context *gc, int x, int y, 
int w, int h, int fmt
 
 extern Eina_Bool _need_context_restore;
 extern void _context_restore(void);
-EAPI void evas_gl_context_restore_set(Eina_Bool enable);
 
 #endif
diff --git a/src/modules/evas/engines/gl_common/evas_gl_core.c 
b/src/modules/evas/engines/gl_common/evas_gl_core.c
index 6a03ac3..ef012cf 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_core.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_core.c
@@ -2954,8 +2954,8 @@ evgl_direct_partial_render_end()
      }
 }
 
-void
-evas_gl_context_restore_set(Eina_Bool enable)
+EAPI void
+evas_gl_common_context_restore_set(Eina_Bool enable)
 {
    _need_context_restore = enable;
 }
diff --git a/src/modules/evas/engines/gl_common/evas_gl_core.h 
b/src/modules/evas/engines/gl_common/evas_gl_core.h
index 7c321e2..8939cdb 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_core.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_core.h
@@ -47,6 +47,7 @@ EAPI void         evgl_engine_shutdown(void *eng_data);
 EAPI void        *evgl_native_surface_buffer_get(EVGL_Surface *sfc, Eina_Bool 
*is_egl_image);
 EAPI int          evgl_native_surface_yinvert_get(EVGL_Surface *sfc);
 EAPI void        *evgl_current_native_context_get(EVGL_Context *ctx);
+EAPI void         evas_gl_common_context_restore_set(Eina_Bool);
 
 typedef void (*EVGL_Engine_Call)(void *eng_data);
 typedef void *(*EVGL_Native_Surface_Call)(void *sfc, Eina_Bool *is_egl_image);
diff --git a/src/modules/evas/engines/gl_x11/evas_engine.c 
b/src/modules/evas/engines/gl_x11/evas_engine.c
index d0a7de7..9723e1f 100644
--- a/src/modules/evas/engines/gl_x11/evas_engine.c
+++ b/src/modules/evas/engines/gl_x11/evas_engine.c
@@ -75,7 +75,6 @@ glsym_func_void     glsym_evas_gl_common_shaders_flush = NULL;
 glsym_func_void     glsym_evas_gl_common_error_set = NULL;
 glsym_func_int      glsym_evas_gl_common_error_get = NULL;
 glsym_func_void_ptr glsym_evas_gl_common_current_context_get = NULL;
-void (*glsym_evas_gl_context_restore_set) (Eina_Bool enable) = NULL;
 
 #ifdef GL_GLES
 
@@ -1233,7 +1232,6 @@ gl_symbols(void)
    LINK2GENERIC(evas_gl_common_error_get);
    LINK2GENERIC(evas_gl_common_error_set);
    LINK2GENERIC(evas_gl_common_current_context_get);
-   LINK2GENERIC(evas_gl_context_restore_set);
    LINK2GENERIC(evas_gl_common_shaders_flush);
 
 #ifdef GL_GLES
diff --git a/src/modules/evas/engines/gl_x11/evas_engine.h 
b/src/modules/evas/engines/gl_x11/evas_engine.h
index 1c214ce..3ef4054 100644
--- a/src/modules/evas/engines/gl_x11/evas_engine.h
+++ b/src/modules/evas/engines/gl_x11/evas_engine.h
@@ -219,6 +219,4 @@ Eina_Bool __glXMakeContextCurrent(Display *disp, 
GLXDrawable glxwin,
                                   GLXContext context);
 #endif
 
-extern void (*glsym_evas_gl_context_restore_set) (Eina_Bool enable);
-
 #endif
diff --git a/src/modules/evas/engines/gl_x11/evas_x_main.c 
b/src/modules/evas/engines/gl_x11/evas_x_main.c
index d2a0617..d6073aa 100644
--- a/src/modules/evas/engines/gl_x11/evas_x_main.c
+++ b/src/modules/evas/engines/gl_x11/evas_x_main.c
@@ -1,11 +1,15 @@
 #include "evas_engine.h"
 #include "../gl_common/evas_gl_define.h"
+#include <dlfcn.h>
 
-# define SET_RESTORE_CONTEXT() do { if (glsym_evas_gl_context_restore_set) 
glsym_evas_gl_context_restore_set(EINA_TRUE); } while(0)
+# define SET_RESTORE_CONTEXT() do { if 
(glsym_evas_gl_common_context_restore_set) 
glsym_evas_gl_common_context_restore_set(EINA_TRUE); } while(0)
 
 static Eina_TLS _outbuf_key = 0;
 static Eina_TLS _context_key = 0;
 
+typedef void (*glsym_func_void) ();
+glsym_func_void glsym_evas_gl_common_context_restore_set = NULL;
+
 #ifdef GL_GLES
 typedef EGLContext GLContext;
 typedef EGLConfig GLConfig;
@@ -38,6 +42,12 @@ eng_init(void)
    if (initted)
      return EINA_TRUE;
 
+#define LINK2GENERIC(sym) \
+   glsym_##sym = dlsym(RTLD_DEFAULT, #sym); \
+   if (!glsym_##sym) ERR("Could not find function '%s'", #sym);
+
+   LINK2GENERIC(evas_gl_common_context_restore_set);
+
    // FIXME: These resources are never released
    if (!eina_tls_new(&_outbuf_key))
      goto error;

-- 


Reply via email to