From: raster Date: Mon, 25 Oct 2010 07:22:43 +0000 (+0000) Subject: only set swap interval if it changes for egl - and dont waitgl if swap X-Git-Tag: accepted/2.0/20130306.225542~242^2~1386 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=91a576fda1557e096408830a8d0cb7b540536024;p=profile%2Fivi%2Fevas.git only set swap interval if it changes for egl - and dont waitgl if swap native is available. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@53849 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/modules/engines/gl_x11/evas_engine.c b/src/modules/engines/gl_x11/evas_engine.c index 7c2b95e..e40bcd6 100644 --- a/src/modules/engines/gl_x11/evas_engine.c +++ b/src/modules/engines/gl_x11/evas_engine.c @@ -27,6 +27,7 @@ struct _Render_Engine } xr; // xres - dpi int w, h; + int vsync; }; static int initted = 0; @@ -418,6 +419,7 @@ eng_setup(Evas *e, void *in) e->engine.func->context_new(e->engine.data.output); eng_window_use(re->win); + re->vsync = 0; if (re->win->alpha) { glClearColor(0.0, 0.0, 0.0, 0.0); @@ -561,11 +563,12 @@ get_time(void) } #endif +static int safe_native = -1; + static void eng_output_redraws_next_update_push(void *data, void *surface __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__) { Render_Engine *re; - static int safe_native = -1; #ifdef FRAMECOUNT static double pt = 0.0; double ta, tb; @@ -634,12 +637,14 @@ eng_output_flush(void *data) #ifdef FRAMECOUNT double t0 = get_time(); #endif - if (re->info->vsync) - eglSwapInterval(re->win->egl_disp, 1); - else - eglSwapInterval(re->win->egl_disp, 0); + if (!re->vsync) + { + if (re->info->vsync) eglSwapInterval(re->win->egl_disp, 1); + else eglSwapInterval(re->win->egl_disp, 0); + re->vsync = 1; + } eglSwapBuffers(re->win->egl_disp, re->win->egl_surface[0]); - eglWaitGL(); + if (!safe_native) eglWaitGL(); #ifdef FRAMECOUNT double t1 = get_time(); printf("%1.5f\n", t1 - t0); @@ -665,16 +670,19 @@ eng_output_flush(void *data) { re->info->callback.pre_swap(re->info->callback.data, re->evas); } +/* if ((1) // (re->win->draw.x1 == 0) && // (re->win->draw.y1 == 0) && // (re->win->draw.x2 == (re->win->w - 1)) && // (re->win->draw.y2 == (re->win->h - 1)) ) + */ { glXSwapBuffers(re->win->disp, re->win->win); - glXWaitGL(); + if (!safe_native) glXWaitGL(); } +/* else { // FIXME: this doesn't work.. why oh why? @@ -699,6 +707,7 @@ eng_output_flush(void *data) glDrawBuffer(GL_BACK); glFlush(); } + */ if (re->info->callback.post_swap) { re->info->callback.post_swap(re->info->callback.data, re->evas);