coregl: Open driver library libGLESv1_CM.so forwardly 77/103677/1 accepted/tizen_3.0.m2_mobile accepted/tizen_3.0.m2_tv accepted/tizen_3.0.m2_wearable tizen_3.0.m2 accepted/tizen/3.0.m2/mobile/20170104.141758 accepted/tizen/3.0.m2/tv/20170104.142135 accepted/tizen/3.0.m2/wearable/20170104.142429 accepted/tizen/3.0/common/20161221.180801 accepted/tizen/3.0/ivi/20161221.005627 accepted/tizen/3.0/mobile/20161221.010049 accepted/tizen/3.0/tv/20161221.005545 accepted/tizen/3.0/wearable/20161221.005609 accepted/tizen/common/20161210.161923 accepted/tizen/ivi/20161212.024057 accepted/tizen/mobile/20161212.024023 accepted/tizen/tv/20161212.024035 accepted/tizen/wearable/20161212.024048 submit/tizen/20161209.083001 submit/tizen_3.0.m2/20170104.093751 submit/tizen_3.0/20161209.083106 submit/tizen_3.0/20161219.222759
authorZhaowei Yuan <zhaowei.yuan@samsung.com>
Thu, 8 Dec 2016 18:09:15 +0000 (02:09 +0800)
committerZhaowei Yuan <zhaowei.yuan@samsung.com>
Thu, 8 Dec 2016 18:11:25 +0000 (02:11 +0800)
In case of GL driver library is separated into more
than 1 file, it's necessary to open low version ones
forwardly while opening a library

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

src/coregl.c

index d420411..93de237 100644 (file)
@@ -111,7 +111,7 @@ _glue_sym_init(void)
 }
 
 static int
-_gl_sym_init(void)
+_gl_sym_init(int init_version)
 {
 
 #define _COREGL_START_API(version)             api_gl_version = version;
@@ -121,9 +121,14 @@ _gl_sym_init(void)
 #define _COREGL_EXT_SYMBOL_ALIAS(FUNC_NAME, ALIAS_NAME) \
        FINDGLSYM(gl_lib_handle, _sym_eglGetProcAddress, _sym_##ALIAS_NAME, #FUNC_NAME);
 
-#include "headers/sym_gl1.h"
-#include "headers/sym_gl2.h"
-#include "headers/sym_gl_common.h"
+       if(init_version == COREGL_GLAPI_1) {
+               #include "headers/sym_gl1.h"
+               #include "headers/sym_gl_common.h"
+       }
+       else if(init_version == COREGL_GLAPI_2){
+               #include "headers/sym_gl2.h"
+               #include "headers/sym_gl_common.h"
+       }
 
 #undef _COREGL_EXT_SYMBOL_ALIAS
 #undef _COREGL_SYMBOL
@@ -182,8 +187,14 @@ _gl_lib_init(void)
                                return 0;
                        }
                        COREGL_DBG("Driver GL version 1.1");
+                       _gl_sym_init(COREGL_GLAPI_1);
                }
        } else if (driver_gl_version == COREGL_GLAPI_2) {
+               // in case of driver library is separated
+               gl_lib_handle = dlopen(_COREGL_VENDOR_GLV1_LIB_PATH, RTLD_LAZY | RTLD_LOCAL);
+               if(gl_lib_handle)
+                       _gl_sym_init(COREGL_GLAPI_1);
+
                gl_lib_handle = dlopen(_COREGL_VENDOR_GLV2_LIB_PATH, RTLD_LAZY | RTLD_LOCAL);
                if (!gl_lib_handle) {
                        COREGL_ERR("%s", dlerror());
@@ -210,11 +221,12 @@ _gl_lib_init(void)
                        } else {
                                COREGL_DBG("Driver GL version 2.0");
                        }
+
+                       _gl_sym_init(COREGL_GLAPI_2);
                }
        }
 
-       if (!_glue_sym_init()) return 0;
-       if (!_gl_sym_init()) return 0;
+       _glue_sym_init();
 
        return 1;
 }