Revert "evas/gl_x11: Optimize out calls to make current"

This reverts commit 0585540bb3.

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.
This commit is contained in:
Jean-Philippe ANDRE 2015-03-24 05:58:26 +09:00
parent 671bd817bf
commit 5bc4b89115
8 changed files with 15 additions and 57 deletions

View 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))
{

View 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;

View 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)
{

View 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;

View 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))
{

View 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);

View 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;
}

View 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))
{