[Title] Fix to the bug which is the shared evas_gl_context with multi window 02/37002/3 accepted/tizen/tv/20150319.020319 submit/tizen_tv/20150318.024831
authorWonsik Jung <sidein@samsung.com>
Wed, 11 Feb 2015 10:52:27 +0000 (19:52 +0900)
committerSunghyun Kim <vdtizen.sds@samsung.com>
Wed, 18 Mar 2015 02:30:19 +0000 (11:30 +0900)
[Problem]  When multi windows are shown, the latest window does not shown.
[Cause]    The latest window can not call glViewport with the updated coordinate
[Solution] Force call glViewport when window resizing occurs
[Team]     Graphics

Change-Id: I89059b59a9f47464aa0c1aa85768b9a188947d43

src/modules/evas/engines/gl_cocoa/evas_engine.c
src/modules/evas/engines/gl_cocoa/evas_gl_cocoa_main.m
src/modules/evas/engines/gl_common/evas_gl_common.h
src/modules/evas/engines/gl_common/evas_gl_context.c
src/modules/evas/engines/gl_drm/evas_drm_main.c
src/modules/evas/engines/gl_sdl/evas_engine.c
src/modules/evas/engines/gl_x11/evas_x_main.c
src/modules/evas/engines/wayland_egl/evas_wl_main.c

index e5f8d4004fb3ea5faecf08d7aafb61732566b445..4e7bb46a373836ab7723947e069fc8da02a9c286 100644 (file)
@@ -167,9 +167,9 @@ eng_output_resize(void *data, int w, int h)
    re = (Render_Engine *)data;
    re->win->width = w;
    re->win->height = h;
-   
+
    eng_window_resize(re->win, w, h);
-   evas_gl_common_context_resize(re->win->gl_context, w, h, 0);
+   evas_gl_common_context_resize(re->win->gl_context, w, h, 0,1);
 }
 
 static void
index aa6b8950d481f263fbd2585fa9cbd13323350fbb..f869deeef6a43ade4a49fc46358046266f94f87e 100644 (file)
@@ -76,7 +76,7 @@ eng_window_new(void *window,
        return NULL;
      }
    evas_gl_common_context_use(gw->gl_context);
-   evas_gl_common_context_resize(gw->gl_context, w, h, 0);
+   evas_gl_common_context_resize(gw->gl_context, w, h, 0,1);
 
    return gw;
 }
index 5262a9149780a160cdf85ebe9e249ea00d03acbc..7d3c1d3d3ba56af3394b6b5f947846dced363e14 100644 (file)
@@ -649,8 +649,9 @@ EAPI void         evas_gl_common_context_free(Evas_Engine_GL_Context *gc);
 EAPI void         evas_gl_common_context_use(Evas_Engine_GL_Context *gc);
 EAPI void         evas_gl_common_context_newframe(Evas_Engine_GL_Context *gc);
 EAPI void         evas_gl_common_context_done(Evas_Engine_GL_Context *gc);
-
-EAPI void         evas_gl_common_context_resize(Evas_Engine_GL_Context *gc, int w, int h, int rot);
+//Tizen Only : when multi window are shown, latest window does not show. so force call glviewport when window resizing occur
+//EAPI void         evas_gl_common_context_resize(Evas_Engine_GL_Context *gc, int w, int h, int rot);
+EAPI void         evas_gl_common_context_resize(Evas_Engine_GL_Context *gc, int w, int h, int rot, int force_update);
 EAPI int          evas_gl_common_buffer_dump(Evas_Engine_GL_Context *gc, const char* dname, const char* fname, int frame, const char* suffix);
 
 EAPI void         evas_gl_preload_render_lock(evas_gl_make_current_cb make_current, void *engine_data);
@@ -668,7 +669,9 @@ typedef void (*Evas_GL_Common_Context_Call)(Evas_Engine_GL_Context *gc);
 typedef Evas_GL_Image *(*Evas_GL_Common_Image_New_From_Data)(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, DATA32 *data, int alpha, Evas_Colorspace cspace);
 typedef void (*Evas_GL_Preload_Render_Call)(evas_gl_make_current_cb make_current, void *engine_data);
 typedef Evas_Engine_GL_Context *(*Evas_GL_Common_Context_New)(void);
-typedef void (*Evas_GL_Common_Context_Resize_Call)(Evas_Engine_GL_Context *gc, int w, int h, int rot);
+//Tizen Only : when multi window are shown, latest window does not show. so force call glviewport when window resizing occur
+//typedef void (*Evas_GL_Common_Context_Resize_Call)(Evas_Engine_GL_Context *gc, int w, int h, int rot);
+typedef void (*Evas_GL_Common_Context_Resize_Call)(Evas_Engine_GL_Context *gc, int w, int h, int rot,int force_update);
 typedef int (*Evas_GL_Common_Buffer_Dump_Call)(Evas_Engine_GL_Context *gc,const char* dname, const char* fname, int frame, const char* suffix);
 typedef void (*Evas_Gl_Symbols)(void *(*GetProcAddress)(const char *sym));
 
index 87502f4f3fa512df9ef390204a174cd0941a8d99..51eff90b6b92457478944e657f1e7a86b9f4e182 100644 (file)
@@ -378,8 +378,10 @@ _evas_gl_common_version_check()
    return 0;
 }
 
+//Tizen Only : when multi window are shown, latest window does not show. so force call glviewport when window resizing occur
+//static void _evas_gl_common_viewport_set(Evas_Engine_GL_Context *gc)
 static void
-_evas_gl_common_viewport_set(Evas_Engine_GL_Context *gc)
+_evas_gl_common_viewport_set(Evas_Engine_GL_Context *gc, int force_update)
 {
    GLfloat proj[16];
    unsigned int i;
@@ -404,8 +406,8 @@ _evas_gl_common_viewport_set(Evas_Engine_GL_Context *gc)
      }
 
 #ifdef GL_GLES
-   if (gc->shared->eglctxt == gc->eglctxt)
-#endif     
+   if ((gc->shared->eglctxt == gc->eglctxt) && (!force_update ))
+#endif
      {
         if ((!gc->change.size) ||
             (
@@ -910,7 +912,7 @@ evas_gl_common_context_new(void)
      }
    gc->shared = shared;
    gc->shared->references++;
-   _evas_gl_common_viewport_set(gc);
+   _evas_gl_common_viewport_set(gc,1);
 
    gc->def_surface = evas_gl_common_image_surface_new(gc, 1, 1, 1);
 
@@ -998,7 +1000,7 @@ evas_gl_common_context_use(Evas_Engine_GL_Context *gc)
 {
    if (_evas_gl_common_context == gc) return;
    _evas_gl_common_context = gc;
-   if (gc) _evas_gl_common_viewport_set(gc);
+   if (gc) _evas_gl_common_viewport_set(gc,0);
 }
 
 EAPI void
@@ -1116,19 +1118,21 @@ evas_gl_common_context_newframe(Evas_Engine_GL_Context *gc)
    glBindTexture(GL_TEXTURE_2D, gc->pipe[0].shader.cur_tex);
    GLERR(__FUNCTION__, __FILE__, __LINE__, "");
 
-   _evas_gl_common_viewport_set(gc);
+   _evas_gl_common_viewport_set(gc,1);
 }
 
+//Tizen Only : when multi window are shown, latest window does not show. so force call glviewport when window resizing occur
+//EAPI void evas_gl_common_context_resize(Evas_Engine_GL_Context *gc, int w, int h, int rot)
 EAPI void
-evas_gl_common_context_resize(Evas_Engine_GL_Context *gc, int w, int h, int rot)
+evas_gl_common_context_resize(Evas_Engine_GL_Context *gc, int w, int h, int rot, int force_update)
 {
-   if ((gc->w == w) && (gc->h == h) && (gc->rot == rot)) return;
+   if ((!force_update) && (gc->w == w) && (gc->h == h) && (gc->rot == rot)) return;
    evas_gl_common_context_flush(gc);
    gc->change.size = 1;
    gc->rot = rot;
    gc->w = w;
    gc->h = h;
-   if (_evas_gl_common_context == gc) _evas_gl_common_viewport_set(gc);
+   if (_evas_gl_common_context == gc) _evas_gl_common_viewport_set(gc,1);
 }
 
 void
@@ -1222,7 +1226,7 @@ evas_gl_common_context_target_surface_set(Evas_Engine_GL_Context *gc,
         glsym_glBindFramebuffer(GL_FRAMEBUFFER, surface->tex->pt->fb);
         GLERR(__FUNCTION__, __FILE__, __LINE__, "");
      }
-   _evas_gl_common_viewport_set(gc);
+   _evas_gl_common_viewport_set(gc,0);
 }
 
 #define PUSH_VERTEX(n, x, y, z) do { \
@@ -2670,7 +2674,7 @@ evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc,
         gc->px = p[0].px >> FP;
         gc->py = p[0].py >> FP;
         gc->change.size = 1;
-        _evas_gl_common_viewport_set(gc);
+        _evas_gl_common_viewport_set(gc,0);
      }
 
    pn = _evas_gl_common_context_push(RTYPE_MAP,
@@ -2833,7 +2837,7 @@ evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc,
         gc->px = 0;
         gc->py = 0;
         gc->change.size = 1;
-        _evas_gl_common_viewport_set(gc);
+        _evas_gl_common_viewport_set(gc,0);
      }
 }
 
index 67b1648229469d2679ddb53566d24f3b4a5315e4..8e9fea6a8922361179c56802c8fac4f7d738f7d2 100644 (file)
@@ -225,7 +225,7 @@ eng_window_new(Evas_Engine_Info_GL_Drm *info, Evas *e, struct gbm_device *gbm, s
    gw->gl_context->eglctxt = gw->egl_context[0];
 
    eng_window_use(gw);
-   glsym_evas_gl_common_context_resize(gw->gl_context, w, h, rot);
+   glsym_evas_gl_common_context_resize(gw->gl_context, w, h, rot,1);
 
    gw->surf = EINA_TRUE;
 
@@ -435,7 +435,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);
-   glsym_evas_gl_common_context_resize(ob->gl_context, w, h, rot);
+   glsym_evas_gl_common_context_resize(ob->gl_context, w, h, rot,1);
 
    //TODO: need drm gbm surface destroy & re-create.?
 }
@@ -482,7 +482,7 @@ eng_outbuf_region_first_rect(Outbuf *ob)
    eng_window_use(ob);
    if (!_re_wincheck(ob)) return EINA_TRUE;
 
-   glsym_evas_gl_common_context_resize(ob->gl_context, ob->w, ob->h, ob->rot);
+   glsym_evas_gl_common_context_resize(ob->gl_context, ob->w, ob->h, ob->rot,0);
    glsym_evas_gl_common_context_flush(ob->gl_context);
    glsym_evas_gl_common_context_newframe(ob->gl_context);
 
index 0aa9296136b784a90b329628eead5a6b1741fe6c..1fa4e49ad39636735626820ecebe81d08e775823 100644 (file)
@@ -490,7 +490,7 @@ _sdl_output_setup(int w, int h, int fullscreen EINA_UNUSED, int noframe EINA_UNU
    if (!ob->gl_context) goto on_error;
 
    glsym_evas_gl_common_context_use(ob->gl_context);
-   glsym_evas_gl_common_context_resize(ob->gl_context, w, h, ob->gl_context->rot);
+   glsym_evas_gl_common_context_resize(ob->gl_context, w, h, ob->gl_context->rot,1);
 
    /* End GL Initialization */
    return ob;
index 0c96f5514f9742c270f6c4d4f902facea6c40746..0bf452eabb60f176fcb6a62dde9e7dbdb29ca6c9 100644 (file)
@@ -197,7 +197,7 @@ eng_window_new(Evas_Engine_Info_GL_X11 *info,
         eng_window_free(gw);
         return NULL;
      }
-   
+
    context = _tls_context_get();
    gw->egl_context[0] = eglCreateContext
      (gw->egl_disp, gw->egl_config, context, context_attrs);
@@ -207,9 +207,10 @@ eng_window_new(Evas_Engine_Info_GL_X11 *info,
         eng_window_free(gw);
         return NULL;
      }
+
    if (context == EGL_NO_CONTEXT)
      _tls_context_set(gw->egl_context[0]);
-   
+
    if (eglMakeCurrent(gw->egl_disp,
                       gw->egl_surface[0],
                       gw->egl_surface[0],
@@ -440,7 +441,7 @@ eng_window_new(Evas_Engine_Info_GL_X11 *info,
    gw->gl_context->eglctxt = gw->egl_context[0];
 #endif
    eng_window_use(gw);
-   glsym_evas_gl_common_context_resize(gw->gl_context, w, h, rot);
+   glsym_evas_gl_common_context_resize(gw->gl_context, w, h, rot,1);
    gw->surf = 1;
    return gw;
 }
@@ -1077,7 +1078,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);
-   glsym_evas_gl_common_context_resize(ob->gl_context, w, h, rot);
+   glsym_evas_gl_common_context_resize(ob->gl_context, w, h, rot,1);
 }
 
 int
@@ -1135,7 +1136,7 @@ eng_outbuf_region_first_rect(Outbuf *ob)
 
    glsym_evas_gl_common_context_resize(ob->gl_context,
                                  ob->w, ob->h,
-                                 ob->rot);
+                                 ob->rot,0);
 
    glsym_evas_gl_common_context_flush(ob->gl_context);
    glsym_evas_gl_common_context_newframe(ob->gl_context);
@@ -1285,7 +1286,7 @@ eng_outbuf_flush(Outbuf *ob, Tilebuf_Rect *rects, Evas_Render_Mode render_mode)
           }
      }
    else
-      eglSwapBuffers(ob->egl_disp, ob->egl_surface[0]);
+     eglSwapBuffers(ob->egl_disp, ob->egl_surface[0]);
 
 //xx   if (!safe_native) eglWaitGL();
    if (ob->info->callback.post_swap)
index a7dfff888d41341f7e2f4388c3f8f1778335ebfd..f3b570b02067d0743cc8651d9148bde2f782b241 100644 (file)
@@ -177,14 +177,14 @@ eng_window_new(Evas *evas, Evas_Engine_Info_Wayland_Egl *einfo, int w, int h, Re
    gw->gl_context->eglctxt = gw->egl_context[0];
 
    eng_window_use(gw);
-   glsym_evas_gl_common_context_resize(gw->gl_context, w, h, gw->rot);
+   glsym_evas_gl_common_context_resize(gw->gl_context, w, h, gw->rot,1);
 
    gw->surf = EINA_TRUE;
 
    return gw;
 }
 
-void 
+void
 eng_window_free(Outbuf *gw)
 {
    int ref = 0;
@@ -222,7 +222,7 @@ eng_window_free(Outbuf *gw)
    free(gw);
 }
 
-void 
+void
 eng_window_use(Outbuf *gw)
 {
    Eina_Bool force = EINA_FALSE;
@@ -260,7 +260,7 @@ eng_window_use(Outbuf *gw)
    if (gw)
      {
         glsym_evas_gl_common_context_use(gw->gl_context);
-        glsym_evas_gl_common_context_resize(gw->gl_context, gw->w, gw->h, gw->rot);
+        glsym_evas_gl_common_context_resize(gw->gl_context, gw->w, gw->h, gw->rot,0);
      }
 }
 
@@ -319,7 +319,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);
-   glsym_evas_gl_common_context_resize(ob->gl_context, w, h, rot);
+   glsym_evas_gl_common_context_resize(ob->gl_context, w, h, rot,1);
 
    if (ob->win)
      {