summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2013-03-11 20:40:56 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2013-03-12 08:46:25 +0900
commit200bdfd8d48710334412666f39118c0b3e40ca8c (patch)
treef149a712e75239a826bff75b076c20c5083b20fc
parentbdbf74f882a3c14fe852c8da91ae899eac1472a0 (diff)
in theory suport partial swaps with SEC extensions... untested atm.
-rw-r--r--src/modules/evas/engines/gl_x11/evas_engine.c52
1 files changed, 50 insertions, 2 deletions
diff --git a/src/modules/evas/engines/gl_x11/evas_engine.c b/src/modules/evas/engines/gl_x11/evas_engine.c
index 7904cc05fa..01814d2303 100644
--- a/src/modules/evas/engines/gl_x11/evas_engine.c
+++ b/src/modules/evas/engines/gl_x11/evas_engine.c
@@ -55,6 +55,9 @@ typedef const char *(*glsym_func_const_char_ptr) ();
55#ifndef EGL_NATIVE_PIXMAP_KHR 55#ifndef EGL_NATIVE_PIXMAP_KHR
56# define EGL_NATIVE_PIXMAP_KHR 0x30b0 56# define EGL_NATIVE_PIXMAP_KHR 0x30b0
57#endif 57#endif
58#ifndef EGL_BUFFER_AGE_EXT
59#define EGL_BUFFER_AGE_EXT 0x313d
60#endif
58_eng_fn (*glsym_eglGetProcAddress) (const char *a) = NULL; 61_eng_fn (*glsym_eglGetProcAddress) (const char *a) = NULL;
59void *(*glsym_eglCreateImage) (EGLDisplay a, EGLContext b, EGLenum c, EGLClientBuffer d, const int *e) = NULL; 62void *(*glsym_eglCreateImage) (EGLDisplay a, EGLContext b, EGLenum c, EGLClientBuffer d, const int *e) = NULL;
60void (*glsym_eglDestroyImage) (EGLDisplay a, void *b) = NULL; 63void (*glsym_eglDestroyImage) (EGLDisplay a, void *b) = NULL;
@@ -62,6 +65,7 @@ void (*glsym_glEGLImageTargetTexture2DOES) (int a, void *b) = NULL;
62void *(*glsym_eglMapImageSEC) (void *a, void *b) = NULL; 65void *(*glsym_eglMapImageSEC) (void *a, void *b) = NULL;
63unsigned int (*glsym_eglUnmapImageSEC) (void *a, void *b) = NULL; 66unsigned int (*glsym_eglUnmapImageSEC) (void *a, void *b) = NULL;
64const char *(*glsym_eglQueryString) (EGLDisplay a, int name) = NULL; 67const char *(*glsym_eglQueryString) (EGLDisplay a, int name) = NULL;
68void (*glsym_eglSwapBuffersRegion) (EGLDisplay a, void *b, EGLint c, const EGLint *d) = NULL;
65 69
66#else 70#else
67typedef XID (*glsym_func_xid) (); 71typedef XID (*glsym_func_xid) ();
@@ -547,6 +551,9 @@ gl_symbols(void)
547 FINDSYM(glsym_eglUnmapImageSEC, "eglUnmapImageSEC", glsym_func_uint); 551 FINDSYM(glsym_eglUnmapImageSEC, "eglUnmapImageSEC", glsym_func_uint);
548 552
549 FINDSYM(glsym_eglQueryString, "eglQueryString", glsym_func_const_char_ptr); 553 FINDSYM(glsym_eglQueryString, "eglQueryString", glsym_func_const_char_ptr);
554
555 FINDSYM(glsym_eglSwapBuffersRegion, "eglSwapBuffersRegion", glsym_func_void_ptr);
556 FINDSYM(glsym_eglSwapBuffersRegion, "eglSwapBuffersRegionSEC", glsym_func_void_ptr);
550#else 557#else
551#define FINDSYM(dst, sym, typ) \ 558#define FINDSYM(dst, sym, typ) \
552 if (glsym_glXGetProcAddress) { \ 559 if (glsym_glXGetProcAddress) { \
@@ -1032,6 +1039,22 @@ eng_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, i
1032 re->rects = evas_common_tilebuf_get_render_rects(re->tb); 1039 re->rects = evas_common_tilebuf_get_render_rects(re->tb);
1033 if (re->rects) 1040 if (re->rects)
1034 { 1041 {
1042#ifdef GL_GLES
1043 if (re->info->swap_mode == EVAS_ENGINE_GL_X11_SWAP_MODE_AUTO)
1044 {
1045 EGLint age = 0;
1046
1047 if (eglQuerySurface(re->win->egl_disp, re->win->egl_surface[0],
1048 EGL_BUFFER_AGE_EXT, &age))
1049 {
1050 if (age == 1) re->mode = MODE_COPY;
1051 else if (age == 2) re->mode = MODE_DOUBLE;
1052 else if (age == 3) re->mode = MODE_TRIPLE;
1053 else re->mode = MODE_FULL;
1054 }
1055 else re->mode = MODE_FULL;
1056 }
1057#endif
1035 if (re->lost_back) 1058 if (re->lost_back)
1036 { 1059 {
1037 /* if we lost our backbuffer since the last frame redraw all */ 1060 /* if we lost our backbuffer since the last frame redraw all */
@@ -1197,8 +1220,33 @@ eng_output_flush(void *data, Evas_Render_Mode render_mode)
1197 { 1220 {
1198 re->info->callback.pre_swap(re->info->callback.data, re->evas); 1221 re->info->callback.pre_swap(re->info->callback.data, re->evas);
1199 } 1222 }
1200 // XXX: if partial swaps can be done use re->rects 1223 if (glsym_eglSwapBuffersRegion)
1201 eglSwapBuffers(re->win->egl_disp, re->win->egl_surface[0]); 1224 {
1225 EGLint num = 0, *rects = NULL, i;
1226 Tilebuf_Rect *r;
1227
1228 // if partial swaps can be done use re->rects
1229 EINA_INLIST_FOREACH(EINA_INLIST_GET(re->rects), r) num++;
1230 if (num > 0) rects = malloc(sizeof(EGLint) * 4 * num);
1231 if (rects)
1232 {
1233 i = 0;
1234 EINA_INLIST_FOREACH(EINA_INLIST_GET(re->rects), r)
1235 {
1236 rects[i + 0] = r->x;
1237 rects[i + 1] = r->y;
1238 rects[i + 2] = r->w;
1239 rects[i + 3] = r->h;
1240 i += 4;
1241 }
1242 glsym_eglSwapBuffersRegion(re->win->egl_disp,
1243 re->win->egl_surface[0],
1244 num, rects);
1245 free(rects);
1246 }
1247 }
1248 else
1249 eglSwapBuffers(re->win->egl_disp, re->win->egl_surface[0]);
1202 if (!safe_native) eglWaitGL(); 1250 if (!safe_native) eglWaitGL();
1203 if (re->info->callback.post_swap) 1251 if (re->info->callback.post_swap)
1204 { 1252 {