EvasGL: implement Context restoring for wayland_egl 61/52461/2
authorDaeKwang Ryu <dkdk.ryu@samsung.com>
Wed, 28 Oct 2015 11:01:02 +0000 (20:01 +0900)
committerDaeKwang Ryu <dkdk.ryu@samsung.com>
Fri, 4 Dec 2015 06:19:09 +0000 (15:19 +0900)
Change-Id: Ia880bac8d0d8771c74f1d10e34a8750001f0b534

src/modules/evas/engines/wayland_egl/evas_engine.c
src/modules/evas/engines/wayland_egl/evas_engine.h
src/modules/evas/engines/wayland_egl/evas_wl_main.c

index fbc7c88..5906164 100644 (file)
@@ -86,6 +86,7 @@ Evas_GL_Preload_Render_Call glsym_evas_gl_preload_render_relax = 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;
 
 _eng_fn (*glsym_eglGetProcAddress) (const char *a) = NULL;
 void *(*glsym_eglCreateImage) (EGLDisplay a, EGLContext b, EGLenum c, EGLClientBuffer d, const int *e) = NULL;
@@ -158,6 +159,7 @@ 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);
 
 #define FINDSYM(dst, sym, typ) \
    if (glsym_eglGetProcAddress) { \
index ef96ba9..28c62e8 100755 (executable)
@@ -142,4 +142,6 @@ _re_wincheck(Outbuf *ob)
    return 0;
 }
 
+extern void (*glsym_evas_gl_context_restore_set) (Eina_Bool enable);
+
 #endif
index 02bc6a5..5385f4a 100644 (file)
@@ -1,5 +1,7 @@
 #include "evas_engine.h"
 
+# define SET_RESTORE_CONTEXT() do { if (glsym_evas_gl_context_restore_set) glsym_evas_gl_context_restore_set(EINA_TRUE); } while(0)
+
 /* local function prototypes */
 
 /* local variables */
@@ -127,6 +129,7 @@ eng_window_new(Evas *evas, Evas_Engine_Info_Wayland_Egl *einfo, int w, int h, Re
 
    if (context == EGL_NO_CONTEXT) context = gw->egl_context[0];
 
+   SET_RESTORE_CONTEXT();
    if (eglMakeCurrent(gw->egl_disp, gw->egl_surface[0],
                       gw->egl_surface[0], gw->egl_context[0]) == EGL_FALSE)
      {
@@ -200,6 +203,7 @@ eng_window_free(Outbuf *gw)
         glsym_evas_gl_common_context_free(gw->gl_context);
      }
 
+   SET_RESTORE_CONTEXT();
    eglMakeCurrent(gw->egl_disp, EGL_NO_SURFACE, 
                   EGL_NO_SURFACE, EGL_NO_CONTEXT);
 
@@ -249,6 +253,7 @@ eng_window_use(Outbuf *gw)
           {
              if (gw->egl_surface[0] != EGL_NO_SURFACE)
                {
+                  SET_RESTORE_CONTEXT();
                   if (eglMakeCurrent(gw->egl_disp, gw->egl_surface[0],
                                      gw->egl_surface[0],
                                      gw->egl_context[0]) == EGL_FALSE)
@@ -276,6 +281,7 @@ eng_window_unsurf(Outbuf *gw)
 
    if (_evas_gl_wl_window == gw)
      {
+        SET_RESTORE_CONTEXT();
         eglMakeCurrent(gw->egl_disp, EGL_NO_SURFACE, 
                        EGL_NO_SURFACE, EGL_NO_CONTEXT);
         if (gw->egl_surface[0] != EGL_NO_SURFACE)
@@ -305,6 +311,7 @@ eng_window_resurf(Outbuf *gw)
         return;
      }
 
+   SET_RESTORE_CONTEXT();
    if (eglMakeCurrent(gw->egl_disp, gw->egl_surface[0], gw->egl_surface[0],
                       gw->egl_context[0]) == EGL_FALSE)
      ERR("eglMakeCurrent() failed!");
@@ -594,6 +601,7 @@ eng_gl_context_free(Context_3D *ctx)
 void 
 eng_gl_context_use(Context_3D *ctx)
 {
+   SET_RESTORE_CONTEXT();
    if (eglMakeCurrent(ctx->display, ctx->surface, 
                       ctx->surface, ctx->context) == EGL_FALSE)
      {