1.add new floder for swapchian layer;2.disable dlcolse;3.enable env

Signed-off-by: andrew0229 <zhangzhao62@huawei.com>
Change-Id: I378fac2b692ad8520d525288c0a8a60ada6e5c0f
This commit is contained in:
andrew0229
2024-04-18 13:00:32 +00:00
parent 7dfc024d0d
commit d1b02da7f2
4 changed files with 24 additions and 7 deletions
+5 -4
View File
@@ -35,9 +35,7 @@ config("vulkan_internal_config") {
ldflags = [ "-Wl,-Bsymbolic" ]
defines += [
"SYSCONFDIR=\"/system/etc\"",
"FALLBACK_CONFIG_DIRS=\"/vendor/etc\"",
"FALLBACK_DATA_DIRS=\"/data\"",
"SYSCONFDIR=\"/system/etc:/system/etc/vulkan/swapchain:/vendor/etc\"",
"VK_USE_PLATFORM_OHOS",
]
}
@@ -95,7 +93,10 @@ ohos_shared_library("vulkan_loader") {
configs = [ ":vulkan_internal_config" ]
public_configs = [ ":vulkan_loader_config" ]
external_deps = [ "hilog:libhilog" ]
external_deps = [
"hilog:libhilog",
"init:libbegetutil",
]
public_external_deps = [ "vulkan-headers:vulkan_headers" ]
innerapi_tags = [ "platformsdk" ]
+12
View File
@@ -30,6 +30,7 @@
#include "allocation.h"
#include "log.h"
#include "param/sys_param.h"
// Environment variables
#if defined(__linux__) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__QNXNTO__) || defined(__FreeBSD__) || defined(__OpenBSD__)
@@ -37,10 +38,21 @@
bool is_high_integrity() { return geteuid() != getuid() || getegid() != getgid(); }
char *loader_getenv(const char *name, const struct loader_instance *inst) {
#ifdef __OHOS__
CachedHandle g_Handle = CachedParameterCreate(name, "");
int changed = 0;
const char *res = CachedParameterGetChanged(g_Handle, &changed);
loader_log(inst, VULKAN_LOADER_DEBUG_BIT | VULKAN_LOADER_INFO_BIT, 0, "loader_getenv name:%s, res:%s", name, res);
if (res == NULL || res[0] == '\0') {
return NULL;
}
return (char *)res;
#else
// No allocation of memory necessary for Linux, but we should at least touch
// the inst pointer to get rid of compiler warnings.
(void)inst;
return getenv(name);
#endif
}
char *loader_secure_getenv(const char *name, const struct loader_instance *inst) {
+2 -2
View File
@@ -2895,7 +2895,7 @@ static VkResult read_data_files_in_search_paths(const struct loader_instance *in
char *xdg_config_home = loader_secure_getenv("XDG_CONFIG_HOME", inst);
char *xdg_config_dirs = loader_secure_getenv("XDG_CONFIG_DIRS", inst);
#if !defined(__Fuchsia__) && !defined(__QNXNTO__)
#if !defined(__Fuchsia__) && !defined(__QNXNTO__) && !defined(__OHOS__)
if (NULL == xdg_config_dirs || '\0' == xdg_config_dirs[0]) {
xdg_config_dirs = FALLBACK_CONFIG_DIRS;
}
@@ -2904,7 +2904,7 @@ static VkResult read_data_files_in_search_paths(const struct loader_instance *in
char *xdg_data_home = loader_secure_getenv("XDG_DATA_HOME", inst);
char *xdg_data_dirs = loader_secure_getenv("XDG_DATA_DIRS", inst);
#if !defined(__Fuchsia__) && !defined(__QNXNTO__)
#if !defined(__Fuchsia__) && !defined(__QNXNTO__) && !defined(__OHOS__)
if (NULL == xdg_data_dirs || '\0' == xdg_data_dirs[0]) {
xdg_data_dirs = FALLBACK_DATA_DIRS;
}
+5 -1
View File
@@ -343,7 +343,11 @@ static inline const char *loader_platform_open_library_error(const char *libPath
return dlerror();
#endif
}
static inline void loader_platform_close_library(loader_platform_dl_handle library) { dlclose(library); }
static inline void loader_platform_close_library(loader_platform_dl_handle library) {
#if !defined (__OHOS__)
dlclose(library);
#endif
}
static inline void *loader_platform_get_proc_address(loader_platform_dl_handle library, const char *name) {
assert(library);
assert(name);