const char * _eglQueryString(_EGLDriver *drv, _EGLDisplay *dpy, EGLint name) { (void) drv; switch (name) { case EGL_VENDOR: return _EGL_VENDOR_STRING; case EGL_VERSION: _eglsnprintf(dpy->VersionString, sizeof(dpy->VersionString), "%d.%d (%s)", dpy->VersionMajor, dpy->VersionMinor, dpy->Driver->Name); return dpy->VersionString; case EGL_EXTENSIONS: _eglUpdateExtensionsString(dpy); return dpy->ExtensionsString; case EGL_CLIENT_APIS: _eglUpdateAPIsString(dpy); return dpy->ClientAPIsString; default: _eglError(EGL_BAD_PARAMETER, "eglQueryString"); return NULL; } }
/** * Return a list of colon-separated driver directories. */ static const char * _eglGetSearchPath(void) { static char search_path[1024]; #if defined(_EGL_OS_UNIX) || defined(_EGL_OS_WINDOWS) if (search_path[0] == '\0') { char *buf = search_path; size_t len = sizeof(search_path); EGLBoolean use_env; char dir_sep; int ret; #if defined(_EGL_OS_UNIX) use_env = (geteuid() == getuid() && getegid() == getgid()); dir_sep = '/'; #else use_env = EGL_TRUE; dir_sep = '\\'; #endif if (use_env) { char *p; /* extract the dirname from EGL_DRIVER */ p = getenv("EGL_DRIVER"); if (p && strchr(p, dir_sep)) { ret = _eglsnprintf(buf, len, "%s", p); if (ret > 0 && ret < len) { p = strrchr(buf, dir_sep); *p++ = ':'; len -= p - buf; buf = p; } } /* append EGL_DRIVERS_PATH */ p = getenv("EGL_DRIVERS_PATH"); if (p) { ret = _eglsnprintf(buf, len, "%s:", p); if (ret > 0 && ret < len) { buf += ret; len -= ret; } } } else { _eglLog(_EGL_DEBUG, "ignore EGL_DRIVERS_PATH for setuid/setgid binaries"); } ret = _eglsnprintf(buf, len, "%s", _EGL_DRIVER_SEARCH_DIR); if (ret < 0 || ret >= len) search_path[0] = '\0'; _eglLog(_EGL_DEBUG, "EGL search path is %s", search_path); } #endif /* defined(_EGL_OS_UNIX) || defined(_EGL_OS_WINDOWS) */ return search_path; }