Coregl_fastpath: Change fast path process for GLES 1.1 63/85263/3
authorZhaowei Yuan <zhaowei.yuan@samsung.com>
Tue, 23 Aug 2016 21:04:18 +0000 (05:04 +0800)
committerGwan-gyeong Mun <kk.moon@samsung.com>
Fri, 26 Aug 2016 12:08:17 +0000 (05:08 -0700)
Since contexts with different GLES API version can coexist
in a same thread, the real API version can't be decided by
driver_gl_version, so create a new global vriable to hold
the real GLES API after context switching finished. When
real GLES API version becomes 1.1, then disable fast path for
all GL interfaces.

Modification includes:
1. Create variable current_gl_api_version which will be
updated once context switching finished, if it becomes
1.1, disable fast path for all GL interfaces.
2. Change arguments list of function init_export and
_clean_overrides in order to reset egl and gl respectively
3. in function _clean_overrides(): Override all interfaces
listed in file sym_gl1.h, sym_gl2.h and sym_gl_common.h,
regardless of current GLES API version, because interface
of low version maybe called during a high version context.
Overriding here doesn't cause any problem.

Signed-off-by: Zhaowei Yuan <zhaowei.yuan@samsung.com>
Change-Id: I48adacc063105c53276a9c5003142e670dce0ed3

src/coregl.c
src/coregl_export.c
src/coregl_export.h
src/coregl_internal.h
src/modules/coregl_module.c
src/modules/fastpath/coregl_fastpath_egl.c

index e94d1c9..9f70fc1 100644 (file)
@@ -251,7 +251,7 @@ coregl_initialize()
 
        if (!_gl_lib_init()) return 0;
 
-       init_export();
+       init_export(GL_TRUE, GL_TRUE);
 
        COREGL_LOG(" -> Completed\n");
 
index 4215f15..9525dbd 100644 (file)
@@ -13,7 +13,7 @@ int export_initialized = 0;
 static int api_gl_version;
 
 static void
-_clean_overrides()
+_clean_overrides(GLboolean init_egl, GLboolean init_gl)
 {
 #define _COREGL_START_API(version) api_gl_version = version;
 #define _COREGL_END_API(version) api_gl_version = COREGL_GLAPI_2;
@@ -22,31 +22,30 @@ _clean_overrides()
                COREGL_OVERRIDE_API(ovr_, f, _sym_)
 
 #define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)     OVERRIDE(FUNC_NAME);
-# include "headers/sym_egl.h"
+       if(init_egl == GL_TRUE) {
+               # include "headers/sym_egl.h"
+       }
 #undef _COREGL_SYMBOL
 #undef OVERRIDE
 
 #define OVERRIDE(f) \
        if(api_gl_version<=driver_gl_version) COREGL_OVERRIDE_API(ovr_, f, _sym_)
 #define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)     OVERRIDE(FUNC_NAME);
-if(driver_gl_version == COREGL_GLAPI_1) {
-       #include "headers/sym_gl1.h"
-       #include "headers/sym_gl_common.h"
-}
-else if(driver_gl_version >= COREGL_GLAPI_2) {
-       #include "headers/sym_gl2.h"
-       #include "headers/sym_gl_common.h"
-}
+       if(init_gl == GL_TRUE) {
+               #include "headers/sym_gl1.h"
+               #include "headers/sym_gl2.h"
+               #include "headers/sym_gl_common.h"
+       }
 #undef _COREGL_SYMBOL
-
 #undef OVERRIDE
+
 #undef _COREGL_START_API
 #undef _COREGL_END_API
 }
 
 void
-init_export()
+init_export(GLboolean init_egl, GLboolean init_gl)
 {
-       _clean_overrides();
+       _clean_overrides(init_egl, init_gl);
 }
 
index 537a313..c6e6309 100644 (file)
@@ -9,8 +9,9 @@
 
 extern int export_initialized;
 extern int driver_gl_version;
+extern int current_gl_api_version;
 
-extern void     init_export();
+extern void     init_export(GLboolean init_egl, GLboolean init_gl);
 extern void     clean_overrides();
 
 #endif // COREGL_EXPORT_H
index b1cfc51..a183dd7 100644 (file)
@@ -150,7 +150,7 @@ extern GLThreadState      *get_current_thread_state();
 
 
 // Override functions
-extern void                init_export();
+extern void                init_export(GLboolean init_egl, GLboolean init_gl);
 extern void                deinit_export();
 
 // Module interfaces
index 84081ac..40f8119 100644 (file)
@@ -37,7 +37,7 @@ void
 reset_modules_override()
 {
        // Step 1 : Initialization
-       init_export();
+       init_export(GL_TRUE, GL_TRUE);
 
        // Step 2 : User Define Modules : Sequence is important! (Last module's API is called first)
        fastpath_apply_overrides();
index ed3bcbc..265cc18 100644 (file)
@@ -14,6 +14,7 @@
 
 General_Trace_List *glue_ctx_trace_list = NULL;
 General_Trace_List *context_state_trace_list = NULL;
+int current_gl_api_version = 0;
 
 static void
 _dump_context_info(const char *ment, int force_output)
@@ -1196,6 +1197,10 @@ fastpath_eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read,
                        goto finish;
                }
 
+               current_gl_api_version = ((EGL_packed_option *)gctx->real_ctx_option)->attrib_list.context_major_version;
+               if(current_gl_api_version == COREGL_GLAPI_1)
+                       init_export(GL_FALSE, GL_TRUE);
+
                // Update references only when the contexts are different
                if (tstate->cstate != gctx->cstate)  {
                        if (tstate->cstate != NULL && tstate->cstate->data != NULL)