- In libtpl-egl, getenv() is using for debugging purposes only.
- In most situations, it was frequently called getenv()
which is not thread-safe, even though it is unnecessary.
- It is difficult to make getenv() completely disabled,
but replaced it with tpl_getenv() so that it can only be used
in debugging situations.
- tpl_getenv() returns the result of calling getenv()
only if '/opt/usr/tpl_env' file exists, otherwise NULL.
- example
1. $ export TPL_LOG_LEVEL=3
2. $ run gl app
-> libtpl-egl will not get the env TPL_LOG_LEVEL
3. $ touch /opt/usr/tpl_env
4. $ run gl app
-> TPL_LOG_LEVEL=3 will be accepted
Change-Id: I4d40e1beb2f4c34e17b7694f96db5d237cb33bfe
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
int wl_egl_thread = 0;
#endif
- thread = getenv("TPL_WL_EGL_THREAD");
+ thread = tpl_getenv("TPL_WL_EGL_THREAD");
if (thread)
wl_egl_thread = atoi(thread);
- plat_name = getenv("EGL_PLATFORM");
+ plat_name = tpl_getenv("EGL_PLATFORM");
if (plat_name) {
#ifdef TPL_WINSYS_DRI2
char *val;
tpl_obj_hash_check = TPL_FALSE;
- val = getenv("TPL_OBJECT_HASH_CHECK");
+ val = tpl_getenv("TPL_OBJECT_HASH_CHECK");
if ((val) && (!strcmp(val, "1")) && (!tpl_obj_hash)) {
tpl_obj_hash_check = TPL_TRUE;
tpl_obj_hash = __tpl_hashlist_create();
{ \
if (!tpl_log_initialized) \
{ \
- char *env = getenv("TPL_LOG_LEVEL"); \
+ char *env = tpl_getenv("TPL_LOG_LEVEL"); \
if (env == NULL) \
tpl_log_lvl = 0; \
else \
} \
else \
{ \
- char *env = getenv("TPL_DUMP_LEVEL"); \
+ char *env = tpl_getenv("TPL_DUMP_LEVEL"); \
if (env == NULL) \
tpl_dump_lvl = 0; \
else \
(struct wl_display *)display->native_handle;
wayland_egl_display->wl_tbm_client =
wayland_tbm_client_init((struct wl_display *) wl_dpy);
- char *env = getenv("TPL_WAIT_VBLANK");
+ char *env = tpl_getenv("TPL_WAIT_VBLANK");
if (!wayland_egl_display->wl_tbm_client) {
TPL_ERR("Wayland TBM initialization failed!");
_twe_ctx->use_wait_vblank = TPL_TRUE;
- env = getenv("TPL_WAIT_VBLANK");
+ env = tpl_getenv("TPL_WAIT_VBLANK");
if (env && !atoi(env)) {
_twe_ctx->use_wait_vblank = TPL_FALSE;
}
global.bufmgr = tbm_bufmgr_init(global.bufmgr_fd);
/* Initialize swap type configuration. */
- __tpl_x11_swap_str_to_swap_type(getenv(EGL_X11_WINDOW_SWAP_TYPE_ENV_NAME),
+ __tpl_x11_swap_str_to_swap_type(tpl_getenv(EGL_X11_WINDOW_SWAP_TYPE_ENV_NAME),
&global.win_swap_type);
- __tpl_x11_swap_str_to_swap_type(getenv(EGL_X11_FB_SWAP_TYPE_ENV_NAME),
+ __tpl_x11_swap_str_to_swap_type(tpl_getenv(EGL_X11_FB_SWAP_TYPE_ENV_NAME),
&global.fb_swap_type);
}
{
const char *backend_env = NULL;
int count = 0;
- backend_env = getenv("MALI_EGL_DRI3_BUF_NUM");
+ backend_env = tpl_getenv("MALI_EGL_DRI3_BUF_NUM");
/* 2015-05-13 joonbum.ko@samsung.com */
/* Change the value of dri3_max_back 5 to 3 */
if (!backend_env || strlen(backend_env) == 0)