Revert "evas/gl_x11: Optimize out calls to make current"
authorJean-Philippe ANDRE <jpeg@videolan.org>
Mon, 23 Mar 2015 20:58:26 +0000 (05:58 +0900)
committerJean-Philippe ANDRE <jpeg@videolan.org>
Mon, 23 Mar 2015 21:27:20 +0000 (06:27 +0900)
This reverts commit 0585540bb3558b2ff834a1bb730e897c6301a224.

This broke Evas 3d examples. I also suspected some weird things and
wasn't 100% confident with this patch.

Closes T2215.
Thanks for the report.

src/modules/evas/engines/gl_drm/evas_engine.c
src/modules/evas/engines/gl_generic/Evas_Engine_GL_Generic.h
src/modules/evas/engines/gl_generic/evas_engine.c
src/modules/evas/engines/gl_sdl/evas_engine.c
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
src/modules/evas/engines/wayland_egl/evas_engine.c

index 8736e99..11a20b6 100644 (file)
@@ -641,7 +641,6 @@ eng_setup(Evas *eo_e, void *in)
                                                 eng_outbuf_egl_display_get,
                                                 eng_gl_context_new,
                                                 eng_gl_context_use,
-                                                NULL,//eng_outbuf_context_is_current_set
                                                 &evgl_funcs,
                                                 epd->output.w, epd->output.h))
           {
index f74bef4..e5743ee 100644 (file)
@@ -14,7 +14,6 @@ typedef Evas_Engine_GL_Context *(*Window_GL_Context_Get)(Outbuf *ob);
 typedef void *(*Window_EGL_Display_Get)(Outbuf *ob);
 typedef Context_3D *(*Window_GL_Context_New)(Outbuf *ob);
 typedef void (*Window_GL_Context_Use)(Context_3D *ctx);
-typedef void (*Window_Context_Is_Current_Set)(Outbuf *ob, Eina_Bool context_current);
 
 struct _Render_Engine_GL_Generic
 {
@@ -25,7 +24,6 @@ struct _Render_Engine_GL_Generic
    Window_EGL_Display_Get window_egl_display_get;
    Window_GL_Context_New window_gl_context_new;
    Window_GL_Context_Use window_gl_context_use;
-   Window_Context_Is_Current_Set window_context_is_current_set;
 
    struct {
       Evas_Object_Image_Pixels_Get_Cb  get_pixels;
@@ -58,7 +56,6 @@ evas_render_engine_gl_generic_init(Render_Engine_GL_Generic *re,
                                    Window_EGL_Display_Get window_egl_display_get,
                                    Window_GL_Context_New window_gl_context_new,
                                    Window_GL_Context_Use window_gl_context_use,
-                                   Window_Context_Is_Current_Set window_context_is_current_set,
                                    const EVGL_Interface *evgl_funcs,
                                    int w, int h)
 {
@@ -81,7 +78,6 @@ evas_render_engine_gl_generic_init(Render_Engine_GL_Generic *re,
    re->window_egl_display_get = window_egl_display_get;
    re->window_gl_context_new = window_gl_context_new;
    re->window_gl_context_use = window_gl_context_use;
-   re->window_context_is_current_set = window_context_is_current_set;
 
    re->func.get_pixels = NULL;
    re->func.get_pixels_data = NULL;
index 2d0bff0..627e5c0 100644 (file)
@@ -805,23 +805,6 @@ eng_image_data_preload_cancel(void *data EINA_UNUSED, void *image, const Eo *tar
    evas_gl_preload_target_unregister(gim->tex, (Eo*) target);
 }
 
-static void
-eng_gl_get_pixels_pre(void *data EINA_UNUSED)
-{
-   evgl_get_pixels_pre();
-}
-
-static void
-eng_gl_get_pixels_post(void *data)
-{
-   Render_Engine_GL_Generic *re = data;
-   if (!re) return;
-
-   evgl_get_pixels_post();
-   if (re->window_context_is_current_set)
-     re->window_context_is_current_set(re->software.ob, EINA_FALSE);
-}
-
 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)
 {
@@ -873,9 +856,9 @@ eng_image_draw(void *data, void *context, void *surface, void *image, int src_x,
                              direct_surface);
 
         // Call pixel get function
-        eng_gl_get_pixels_pre(re);
+        evgl_get_pixels_pre();
         re->func.get_pixels(re->func.get_pixels_data, re->func.obj);
-        eng_gl_get_pixels_post(re);
+        evgl_get_pixels_post();
 
         // Call end tile if it's being used
         if ((gl_context->master_clip.enabled) &&
@@ -1397,6 +1380,18 @@ eng_gl_get_pixels_set(void *data, void *get_pixels, void *get_pixels_data, void
    re->func.obj = (Evas_Object*)obj;
 }
 
+static void
+eng_gl_get_pixels_pre(void *data EINA_UNUSED)
+{
+   evgl_get_pixels_pre();
+}
+
+static void
+eng_gl_get_pixels_post(void *data EINA_UNUSED)
+{
+   evgl_get_pixels_post();
+}
+
 static Eina_Bool
 eng_gl_surface_lock(void *data, void *surface)
 {
index c0420af..5691684 100644 (file)
@@ -318,7 +318,6 @@ eng_setup(Evas *eo_e, void *in)
                                            _window_egl_display_get,
                                            _window_gl_context_new,
                                            _window_gl_context_use,
-                                           NULL,//eng_outbuf_context_is_current_set
                                            &evgl_funcs,
                                            e->output.w, e->output.h))
      goto on_error;
index ebdc20c..4d9cd53 100644 (file)
@@ -1645,7 +1645,6 @@ eng_setup(Evas *eo_e, void *in)
                                                 eng_outbuf_egl_display_get,
                                                 eng_gl_context_new,
                                                 eng_gl_context_use,
-                                                eng_outbuf_context_is_current_set,
                                                 &evgl_funcs,
                                                 e->output.w, e->output.h))
           {
index b8945b6..a090393 100644 (file)
@@ -108,9 +108,6 @@ struct _Outbuf
    struct {
       unsigned char drew : 1;
    } draw;
-
-   Eina_Bool        context_switch_optimize : 1;
-   Eina_Bool        context_current : 1;
 };
 
 struct _Context_3D
@@ -199,7 +196,6 @@ void eng_outbuf_push_updated_region(Outbuf *ob, RGBA_Image *update,
 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);
-void eng_outbuf_context_is_current_set(Outbuf *ob, Eina_Bool context_current);
 
 Eina_Bool eng_preload_make_current(void *data, void *doit);
 
index 071f8e4..3e425bf 100644 (file)
@@ -133,8 +133,7 @@ eng_window_new(Evas_Engine_Info_GL_X11 *info,
 #endif
    const GLubyte *vendor, *renderer, *version, *glslversion;
    int blacklist = 0;
-   int val = 0, context_optimize_disable = 0;
-   char* s;
+   int val = 0;
 
    if (!fbconf) eng_best_visual_get(info);
    if (!_evas_gl_x11_vi) return NULL;
@@ -159,15 +158,6 @@ eng_window_new(Evas_Engine_Info_GL_X11 *info,
    gw->depth_bits = depth_bits;
    gw->stencil_bits = stencil_bits;
    gw->msaa_bits = msaa_bits;
-   gw->context_current = EINA_FALSE;
-
-   if ((s = getenv("EVAS_GL_CONTEXT_SWITCH_OPTIMIZE_DISABLE")) != NULL)
-     context_optimize_disable = atoi(s);
-
-   if (context_optimize_disable == 1)
-     gw->context_switch_optimize = EINA_FALSE;
-   else
-     gw->context_switch_optimize = EINA_TRUE;
 
    if (gw->alpha && _evas_gl_x11_rgba_vi)
      gw->visualinfo = _evas_gl_x11_rgba_vi;
@@ -591,10 +581,6 @@ eng_window_use(Outbuf *gw)
 
    xwin = _tls_outbuf_get();
 
-   if (xwin && (xwin == gw))
-     if (gw->context_switch_optimize && gw->context_current)
-       return;
-
    glsym_evas_gl_preload_render_lock(eng_window_make_current, gw);
 #ifdef GL_GLES
    if (xwin)
@@ -649,8 +635,6 @@ eng_window_use(Outbuf *gw)
                   ERR("glXMakeContextCurrent(%p, %p, %p, %p)", (void *)gw->disp, (void *)gw->glxwin, (void *)gw->win, (void *)gw->context);
                }
 #endif
-             if (xwin) xwin->context_current = EINA_FALSE;
-             gw->context_current = EINA_TRUE;
           }
      }
    if (gw) glsym_evas_gl_common_context_use(gw->gl_context);
@@ -1538,12 +1522,3 @@ eng_outbuf_egl_display_get(Outbuf *ob)
    return NULL;
 #endif
 }
-
-void
-eng_outbuf_context_is_current_set(Outbuf *ob, Eina_Bool context_current)
-{
-   if (!ob) return;
-
-   ob->context_current = context_current;
-   return;
-}
index 1e0d229..0b33672 100644 (file)
@@ -618,7 +618,6 @@ eng_setup(Evas *evas, void *info)
                                                 eng_outbuf_egl_display_get, 
                                                 eng_gl_context_new, 
                                                 eng_gl_context_use, 
-                                                NULL, //eng_outbuf_context_is_current_set
                                                 &evgl_funcs, 
                                                 epd->output.w, epd->output.h))
           {