coregl_fastpath: Change the module overriding when the API version is changed. 55/86855/3
authorZhaowei Yuan <zhaowei.yuan@samsung.com>
Sun, 4 Sep 2016 19:53:40 +0000 (03:53 +0800)
committerGwan-gyeong Mun <kk.moon@samsung.com>
Mon, 5 Sep 2016 13:54:47 +0000 (06:54 -0700)
Change the setting of module overriding when the GLES
API version is changed, it reduces unecessary operations.

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

src/modules/fastpath/coregl_fastpath_egl.c

index 07a14ff..8694e2d 100644 (file)
@@ -1066,6 +1066,7 @@ fastpath_eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read,
        EGLBoolean ret = EGL_FALSE;
        EGLBoolean need_mc = EGL_FALSE;
        GLGlueContext *gctx = NULL;
+       int api_version;
 
        MY_MODULE_TSTATE *tstate = NULL;
 
@@ -1197,12 +1198,19 @@ 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);
-               else
-                       init_modules();
+               api_version = ((EGL_packed_option *)
+                                          gctx->real_ctx_option)->attrib_list.context_major_version;
+               if (!current_gl_api_version)
+                       current_gl_api_version = api_version;
+               else {
+                       if (current_gl_api_version != api_version) {
+                               if (api_version == COREGL_GLAPI_1)
+                                       init_export(GL_FALSE, GL_TRUE);
+                               else
+                                       init_modules();
+                               current_gl_api_version = api_version;
+                       }
+               }
 
                // Update references only when the contexts are different
                if (tstate->cstate != gctx->cstate)  {