mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 11:40:10 +01:00
mesa: replace most occurrences of getenv() with os_get_option()
The standard way to query options in mesa is `os_get_option()` which
abstracts platform-specific mechanisms to get config variables.
However in quite a few places `getenv()` is still used and this may
preclude controlling some options on some systems.
For instance it is not generally possible to use `MESA_DEBUG` on
Android.
So replace most `getenv()` occurrences with `os_get_option()` to
support configuration options more consistently across different
platforms.
Do the same with `secure_getenv()` replacing it with
`os_get_option_secure()`.
The bulk of the proposed changes are mechanically performed by the
following script:
-----------------------------------------------------------------------
#!/bin/sh
set -e
replace() {
# Don't replace in some files, for example where `os_get_option` is defined,
# or in external files
EXCLUDE_FILES_PATTERN='(src/util/os_misc.c|src/util/u_debug.h|src/gtest/include/gtest/internal/gtest-port.h)'
# Don't replace some "system" variables
EXCLUDE_VARS_PATTERN='("XDG|"DISPLAY|"HOME|"TMPDIR|"POSIXLY_CORRECT)'
git grep "[=!( ]$1(" -- src/ | cut -d ':' -f 1 | sort | uniq | \
grep -v -E "$EXCLUDE_FILES_PATTERN" | \
while read -r file;
do
# Don't replace usages of XDG_* variables or HOME
sed -E -e "/$EXCLUDE_VARS_PATTERN/!s/([=!\( ])$1\(/\1$2\(/g" -i "$file";
done
}
# Add const to os_get_option results, to avoid warning about discarded qualifier:
# warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
# but also errors in some cases:
# error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
add_const_results() {
git grep -l -P '(?<!const )char.*os_get_option' | \
while read -r file;
do
sed -e '/^\s*const/! s/\(char.*os_get_option\)/const \1/g' -i "$file"
done
}
replace 'secure_getenv' 'os_get_option_secure'
replace 'getenv' 'os_get_option'
add_const_results
-----------------------------------------------------------------------
After this, the `#include "util/os_misc.h"` is also added in files where
`os_get_option()` was not used before.
And since the replacements from the script above generated some new
`-Wdiscarded-qualifiers` warnings, those have been addressed as well,
generally by declaring `os_get_option()` results as `const char *` and
adjusting some function declarations.
Finally some replacements caused new errors like:
-----------------------------------------------------------------------
../src/gallium/auxiliary/gallivm/lp_bld_misc.cpp:127:31: error: no matching function for call to 'strtok'
127 | for (n = 0, option = strtok(env_llc_options, " "); option; n++, option = strtok(NULL, " ")) {
| ^~~~~~
/android-ndk-r27c/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/string.h:124:17: note: candidate function not viable: 1st argument ('const char *') would lose const qualifier
124 | char* _Nullable strtok(char* _Nullable __s, const char* _Nonnull __delimiter);
| ^ ~~~~~~~~~~~~~~~~~~~
-----------------------------------------------------------------------
Those have been addressed too, copying the const string returned by
`os_get_option()` so that it could be modified.
In particular, the error above has been fixed by copying the `const
char *env_llc_options` variable in
`src/gallium/auxiliary/gallivm/lp_bld_misc.cpp` to a `char *` which can
be tokenized using `strtok()`.
Reviewed-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38128>
This commit is contained in:
parent
2eee9b79e8
commit
222b85328e
71 changed files with 146 additions and 129 deletions
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include "util/os_drm.h"
|
#include "util/os_drm.h"
|
||||||
#include "ac_linux_drm.h"
|
#include "ac_linux_drm.h"
|
||||||
|
#include "util/os_misc.h"
|
||||||
#include "util/u_math.h"
|
#include "util/u_math.h"
|
||||||
#include "util/u_sync_provider.h"
|
#include "util/u_sync_provider.h"
|
||||||
#include "ac_gpu_info.h"
|
#include "ac_gpu_info.h"
|
||||||
|
|
@ -295,9 +296,9 @@ int ac_drm_cs_ctx_create2(ac_drm_device *dev, uint32_t priority, uint32_t *ctx_i
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
union drm_amdgpu_ctx args;
|
union drm_amdgpu_ctx args;
|
||||||
char *override_priority;
|
const char *override_priority;
|
||||||
|
|
||||||
override_priority = getenv("AMD_PRIORITY");
|
override_priority = os_get_option("AMD_PRIORITY");
|
||||||
if (override_priority) {
|
if (override_priority) {
|
||||||
/* The priority is a signed integer. The variable type is
|
/* The priority is a signed integer. The variable type is
|
||||||
* wrong. If parsing fails, priority is unchanged.
|
* wrong. If parsing fails, priority is unchanged.
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ static once_flag init_once_flag = ONCE_FLAG_INIT;
|
||||||
static void
|
static void
|
||||||
init_once()
|
init_once()
|
||||||
{
|
{
|
||||||
debug_flags = parse_debug_string(getenv("ACO_DEBUG"), aco_debug_options);
|
debug_flags = parse_debug_string(os_get_option("ACO_DEBUG"), aco_debug_options);
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
/* enable some flags by default on debug builds */
|
/* enable some flags by default on debug builds */
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
#include "drm-shim/drm_shim.h"
|
#include "drm-shim/drm_shim.h"
|
||||||
#include "drm-uapi/amdgpu_drm.h"
|
#include "drm-uapi/amdgpu_drm.h"
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
|
#include "util/os_misc.h"
|
||||||
|
|
||||||
static const struct amdgpu_device *amdgpu_dev;
|
static const struct amdgpu_device *amdgpu_dev;
|
||||||
|
|
||||||
|
|
@ -201,7 +202,7 @@ static ioctl_fn_t amdgpu_ioctls[] = {
|
||||||
static void
|
static void
|
||||||
amdgpu_select_device()
|
amdgpu_select_device()
|
||||||
{
|
{
|
||||||
const char *gpu_id = getenv("AMDGPU_GPU_ID");
|
const char *gpu_id = os_get_option("AMDGPU_GPU_ID");
|
||||||
if (gpu_id) {
|
if (gpu_id) {
|
||||||
for (uint32_t i = 0; i < num_amdgpu_devices; i++) {
|
for (uint32_t i = 0; i < num_amdgpu_devices; i++) {
|
||||||
const struct amdgpu_device *dev = &amdgpu_devices[i];
|
const struct amdgpu_device *dev = &amdgpu_devices[i];
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
#include "common/amd_family.h"
|
#include "common/amd_family.h"
|
||||||
#include "drm-shim/drm_shim.h"
|
#include "drm-shim/drm_shim.h"
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
|
#include "util/os_misc.h"
|
||||||
#include <util/u_math.h>
|
#include <util/u_math.h>
|
||||||
#include <radeon_drm.h>
|
#include <radeon_drm.h>
|
||||||
|
|
||||||
|
|
@ -153,7 +154,7 @@ static const struct radeon_pci_id radeon_pci_ids[] = {
|
||||||
static void
|
static void
|
||||||
radeon_get_device_id()
|
radeon_get_device_id()
|
||||||
{
|
{
|
||||||
const char *gpu_id = getenv("RADEON_GPU_ID");
|
const char *gpu_id = os_get_option("RADEON_GPU_ID");
|
||||||
if (!gpu_id)
|
if (!gpu_id)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ radv_spm_trace_enabled(const struct radv_instance *instance)
|
||||||
static bool
|
static bool
|
||||||
radv_trap_handler_enabled()
|
radv_trap_handler_enabled()
|
||||||
{
|
{
|
||||||
return !!getenv("RADV_TRAP_HANDLER");
|
return !!os_get_option("RADV_TRAP_HANDLER");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
@ -405,7 +405,7 @@ radv_parse_vrs_rates(const char *str)
|
||||||
static const char *
|
static const char *
|
||||||
radv_get_force_vrs_config_file(void)
|
radv_get_force_vrs_config_file(void)
|
||||||
{
|
{
|
||||||
return getenv("RADV_FORCE_VRS_CONFIG_FILE");
|
return os_get_option("RADV_FORCE_VRS_CONFIG_FILE");
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum radv_force_vrs
|
static enum radv_force_vrs
|
||||||
|
|
@ -1329,7 +1329,7 @@ radv_CreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCr
|
||||||
device->dispatch_initiator_task = device->dispatch_initiator | S_00B800_DISABLE_DISP_PREMPT_EN(1);
|
device->dispatch_initiator_task = device->dispatch_initiator | S_00B800_DISABLE_DISP_PREMPT_EN(1);
|
||||||
|
|
||||||
if (pdev->info.gfx_level == GFX10_3) {
|
if (pdev->info.gfx_level == GFX10_3) {
|
||||||
if (getenv("RADV_FORCE_VRS_CONFIG_FILE")) {
|
if (os_get_option("RADV_FORCE_VRS_CONFIG_FILE")) {
|
||||||
const char *file = radv_get_force_vrs_config_file();
|
const char *file = radv_get_force_vrs_config_file();
|
||||||
|
|
||||||
device->force_vrs = radv_parse_force_vrs_config_file(file);
|
device->force_vrs = radv_parse_force_vrs_config_file(file);
|
||||||
|
|
@ -1339,8 +1339,8 @@ radv_CreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCr
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "radv: Failed to initialize the notifier for RADV_FORCE_VRS_CONFIG_FILE!\n");
|
fprintf(stderr, "radv: Failed to initialize the notifier for RADV_FORCE_VRS_CONFIG_FILE!\n");
|
||||||
}
|
}
|
||||||
} else if (getenv("RADV_FORCE_VRS")) {
|
} else if (os_get_option("RADV_FORCE_VRS")) {
|
||||||
const char *vrs_rates = getenv("RADV_FORCE_VRS");
|
const char *vrs_rates = os_get_option("RADV_FORCE_VRS");
|
||||||
|
|
||||||
device->force_vrs = radv_parse_vrs_rates(vrs_rates);
|
device->force_vrs = radv_parse_vrs_rates(vrs_rates);
|
||||||
device->force_vrs_enabled = device->force_vrs != RADV_FORCE_VRS_1x1;
|
device->force_vrs_enabled = device->force_vrs != RADV_FORCE_VRS_1x1;
|
||||||
|
|
|
||||||
|
|
@ -389,9 +389,9 @@ radv_CreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationC
|
||||||
|
|
||||||
simple_mtx_init(&instance->shader_dump_mtx, mtx_plain);
|
simple_mtx_init(&instance->shader_dump_mtx, mtx_plain);
|
||||||
|
|
||||||
instance->debug_flags = parse_debug_string(getenv("RADV_DEBUG"), radv_debug_options);
|
instance->debug_flags = parse_debug_string(os_get_option("RADV_DEBUG"), radv_debug_options);
|
||||||
instance->perftest_flags = parse_debug_string(getenv("RADV_PERFTEST"), radv_perftest_options);
|
instance->perftest_flags = parse_debug_string(os_get_option("RADV_PERFTEST"), radv_perftest_options);
|
||||||
instance->trap_excp_flags = parse_debug_string(getenv("RADV_TRAP_HANDLER_EXCP"), radv_trap_excp_options);
|
instance->trap_excp_flags = parse_debug_string(os_get_option("RADV_TRAP_HANDLER_EXCP"), radv_trap_excp_options);
|
||||||
instance->profile_pstate = radv_parse_pstate(debug_get_option("RADV_PROFILE_PSTATE", "peak"));
|
instance->profile_pstate = radv_parse_pstate(debug_get_option("RADV_PROFILE_PSTATE", "peak"));
|
||||||
|
|
||||||
const uint64_t shader_stage_flags = RADV_DEBUG_DUMP_VS | RADV_DEBUG_DUMP_TCS | RADV_DEBUG_DUMP_TES |
|
const uint64_t shader_stage_flags = RADV_DEBUG_DUMP_VS | RADV_DEBUG_DUMP_TCS | RADV_DEBUG_DUMP_TES |
|
||||||
|
|
@ -425,7 +425,7 @@ radv_CreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationC
|
||||||
* device that allows to test the compiler without having an
|
* device that allows to test the compiler without having an
|
||||||
* AMDGPU instance.
|
* AMDGPU instance.
|
||||||
*/
|
*/
|
||||||
if (getenv("RADV_FORCE_FAMILY"))
|
if (os_get_option("RADV_FORCE_FAMILY"))
|
||||||
instance->vk.physical_devices.enumerate = create_null_physical_device;
|
instance->vk.physical_devices.enumerate = create_null_physical_device;
|
||||||
else
|
else
|
||||||
instance->vk.physical_devices.try_create_for_drm = create_drm_physical_device;
|
instance->vk.physical_devices.try_create_for_drm = create_drm_physical_device;
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ static const struct {
|
||||||
static void
|
static void
|
||||||
radv_null_winsys_query_info(struct radeon_winsys *rws, struct radeon_info *gpu_info)
|
radv_null_winsys_query_info(struct radeon_winsys *rws, struct radeon_info *gpu_info)
|
||||||
{
|
{
|
||||||
const char *family = getenv("RADV_FORCE_FAMILY");
|
const char *family = os_get_option("RADV_FORCE_FAMILY");
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
gpu_info->gfx_level = CLASS_UNKNOWN;
|
gpu_info->gfx_level = CLASS_UNKNOWN;
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include "util/os_misc.h"
|
||||||
#include "util/u_dynarray.h"
|
#include "util/u_dynarray.h"
|
||||||
#include "util/u_math.h"
|
#include "util/u_math.h"
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
|
@ -1024,7 +1025,7 @@ agxdecode_dump_file_open(void)
|
||||||
* setenv to change the base at runtime.
|
* setenv to change the base at runtime.
|
||||||
*/
|
*/
|
||||||
const char *dump_file_base =
|
const char *dump_file_base =
|
||||||
getenv("AGXDECODE_DUMP_FILE") ?: "agxdecode.dump";
|
os_get_option("AGXDECODE_DUMP_FILE") ?: "agxdecode.dump";
|
||||||
if (!strcmp(dump_file_base, "stderr"))
|
if (!strcmp(dump_file_base, "stderr"))
|
||||||
agxdecode_dump_stream = stderr;
|
agxdecode_dump_stream = stderr;
|
||||||
else {
|
else {
|
||||||
|
|
|
||||||
|
|
@ -1244,7 +1244,7 @@ hk_create_drm_physical_device(struct vk_instance *_instance,
|
||||||
|
|
||||||
hk_physical_device_init_pipeline_cache(pdev);
|
hk_physical_device_init_pipeline_cache(pdev);
|
||||||
|
|
||||||
const char *hk_sysmem = getenv("HK_SYSMEM");
|
const char *hk_sysmem = os_get_option("HK_SYSMEM");
|
||||||
if (hk_sysmem) {
|
if (hk_sysmem) {
|
||||||
uint64_t sysmem = strtoll(hk_sysmem, NULL, 10);
|
uint64_t sysmem = strtoll(hk_sysmem, NULL, 10);
|
||||||
if (sysmem != LLONG_MIN && sysmem != LLONG_MAX) {
|
if (sysmem != LLONG_MIN && sysmem != LLONG_MAX) {
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "perfcntrs/v3d_perfcntrs.h"
|
#include "perfcntrs/v3d_perfcntrs.h"
|
||||||
|
#include "util/os_misc.h"
|
||||||
#include <xf86drm.h>
|
#include <xf86drm.h>
|
||||||
|
|
||||||
namespace pps
|
namespace pps
|
||||||
|
|
@ -24,7 +25,7 @@ V3DDriver::get_min_sampling_period_ns()
|
||||||
bool
|
bool
|
||||||
V3DDriver::init_perfcnt()
|
V3DDriver::init_perfcnt()
|
||||||
{
|
{
|
||||||
const char *v3d_ds_counter_env = getenv("V3D_DS_COUNTER");
|
const char *v3d_ds_counter_env = os_get_option("V3D_DS_COUNTER");
|
||||||
if (!v3d_ds_counter_env || v3d_ds_counter_env[0] == '\0')
|
if (!v3d_ds_counter_env || v3d_ds_counter_env[0] == '\0')
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -402,7 +402,7 @@ v3dv_bo_cache_init(struct v3dv_device *device)
|
||||||
*/
|
*/
|
||||||
device->bo_cache.size_list_size = 0;
|
device->bo_cache.size_list_size = 0;
|
||||||
|
|
||||||
const char *max_cache_size_str = getenv("V3DV_MAX_BO_CACHE_SIZE");
|
const char *max_cache_size_str = os_get_option("V3DV_MAX_BO_CACHE_SIZE");
|
||||||
if (max_cache_size_str == NULL)
|
if (max_cache_size_str == NULL)
|
||||||
device->bo_cache.max_cache_size = DEFAULT_MAX_BO_CACHE_SIZE;
|
device->bo_cache.max_cache_size = DEFAULT_MAX_BO_CACHE_SIZE;
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -586,7 +586,7 @@ v3dv_CreateInstance(const VkInstanceCreateInfo *pCreateInfo,
|
||||||
instance->pipeline_cache_enabled = true;
|
instance->pipeline_cache_enabled = true;
|
||||||
instance->default_pipeline_cache_enabled = true;
|
instance->default_pipeline_cache_enabled = true;
|
||||||
instance->meta_cache_enabled = true;
|
instance->meta_cache_enabled = true;
|
||||||
const char *pipeline_cache_str = getenv("V3DV_ENABLE_PIPELINE_CACHE");
|
const char *pipeline_cache_str = os_get_option("V3DV_ENABLE_PIPELINE_CACHE");
|
||||||
if (pipeline_cache_str != NULL) {
|
if (pipeline_cache_str != NULL) {
|
||||||
if (strncmp(pipeline_cache_str, "full", 4) == 0) {
|
if (strncmp(pipeline_cache_str, "full", 4) == 0) {
|
||||||
/* nothing to do, just to filter correct values */
|
/* nothing to do, just to filter correct values */
|
||||||
|
|
|
||||||
|
|
@ -4708,7 +4708,7 @@ should_skip_nir(const char *name)
|
||||||
static const char *list = NULL;
|
static const char *list = NULL;
|
||||||
if (!list) {
|
if (!list) {
|
||||||
/* Comma separated list of names to skip. */
|
/* Comma separated list of names to skip. */
|
||||||
list = getenv("NIR_SKIP");
|
list = os_get_option("NIR_SKIP");
|
||||||
if (!list)
|
if (!list)
|
||||||
list = "";
|
list = "";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -257,7 +257,7 @@ vtn_default_log_level(void)
|
||||||
[NIR_SPIRV_DEBUG_LEVEL_INFO] = "info",
|
[NIR_SPIRV_DEBUG_LEVEL_INFO] = "info",
|
||||||
[NIR_SPIRV_DEBUG_LEVEL_ERROR] = "error",
|
[NIR_SPIRV_DEBUG_LEVEL_ERROR] = "error",
|
||||||
};
|
};
|
||||||
const char *str = getenv("MESA_SPIRV_LOG_LEVEL");
|
const char *str = os_get_option("MESA_SPIRV_LOG_LEVEL");
|
||||||
|
|
||||||
if (str == NULL)
|
if (str == NULL)
|
||||||
return level;
|
return level;
|
||||||
|
|
|
||||||
|
|
@ -699,7 +699,7 @@ eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
|
||||||
RETURN_EGL_ERROR(disp, EGL_NOT_INITIALIZED, EGL_FALSE);
|
RETURN_EGL_ERROR(disp, EGL_NOT_INITIALIZED, EGL_FALSE);
|
||||||
else {
|
else {
|
||||||
bool success = false;
|
bool success = false;
|
||||||
if (!disp->Options.Zink && !getenv("GALLIUM_DRIVER")) {
|
if (!disp->Options.Zink && !os_get_option("GALLIUM_DRIVER")) {
|
||||||
disp->Options.Zink = EGL_TRUE;
|
disp->Options.Zink = EGL_TRUE;
|
||||||
success = _eglDriver.Initialize(disp);
|
success = _eglDriver.Initialize(disp);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@
|
||||||
#include "c11/threads.h"
|
#include "c11/threads.h"
|
||||||
#include "util/macros.h"
|
#include "util/macros.h"
|
||||||
#include "util/os_file.h"
|
#include "util/os_file.h"
|
||||||
|
#include "util/os_misc.h"
|
||||||
#include "util/u_atomic.h"
|
#include "util/u_atomic.h"
|
||||||
|
|
||||||
#include "eglcontext.h"
|
#include "eglcontext.h"
|
||||||
|
|
@ -98,10 +99,10 @@ _eglGetNativePlatformFromEnv(void)
|
||||||
static_assert(ARRAY_SIZE(egl_platforms) == _EGL_NUM_PLATFORMS,
|
static_assert(ARRAY_SIZE(egl_platforms) == _EGL_NUM_PLATFORMS,
|
||||||
"Missing platform");
|
"Missing platform");
|
||||||
|
|
||||||
plat_name = getenv("EGL_PLATFORM");
|
plat_name = os_get_option("EGL_PLATFORM");
|
||||||
/* try deprecated env variable */
|
/* try deprecated env variable */
|
||||||
if (!plat_name || !plat_name[0])
|
if (!plat_name || !plat_name[0])
|
||||||
plat_name = getenv("EGL_DISPLAY");
|
plat_name = os_get_option("EGL_DISPLAY");
|
||||||
if (!plat_name || !plat_name[0])
|
if (!plat_name || !plat_name[0])
|
||||||
return _EGL_INVALID_PLATFORM;
|
return _EGL_INVALID_PLATFORM;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
#include "drm-uapi/msm_drm.h"
|
#include "drm-uapi/msm_drm.h"
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
|
#include "util/os_misc.h"
|
||||||
#include "util/u_math.h"
|
#include "util/u_math.h"
|
||||||
|
|
||||||
bool drm_shim_driver_prefers_first_render_node = true;
|
bool drm_shim_driver_prefers_first_render_node = true;
|
||||||
|
|
@ -280,7 +281,7 @@ static const struct msm_device_info device_infos[] = {
|
||||||
static void
|
static void
|
||||||
msm_driver_get_device_info(void)
|
msm_driver_get_device_info(void)
|
||||||
{
|
{
|
||||||
const char *env = getenv("FD_GPU_ID");
|
const char *env = os_get_option("FD_GPU_ID");
|
||||||
|
|
||||||
if (!env) {
|
if (!env) {
|
||||||
device_info = &device_infos[0];
|
device_info = &device_infos[0];
|
||||||
|
|
|
||||||
|
|
@ -838,7 +838,7 @@ static int trytop (struct rnndb *db, char *file, xmlNode *node) {
|
||||||
|
|
||||||
static char * find_file(const char *file_orig)
|
static char * find_file(const char *file_orig)
|
||||||
{
|
{
|
||||||
const char *rnn_path = getenv("RNN_PATH");
|
const char *rnn_path = os_get_option("RNN_PATH");
|
||||||
char *fname;
|
char *fname;
|
||||||
|
|
||||||
if (!rnn_path)
|
if (!rnn_path)
|
||||||
|
|
|
||||||
|
|
@ -252,14 +252,14 @@ lp_profile(LLVMValueRef func, const void *code)
|
||||||
* this except when running inside linux perf, which can be inferred
|
* this except when running inside linux perf, which can be inferred
|
||||||
* by the PERF_BUILDID_DIR environment variable.
|
* by the PERF_BUILDID_DIR environment variable.
|
||||||
*/
|
*/
|
||||||
if (getenv("PERF_BUILDID_DIR")) {
|
if (os_get_option("PERF_BUILDID_DIR")) {
|
||||||
snprintf(filename, sizeof(filename), "/tmp/perf-%llu.map", pid);
|
snprintf(filename, sizeof(filename), "/tmp/perf-%llu.map", pid);
|
||||||
perf_map_file = fopen(filename, "wt");
|
perf_map_file = fopen(filename, "wt");
|
||||||
snprintf(filename, sizeof(filename), "/tmp/perf-%llu.map.asm", pid);
|
snprintf(filename, sizeof(filename), "/tmp/perf-%llu.map.asm", pid);
|
||||||
perf_asm_file.open(filename);
|
perf_asm_file.open(filename);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (const char* output_dir = getenv("JIT_SYMBOL_MAP_DIR")) {
|
if (const char* output_dir = os_get_option("JIT_SYMBOL_MAP_DIR")) {
|
||||||
snprintf(filename, sizeof(filename), "%s/jit-symbols-%llu.map", output_dir, pid);
|
snprintf(filename, sizeof(filename), "%s/jit-symbols-%llu.map", output_dir, pid);
|
||||||
perf_map_file = fopen(filename, "wt");
|
perf_map_file = fopen(filename, "wt");
|
||||||
snprintf(filename, sizeof(filename), "%s/jit-symbols-%llu.map.asm", output_dir, pid);
|
snprintf(filename, sizeof(filename), "%s/jit-symbols-%llu.map.asm", output_dir, pid);
|
||||||
|
|
|
||||||
|
|
@ -559,7 +559,7 @@ crocus_screen_create(int fd, const struct pipe_screen_config *config)
|
||||||
if (screen->devinfo.ver == 8) {
|
if (screen->devinfo.ver == 8) {
|
||||||
/* bind to cherryview or bdw if forced */
|
/* bind to cherryview or bdw if forced */
|
||||||
if (screen->devinfo.platform != INTEL_PLATFORM_CHV &&
|
if (screen->devinfo.platform != INTEL_PLATFORM_CHV &&
|
||||||
!getenv("CROCUS_GEN8"))
|
!os_get_option("CROCUS_GEN8"))
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ choose_dxcore_adapter(IDXCoreAdapterFactory *factory, LUID *adapter_luid)
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
// Pick the user selected adapter if any
|
// Pick the user selected adapter if any
|
||||||
char *adapter_name = getenv("MESA_D3D12_DEFAULT_ADAPTER_NAME");
|
const char *adapter_name = os_get_option("MESA_D3D12_DEFAULT_ADAPTER_NAME");
|
||||||
if (adapter_name) {
|
if (adapter_name) {
|
||||||
for (unsigned i=0; i<list->GetAdapterCount(); i++) {
|
for (unsigned i=0; i<list->GetAdapterCount(); i++) {
|
||||||
if (SUCCEEDED(list->GetAdapter(i, &adapter))) {
|
if (SUCCEEDED(list->GetAdapter(i, &adapter))) {
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ static const char **colour;
|
||||||
|
|
||||||
static void init_colours()
|
static void init_colours()
|
||||||
{
|
{
|
||||||
if (getenv("NV50_PROG_DEBUG_NO_COLORS") != NULL)
|
if (os_get_option("NV50_PROG_DEBUG_NO_COLORS") != NULL)
|
||||||
colour = _nocolour;
|
colour = _nocolour;
|
||||||
else
|
else
|
||||||
colour = _colour;
|
colour = _colour;
|
||||||
|
|
|
||||||
|
|
@ -305,7 +305,7 @@ nouveau_screen_init(struct nouveau_screen *screen, struct nouveau_device *dev)
|
||||||
|
|
||||||
glsl_type_singleton_init_or_ref();
|
glsl_type_singleton_init_or_ref();
|
||||||
|
|
||||||
char *nv_dbg = getenv("NOUVEAU_MESA_DEBUG");
|
const char *nv_dbg = os_get_option("NOUVEAU_MESA_DEBUG");
|
||||||
if (nv_dbg)
|
if (nv_dbg)
|
||||||
nouveau_mesa_debug = atoi(nv_dbg);
|
nouveau_mesa_debug = atoi(nv_dbg);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -296,7 +296,7 @@ void r600_context_gfx_flush(void *context, unsigned flags,
|
||||||
|
|
||||||
if (ctx->is_debug) {
|
if (ctx->is_debug) {
|
||||||
if (!ws->fence_wait(ws, ctx->b.last_gfx_fence, 10000000)) {
|
if (!ws->fence_wait(ws, ctx->b.last_gfx_fence, 10000000)) {
|
||||||
const char *fname = getenv("R600_TRACE");
|
const char *fname = os_get_option("R600_TRACE");
|
||||||
if (!fname)
|
if (!fname)
|
||||||
exit(-1);
|
exit(-1);
|
||||||
FILE *fl = fopen(fname, "w+");
|
FILE *fl = fopen(fname, "w+");
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,7 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen,
|
||||||
rctx->b.b.create_video_buffer = r600_video_buffer_create;
|
rctx->b.b.create_video_buffer = r600_video_buffer_create;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getenv("R600_TRACE"))
|
if (os_get_option("R600_TRACE"))
|
||||||
rctx->is_debug = true;
|
rctx->is_debug = true;
|
||||||
r600_init_common_state_functions(rctx);
|
r600_init_common_state_functions(rctx);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ read_file(const char *filename)
|
||||||
|
|
||||||
static void addenv(const char *name, const char *value)
|
static void addenv(const char *name, const char *value)
|
||||||
{
|
{
|
||||||
const char *orig = getenv(name);
|
const char *orig = os_get_option(name);
|
||||||
if (orig) {
|
if (orig) {
|
||||||
char *newval;
|
char *newval;
|
||||||
(void)!asprintf(&newval, "%s,%s", orig, value);
|
(void)!asprintf(&newval, "%s,%s", orig, value);
|
||||||
|
|
|
||||||
|
|
@ -331,7 +331,7 @@ bool si_init_sqtt(struct si_context *sctx)
|
||||||
debug_get_bool_option("AMD_THREAD_TRACE_INSTRUCTION_TIMING", true);
|
debug_get_bool_option("AMD_THREAD_TRACE_INSTRUCTION_TIMING", true);
|
||||||
sctx->sqtt->start_frame = 10;
|
sctx->sqtt->start_frame = 10;
|
||||||
|
|
||||||
const char *trigger = getenv("AMD_THREAD_TRACE_TRIGGER");
|
const char *trigger = os_get_option("AMD_THREAD_TRACE_TRIGGER");
|
||||||
if (trigger) {
|
if (trigger) {
|
||||||
sctx->sqtt->start_frame = atoi(trigger);
|
sctx->sqtt->start_frame = atoi(trigger);
|
||||||
if (sctx->sqtt->start_frame <= 0) {
|
if (sctx->sqtt->start_frame <= 0) {
|
||||||
|
|
|
||||||
|
|
@ -1849,7 +1849,7 @@ struct pipe_context *virgl_context_create(struct pipe_screen *pscreen,
|
||||||
virgl_encoder_set_sub_ctx(vctx, vctx->hw_sub_ctx_id);
|
virgl_encoder_set_sub_ctx(vctx, vctx->hw_sub_ctx_id);
|
||||||
|
|
||||||
if (rs->caps.caps.v2.capability_bits & VIRGL_CAP_GUEST_MAY_INIT_LOG) {
|
if (rs->caps.caps.v2.capability_bits & VIRGL_CAP_GUEST_MAY_INIT_LOG) {
|
||||||
host_debug_flagstring = getenv("VIRGL_HOST_DEBUG");
|
host_debug_flagstring = os_get_option("VIRGL_HOST_DEBUG");
|
||||||
if (host_debug_flagstring)
|
if (host_debug_flagstring)
|
||||||
virgl_encode_host_debug_flagstring(vctx, host_debug_flagstring);
|
virgl_encode_host_debug_flagstring(vctx, host_debug_flagstring);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3318,7 +3318,7 @@ zink_cl_cts_version(struct pipe_screen *pscreen)
|
||||||
static struct zink_screen *
|
static struct zink_screen *
|
||||||
zink_internal_create_screen(const struct pipe_screen_config *config, int64_t dev_major, int64_t dev_minor, uint64_t adapter_luid)
|
zink_internal_create_screen(const struct pipe_screen_config *config, int64_t dev_major, int64_t dev_minor, uint64_t adapter_luid)
|
||||||
{
|
{
|
||||||
if (getenv("ZINK_USE_LAVAPIPE")) {
|
if (os_get_option("ZINK_USE_LAVAPIPE")) {
|
||||||
mesa_loge("ZINK_USE_LAVAPIPE is obsolete. Use LIBGL_ALWAYS_SOFTWARE\n");
|
mesa_loge("ZINK_USE_LAVAPIPE is obsolete. Use LIBGL_ALWAYS_SOFTWARE\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -220,7 +220,7 @@ dri_create_context(struct dri_screen *screen,
|
||||||
/* if set (not -1), apply the app setting */
|
/* if set (not -1), apply the app setting */
|
||||||
enable_glthread = app_enable_glthread == 1;
|
enable_glthread = app_enable_glthread == 1;
|
||||||
}
|
}
|
||||||
if (getenv("mesa_glthread")) {
|
if (os_get_option("mesa_glthread")) {
|
||||||
/* only apply the env var if set */
|
/* only apply the env var if set */
|
||||||
bool user_enable_glthread = debug_get_bool_option("mesa_glthread", false);
|
bool user_enable_glthread = debug_get_bool_option("mesa_glthread", false);
|
||||||
if (user_enable_glthread != enable_glthread) {
|
if (user_enable_glthread != enable_glthread) {
|
||||||
|
|
|
||||||
|
|
@ -199,7 +199,7 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo,
|
||||||
|
|
||||||
if (dbFlag) {
|
if (dbFlag) {
|
||||||
/* Check if the MESA_BACK_BUFFER env var is set */
|
/* Check if the MESA_BACK_BUFFER env var is set */
|
||||||
char *backbuffer = getenv("MESA_BACK_BUFFER");
|
const char *backbuffer = os_get_option("MESA_BACK_BUFFER");
|
||||||
if (backbuffer) {
|
if (backbuffer) {
|
||||||
if (backbuffer[0]=='p' || backbuffer[0]=='P') {
|
if (backbuffer[0]=='p' || backbuffer[0]=='P') {
|
||||||
ximageFlag = GL_FALSE;
|
ximageFlag = GL_FALSE;
|
||||||
|
|
@ -223,13 +223,13 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo,
|
||||||
|
|
||||||
/* Comparing IDs uses less memory but sometimes fails. */
|
/* Comparing IDs uses less memory but sometimes fails. */
|
||||||
/* XXX revisit this after 3.0 is finished. */
|
/* XXX revisit this after 3.0 is finished. */
|
||||||
if (getenv("MESA_GLX_VISUAL_HACK"))
|
if (os_get_option("MESA_GLX_VISUAL_HACK"))
|
||||||
comparePointers = GL_TRUE;
|
comparePointers = GL_TRUE;
|
||||||
else
|
else
|
||||||
comparePointers = GL_FALSE;
|
comparePointers = GL_FALSE;
|
||||||
|
|
||||||
/* Force the visual to have an alpha channel */
|
/* Force the visual to have an alpha channel */
|
||||||
if (rgbFlag && getenv("MESA_GLX_FORCE_ALPHA"))
|
if (rgbFlag && os_get_option("MESA_GLX_FORCE_ALPHA"))
|
||||||
alphaFlag = GL_TRUE;
|
alphaFlag = GL_TRUE;
|
||||||
|
|
||||||
/* First check if a matching visual is already in the list */
|
/* First check if a matching visual is already in the list */
|
||||||
|
|
@ -288,7 +288,7 @@ static GLint
|
||||||
default_depth_bits(void)
|
default_depth_bits(void)
|
||||||
{
|
{
|
||||||
int zBits;
|
int zBits;
|
||||||
const char *zEnv = getenv("MESA_GLX_DEPTH_BITS");
|
const char *zEnv = os_get_option("MESA_GLX_DEPTH_BITS");
|
||||||
if (zEnv)
|
if (zEnv)
|
||||||
zBits = atoi(zEnv);
|
zBits = atoi(zEnv);
|
||||||
else
|
else
|
||||||
|
|
@ -300,7 +300,7 @@ static GLint
|
||||||
default_alpha_bits(void)
|
default_alpha_bits(void)
|
||||||
{
|
{
|
||||||
int aBits;
|
int aBits;
|
||||||
const char *aEnv = getenv("MESA_GLX_ALPHA_BITS");
|
const char *aEnv = os_get_option("MESA_GLX_ALPHA_BITS");
|
||||||
if (aEnv)
|
if (aEnv)
|
||||||
aBits = atoi(aEnv);
|
aBits = atoi(aEnv);
|
||||||
else
|
else
|
||||||
|
|
@ -449,11 +449,11 @@ get_env_visual(Display *dpy, int scr, const char *varname)
|
||||||
int depth, xclass = -1;
|
int depth, xclass = -1;
|
||||||
XVisualInfo *vis;
|
XVisualInfo *vis;
|
||||||
|
|
||||||
if (!getenv( varname )) {
|
if (!os_get_option( varname )) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy( value, getenv(varname), 100 );
|
strncpy( value, os_get_option(varname), 100 );
|
||||||
value[99] = 0;
|
value[99] = 0;
|
||||||
|
|
||||||
sscanf( value, "%s %d", type, &depth );
|
sscanf( value, "%s %d", type, &depth );
|
||||||
|
|
@ -1181,7 +1181,7 @@ glXMakeContextCurrent( Display *dpy, GLXDrawable draw,
|
||||||
static bool firsttime = 1, no_rast = 0;
|
static bool firsttime = 1, no_rast = 0;
|
||||||
|
|
||||||
if (firsttime) {
|
if (firsttime) {
|
||||||
no_rast = getenv("SP_NO_RAST") != NULL;
|
no_rast = os_get_option("SP_NO_RAST") != NULL;
|
||||||
firsttime = 0;
|
firsttime = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1356,7 +1356,7 @@ glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap )
|
||||||
if (b) {
|
if (b) {
|
||||||
XMesaDestroyBuffer(b);
|
XMesaDestroyBuffer(b);
|
||||||
}
|
}
|
||||||
else if (getenv("MESA_DEBUG")) {
|
else if (os_get_option("MESA_DEBUG")) {
|
||||||
_mesa_warning(NULL, "Mesa: glXDestroyGLXPixmap: invalid pixmap\n");
|
_mesa_warning(NULL, "Mesa: glXDestroyGLXPixmap: invalid pixmap\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1425,7 +1425,7 @@ glXSwapBuffers( Display *dpy, GLXDrawable drawable )
|
||||||
static bool firsttime = 1, no_rast = 0;
|
static bool firsttime = 1, no_rast = 0;
|
||||||
|
|
||||||
if (firsttime) {
|
if (firsttime) {
|
||||||
no_rast = getenv("SP_NO_RAST") != NULL;
|
no_rast = os_get_option("SP_NO_RAST") != NULL;
|
||||||
firsttime = 0;
|
firsttime = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1435,7 +1435,7 @@ glXSwapBuffers( Display *dpy, GLXDrawable drawable )
|
||||||
if (buffer) {
|
if (buffer) {
|
||||||
XMesaSwapBuffers(buffer);
|
XMesaSwapBuffers(buffer);
|
||||||
}
|
}
|
||||||
else if (getenv("MESA_DEBUG")) {
|
else if (os_get_option("MESA_DEBUG")) {
|
||||||
_mesa_warning(NULL, "glXSwapBuffers: invalid drawable 0x%x\n",
|
_mesa_warning(NULL, "glXSwapBuffers: invalid drawable 0x%x\n",
|
||||||
(int) drawable);
|
(int) drawable);
|
||||||
}
|
}
|
||||||
|
|
@ -1453,7 +1453,7 @@ glXCopySubBufferMESA(Display *dpy, GLXDrawable drawable,
|
||||||
if (buffer) {
|
if (buffer) {
|
||||||
XMesaCopySubBuffer(buffer, x, y, width, height);
|
XMesaCopySubBuffer(buffer, x, y, width, height);
|
||||||
}
|
}
|
||||||
else if (getenv("MESA_DEBUG")) {
|
else if (os_get_option("MESA_DEBUG")) {
|
||||||
_mesa_warning(NULL, "Mesa: glXCopySubBufferMESA: invalid drawable\n");
|
_mesa_warning(NULL, "Mesa: glXCopySubBufferMESA: invalid drawable\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -667,7 +667,7 @@ initialize_visual_and_buffer(XMesaVisual v, XMesaBuffer b,
|
||||||
* which can help Brian figure out what's going on when a user
|
* which can help Brian figure out what's going on when a user
|
||||||
* reports bugs.
|
* reports bugs.
|
||||||
*/
|
*/
|
||||||
if (getenv("MESA_INFO")) {
|
if (os_get_option("MESA_INFO")) {
|
||||||
printf("X/Mesa visual = %p\n", (void *) v);
|
printf("X/Mesa visual = %p\n", (void *) v);
|
||||||
printf("X/Mesa depth = %d\n", v->visinfo->depth);
|
printf("X/Mesa depth = %d\n", v->visinfo->depth);
|
||||||
printf("X/Mesa bits per pixel = %d\n", v->BitsPerPixel);
|
printf("X/Mesa bits per pixel = %d\n", v->BitsPerPixel);
|
||||||
|
|
@ -763,7 +763,7 @@ XMesaVisual XMesaCreateVisual( Display *display,
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* For debugging only */
|
/* For debugging only */
|
||||||
if (getenv("MESA_XSYNC")) {
|
if (os_get_option("MESA_XSYNC")) {
|
||||||
/* This makes debugging X easier.
|
/* This makes debugging X easier.
|
||||||
* In your debugger, set a breakpoint on _XError to stop when an
|
* In your debugger, set a breakpoint on _XError to stop when an
|
||||||
* X protocol error is generated.
|
* X protocol error is generated.
|
||||||
|
|
|
||||||
|
|
@ -250,10 +250,10 @@ add_color_format_variants(const struct stw_pf_color_info *color_formats,
|
||||||
* to force all pixel formats to have a particular number of samples.
|
* to force all pixel formats to have a particular number of samples.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
const char *samples = getenv("WGL_FORCE_MSAA");
|
const char *samples = os_get_option("WGL_FORCE_MSAA");
|
||||||
if (!samples) {
|
if (!samples) {
|
||||||
static bool warned = false;
|
static bool warned = false;
|
||||||
samples = getenv("SVGA_FORCE_MSAA");
|
samples = os_get_option("SVGA_FORCE_MSAA");
|
||||||
if (samples && !warned) {
|
if (samples && !warned) {
|
||||||
fprintf(stderr, "*** SVGA_FORCE_MSAA is deprecated; "
|
fprintf(stderr, "*** SVGA_FORCE_MSAA is deprecated; "
|
||||||
"use WGL_FORCE_MSAA instead ***\n");
|
"use WGL_FORCE_MSAA instead ***\n");
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,6 @@ if with_tests
|
||||||
tflite_flatbuffer_h,
|
tflite_flatbuffer_h,
|
||||||
dependencies : [ idep_mesautil, idep_gtest ],
|
dependencies : [ idep_mesautil, idep_gtest ],
|
||||||
link_with : [ tensorflow_lite ],
|
link_with : [ tensorflow_lite ],
|
||||||
include_directories : [ inc_include ],
|
include_directories : [ inc_include, inc_util ],
|
||||||
)
|
)
|
||||||
endif
|
endif
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@
|
||||||
#include "test_executor.h"
|
#include "test_executor.h"
|
||||||
#include "tflite-schema-v2.15.0_generated.h"
|
#include "tflite-schema-v2.15.0_generated.h"
|
||||||
|
|
||||||
|
#include "util/os_misc.h"
|
||||||
|
|
||||||
static float
|
static float
|
||||||
randf(float min, float max)
|
randf(float min, float max)
|
||||||
{
|
{
|
||||||
|
|
@ -50,8 +52,8 @@ static void
|
||||||
read_model(const char *file_name, tflite::ModelT &model)
|
read_model(const char *file_name, tflite::ModelT &model)
|
||||||
{
|
{
|
||||||
std::ostringstream file_path;
|
std::ostringstream file_path;
|
||||||
assert(getenv("TEFLON_TEST_DATA"));
|
assert(os_get_option("TEFLON_TEST_DATA"));
|
||||||
file_path << getenv("TEFLON_TEST_DATA") << "/" << file_name;
|
file_path << os_get_option("TEFLON_TEST_DATA") << "/" << file_name;
|
||||||
|
|
||||||
FILE *f = fopen(file_path.str().c_str(), "rb");
|
FILE *f = fopen(file_path.str().c_str(), "rb");
|
||||||
assert(f);
|
assert(f);
|
||||||
|
|
@ -372,7 +374,7 @@ void (*tflite_plugin_destroy_delegate)(TfLiteDelegate *delegate);
|
||||||
static void
|
static void
|
||||||
load_delegate()
|
load_delegate()
|
||||||
{
|
{
|
||||||
const char *delegate_path = getenv("TEFLON_TEST_DELEGATE");
|
const char *delegate_path = os_get_option("TEFLON_TEST_DELEGATE");
|
||||||
assert(delegate_path);
|
assert(delegate_path);
|
||||||
|
|
||||||
void *delegate_lib = dlopen(delegate_path, RTLD_LAZY | RTLD_LOCAL);
|
void *delegate_lib = dlopen(delegate_path, RTLD_LAZY | RTLD_LOCAL);
|
||||||
|
|
@ -393,7 +395,7 @@ load_delegate()
|
||||||
bool
|
bool
|
||||||
cache_is_enabled(void)
|
cache_is_enabled(void)
|
||||||
{
|
{
|
||||||
return getenv("TEFLON_ENABLE_CACHE");
|
return os_get_option("TEFLON_ENABLE_CACHE");
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@
|
||||||
#include "tensorflow/lite/c/c_api.h"
|
#include "tensorflow/lite/c/c_api.h"
|
||||||
#include "test_executor.h"
|
#include "test_executor.h"
|
||||||
|
|
||||||
|
#include "util/os_misc.h"
|
||||||
|
|
||||||
#define TEST_CONV2D 1
|
#define TEST_CONV2D 1
|
||||||
#define TEST_DEPTHWISE 1
|
#define TEST_DEPTHWISE 1
|
||||||
#define TEST_ADD 1
|
#define TEST_ADD 1
|
||||||
|
|
@ -55,7 +57,7 @@ test_model(void *buf, size_t buf_size, std::string cache_dir, unsigned tolerance
|
||||||
run_model(model, EXECUTOR_CPU, &input, &num_inputs, &cpu_output, &output_sizes, &output_types, &num_outputs, cache_dir);
|
run_model(model, EXECUTOR_CPU, &input, &num_inputs, &cpu_output, &output_sizes, &output_types, &num_outputs, cache_dir);
|
||||||
run_model(model, EXECUTOR_NPU, &input, &num_inputs, &npu_output, &output_sizes, &output_types, &num_outputs, cache_dir);
|
run_model(model, EXECUTOR_NPU, &input, &num_inputs, &npu_output, &output_sizes, &output_types, &num_outputs, cache_dir);
|
||||||
|
|
||||||
char *dump_output = getenv("TEFLON_DUMP_OUTPUT");
|
const char *dump_output = os_get_option("TEFLON_DUMP_OUTPUT");
|
||||||
if (dump_output && atoi(dump_output) == 1) {
|
if (dump_output && atoi(dump_output) == 1) {
|
||||||
for (unsigned i = 0; i < num_outputs; i++) {
|
for (unsigned i = 0; i < num_outputs; i++) {
|
||||||
char name[250];
|
char name[250];
|
||||||
|
|
@ -506,8 +508,8 @@ TEST_P(Models, Op)
|
||||||
std::ostringstream file_path;
|
std::ostringstream file_path;
|
||||||
auto test_name = GetParam();
|
auto test_name = GetParam();
|
||||||
test_name.replace(test_name.find("_"), 1, "/");
|
test_name.replace(test_name.find("_"), 1, "/");
|
||||||
assert(getenv("TEFLON_TEST_DATA"));
|
assert(os_get_option("TEFLON_TEST_DATA"));
|
||||||
file_path << getenv("TEFLON_TEST_DATA") << "/models/" << test_name << ".tflite";
|
file_path << os_get_option("TEFLON_TEST_DATA") << "/models/" << test_name << ".tflite";
|
||||||
|
|
||||||
test_model_file(file_path.str(), TOLERANCE, true);
|
test_model_file(file_path.str(), TOLERANCE, true);
|
||||||
}
|
}
|
||||||
|
|
@ -515,9 +517,9 @@ TEST_P(Models, Op)
|
||||||
std::vector<std::string>
|
std::vector<std::string>
|
||||||
get_model_files(void)
|
get_model_files(void)
|
||||||
{
|
{
|
||||||
assert(getenv("TEFLON_TEST_DATA"));
|
assert(os_get_option("TEFLON_TEST_DATA"));
|
||||||
std::stringstream dir;
|
std::stringstream dir;
|
||||||
dir << getenv("TEFLON_TEST_DATA") << "/models";
|
dir << os_get_option("TEFLON_TEST_DATA") << "/models";
|
||||||
|
|
||||||
std::vector<std::string> paths;
|
std::vector<std::string> paths;
|
||||||
std::filesystem::recursive_directory_iterator b(dir.str());
|
std::filesystem::recursive_directory_iterator b(dir.str());
|
||||||
|
|
|
||||||
|
|
@ -35,13 +35,13 @@ static void
|
||||||
debug_init(void)
|
debug_init(void)
|
||||||
{
|
{
|
||||||
static bool once = false;
|
static bool once = false;
|
||||||
char *debug, *out;
|
const char *debug, *out;
|
||||||
|
|
||||||
if (once)
|
if (once)
|
||||||
return;
|
return;
|
||||||
once = true;
|
once = true;
|
||||||
|
|
||||||
debug = getenv("NOUVEAU_LIBDRM_DEBUG");
|
debug = os_get_option("NOUVEAU_LIBDRM_DEBUG");
|
||||||
if (debug) {
|
if (debug) {
|
||||||
int n = strtol(debug, NULL, 0);
|
int n = strtol(debug, NULL, 0);
|
||||||
if (n >= 0)
|
if (n >= 0)
|
||||||
|
|
@ -49,7 +49,7 @@ debug_init(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
nouveau_out = stderr;
|
nouveau_out = stderr;
|
||||||
out = getenv("NOUVEAU_LIBDRM_OUT");
|
out = os_get_option("NOUVEAU_LIBDRM_OUT");
|
||||||
if (out) {
|
if (out) {
|
||||||
FILE *fout = fopen(out, "w");
|
FILE *fout = fopen(out, "w");
|
||||||
if (fout)
|
if (fout)
|
||||||
|
|
@ -368,7 +368,7 @@ nouveau_device_new(struct nouveau_object *parent, struct nouveau_device **pdev)
|
||||||
struct nouveau_drm *drm = nouveau_drm(parent);
|
struct nouveau_drm *drm = nouveau_drm(parent);
|
||||||
struct nouveau_device *dev;
|
struct nouveau_device *dev;
|
||||||
uint64_t v;
|
uint64_t v;
|
||||||
char *tmp;
|
const char *tmp;
|
||||||
|
|
||||||
struct nouveau_device_priv *nvdev = calloc(1, sizeof(*nvdev));
|
struct nouveau_device_priv *nvdev = calloc(1, sizeof(*nvdev));
|
||||||
if (!nvdev)
|
if (!nvdev)
|
||||||
|
|
@ -455,14 +455,14 @@ nouveau_device_new(struct nouveau_object *parent, struct nouveau_device **pdev)
|
||||||
goto done;
|
goto done;
|
||||||
nvdev->base.gart_size = v;
|
nvdev->base.gart_size = v;
|
||||||
|
|
||||||
tmp = getenv("NOUVEAU_LIBDRM_VRAM_LIMIT_PERCENT");
|
tmp = os_get_option("NOUVEAU_LIBDRM_VRAM_LIMIT_PERCENT");
|
||||||
if (tmp)
|
if (tmp)
|
||||||
nvdev->vram_limit_percent = atoi(tmp);
|
nvdev->vram_limit_percent = atoi(tmp);
|
||||||
else
|
else
|
||||||
nvdev->vram_limit_percent = 80;
|
nvdev->vram_limit_percent = 80;
|
||||||
nvdev->base.vram_limit = (nvdev->base.vram_size * nvdev->vram_limit_percent) / 100;
|
nvdev->base.vram_limit = (nvdev->base.vram_size * nvdev->vram_limit_percent) / 100;
|
||||||
|
|
||||||
tmp = getenv("NOUVEAU_LIBDRM_GART_LIMIT_PERCENT");
|
tmp = os_get_option("NOUVEAU_LIBDRM_GART_LIMIT_PERCENT");
|
||||||
if (tmp)
|
if (tmp)
|
||||||
nvdev->gart_limit_percent = atoi(tmp);
|
nvdev->gart_limit_percent = atoi(tmp);
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,7 @@ vmw_winsys_create( int fd )
|
||||||
vws->base.have_rasterizer_state_v2_cmd =
|
vws->base.have_rasterizer_state_v2_cmd =
|
||||||
vws->ioctl.have_drm_2_20 && vws->base.have_sm5;
|
vws->ioctl.have_drm_2_20 && vws->base.have_sm5;
|
||||||
|
|
||||||
getenv_val = getenv("SVGA_FORCE_KERNEL_UNMAPS");
|
getenv_val = os_get_option("SVGA_FORCE_KERNEL_UNMAPS");
|
||||||
vws->cache_maps = !getenv_val || strcmp(getenv_val, "0") == 0;
|
vws->cache_maps = !getenv_val || strcmp(getenv_val, "0") == 0;
|
||||||
vws->fence_ops = vmw_fence_ops_create(vws);
|
vws->fence_ops = vmw_fence_ops_create(vws);
|
||||||
if (!vws->fence_ops)
|
if (!vws->fence_ops)
|
||||||
|
|
|
||||||
|
|
@ -1025,7 +1025,7 @@ vmw_ioctl_init(struct vmw_winsys_screen *vws)
|
||||||
goto out_no_3d;
|
goto out_no_3d;
|
||||||
}
|
}
|
||||||
vws->ioctl.hwversion = gp_arg.value;
|
vws->ioctl.hwversion = gp_arg.value;
|
||||||
getenv_val = getenv("SVGA_FORCE_HOST_BACKED");
|
getenv_val = os_get_option("SVGA_FORCE_HOST_BACKED");
|
||||||
if (!getenv_val || strcmp(getenv_val, "0") == 0) {
|
if (!getenv_val || strcmp(getenv_val, "0") == 0) {
|
||||||
memset(&gp_arg, 0, sizeof(gp_arg));
|
memset(&gp_arg, 0, sizeof(gp_arg));
|
||||||
gp_arg.param = DRM_VMW_PARAM_HW_CAPS;
|
gp_arg.param = DRM_VMW_PARAM_HW_CAPS;
|
||||||
|
|
@ -1093,7 +1093,7 @@ vmw_ioctl_init(struct vmw_winsys_screen *vws)
|
||||||
|
|
||||||
debug_printf("Have VGPU10 interface and hardware.\n");
|
debug_printf("Have VGPU10 interface and hardware.\n");
|
||||||
vws->base.have_vgpu10 = true;
|
vws->base.have_vgpu10 = true;
|
||||||
vgpu10_val = getenv("SVGA_VGPU10");
|
vgpu10_val = os_get_option("SVGA_VGPU10");
|
||||||
if (vgpu10_val && strcmp(vgpu10_val, "0") == 0) {
|
if (vgpu10_val && strcmp(vgpu10_val, "0") == 0) {
|
||||||
debug_printf("Disabling VGPU10 interface.\n");
|
debug_printf("Disabling VGPU10 interface.\n");
|
||||||
vws->base.have_vgpu10 = false;
|
vws->base.have_vgpu10 = false;
|
||||||
|
|
@ -1157,7 +1157,7 @@ vmw_ioctl_init(struct vmw_winsys_screen *vws)
|
||||||
|
|
||||||
if (vws->ioctl.have_drm_2_16) {
|
if (vws->ioctl.have_drm_2_16) {
|
||||||
vws->base.have_coherent = true;
|
vws->base.have_coherent = true;
|
||||||
getenv_val = getenv("SVGA_FORCE_COHERENT");
|
getenv_val = os_get_option("SVGA_FORCE_COHERENT");
|
||||||
if (getenv_val && strcmp(getenv_val, "0") != 0)
|
if (getenv_val && strcmp(getenv_val, "0") != 0)
|
||||||
vws->force_coherent = true;
|
vws->force_coherent = true;
|
||||||
}
|
}
|
||||||
|
|
@ -1183,7 +1183,7 @@ vmw_ioctl_init(struct vmw_winsys_screen *vws)
|
||||||
|
|
||||||
/* Userspace surfaces are only supported on guest-backed hardware */
|
/* Userspace surfaces are only supported on guest-backed hardware */
|
||||||
vws->userspace_surface = false;
|
vws->userspace_surface = false;
|
||||||
getenv_val = getenv("VMW_SVGA_USERSPACE_SURFACE");
|
getenv_val = os_get_option("VMW_SVGA_USERSPACE_SURFACE");
|
||||||
if (getenv_val && atoi(getenv_val)) {
|
if (getenv_val && atoi(getenv_val)) {
|
||||||
assert(vws->base.have_gb_objects);
|
assert(vws->base.have_gb_objects);
|
||||||
assert(vws->base.have_vgpu10);
|
assert(vws->base.have_vgpu10);
|
||||||
|
|
|
||||||
|
|
@ -308,7 +308,7 @@ xlib_sw_display(struct xlib_drawable *xlib_drawable,
|
||||||
struct pipe_box _box = {};
|
struct pipe_box _box = {};
|
||||||
|
|
||||||
if (firsttime) {
|
if (firsttime) {
|
||||||
no_swap = getenv("SP_NO_RAST") != NULL;
|
no_swap = os_get_option("SP_NO_RAST") != NULL;
|
||||||
firsttime = 0;
|
firsttime = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <xf86drm.h>
|
#include <xf86drm.h>
|
||||||
|
#include "util/os_misc.h"
|
||||||
|
|
||||||
#include "loader.h"
|
#include "loader.h"
|
||||||
#include "backend.h"
|
#include "backend.h"
|
||||||
|
|
@ -149,7 +150,7 @@ _gbm_create_device(int fd)
|
||||||
{
|
{
|
||||||
struct gbm_device *dev = NULL;
|
struct gbm_device *dev = NULL;
|
||||||
|
|
||||||
const char *b = getenv("GBM_BACKEND");
|
const char *b = os_get_option("GBM_BACKEND");
|
||||||
if (b) {
|
if (b) {
|
||||||
dev = load_backend_by_name(b, fd, true);
|
dev = load_backend_by_name(b, fd, true);
|
||||||
if (dev) return dev;
|
if (dev) return dev;
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ files_gbm = files(
|
||||||
args_gbm = [
|
args_gbm = [
|
||||||
'-DDEFAULT_BACKENDS_PATH="@0@"'.format(gbm_backends_path),
|
'-DDEFAULT_BACKENDS_PATH="@0@"'.format(gbm_backends_path),
|
||||||
]
|
]
|
||||||
incs_gbm = [include_directories('main'), inc_loader, inc_gallium]
|
incs_gbm = [include_directories('main'), inc_loader, inc_gallium, inc_util]
|
||||||
|
|
||||||
libgbm_name = 'gbm'
|
libgbm_name = 'gbm'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include "Sync.h"
|
#include "Sync.h"
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
|
#include "util/os_misc.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
|
@ -17,7 +18,7 @@ static VirtGpuDevice* sDevice = nullptr;
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
VirtGpuDevice* createPlatformVirtGpuDevice(enum VirtGpuCapset capset, int32_t descriptor) {
|
VirtGpuDevice* createPlatformVirtGpuDevice(enum VirtGpuCapset capset, int32_t descriptor) {
|
||||||
if (getenv("VIRTGPU_KUMQUAT")) {
|
if (os_get_option("VIRTGPU_KUMQUAT")) {
|
||||||
return kumquatCreateVirtGpuDevice(capset, descriptor);
|
return kumquatCreateVirtGpuDevice(capset, descriptor);
|
||||||
} else {
|
} else {
|
||||||
return osCreateVirtGpuDevice(capset, descriptor);
|
return osCreateVirtGpuDevice(capset, descriptor);
|
||||||
|
|
@ -50,7 +51,7 @@ void VirtGpuDevice::resetInstance() {
|
||||||
namespace gfxstream {
|
namespace gfxstream {
|
||||||
|
|
||||||
SyncHelper* createPlatformSyncHelper() {
|
SyncHelper* createPlatformSyncHelper() {
|
||||||
if (getenv("VIRTGPU_KUMQUAT")) {
|
if (os_get_option("VIRTGPU_KUMQUAT")) {
|
||||||
return kumquatCreateSyncHelper();
|
return kumquatCreateSyncHelper();
|
||||||
} else {
|
} else {
|
||||||
return osCreateSyncHelper();
|
return osCreateSyncHelper();
|
||||||
|
|
|
||||||
|
|
@ -205,7 +205,7 @@ GfxStreamVulkanMapper* GfxStreamVulkanMapper::getInstance(std::optional<DeviceId
|
||||||
// testing, VK_ICD_FILENAMES shouldn't be defined. For deqp-vk, this is
|
// testing, VK_ICD_FILENAMES shouldn't be defined. For deqp-vk, this is
|
||||||
// useful, but not safe for multi-threaded tests. For now, since this is only
|
// useful, but not safe for multi-threaded tests. For now, since this is only
|
||||||
// used for end2end tests, we should be good.
|
// used for end2end tests, we should be good.
|
||||||
const char* driver = getenv(VK_ICD_FILENAMES);
|
const char* driver = os_get_option(VK_ICD_FILENAMES);
|
||||||
unsetenv(VK_ICD_FILENAMES);
|
unsetenv(VK_ICD_FILENAMES);
|
||||||
sVkMapper = std::make_unique<GfxStreamVulkanMapper>();
|
sVkMapper = std::make_unique<GfxStreamVulkanMapper>();
|
||||||
if (!sVkMapper->initialize(*deviceIdOpt)) {
|
if (!sVkMapper->initialize(*deviceIdOpt)) {
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ apple_cgl_init(void)
|
||||||
if (initialized)
|
if (initialized)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
opengl_framework_path = getenv("OPENGL_FRAMEWORK_PATH");
|
opengl_framework_path = os_get_option("OPENGL_FRAMEWORK_PATH");
|
||||||
if (!opengl_framework_path) {
|
if (!opengl_framework_path) {
|
||||||
opengl_framework_path = OPENGL_FRAMEWORK_PATH;
|
opengl_framework_path = OPENGL_FRAMEWORK_PATH;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ glx_message(int level, const char *f, ...)
|
||||||
int threshold = _LOADER_WARNING;
|
int threshold = _LOADER_WARNING;
|
||||||
const char *libgl_debug;
|
const char *libgl_debug;
|
||||||
|
|
||||||
libgl_debug = getenv("LIBGL_DEBUG");
|
libgl_debug = os_get_option("LIBGL_DEBUG");
|
||||||
if (libgl_debug) {
|
if (libgl_debug) {
|
||||||
if (strstr(libgl_debug, "quiet"))
|
if (strstr(libgl_debug, "quiet"))
|
||||||
threshold = _LOADER_FATAL;
|
threshold = _LOADER_FATAL;
|
||||||
|
|
@ -986,7 +986,7 @@ __glXInitialize(Display * dpy)
|
||||||
dpyPriv->glXDrawHash = __glxHashCreate();
|
dpyPriv->glXDrawHash = __glxHashCreate();
|
||||||
|
|
||||||
enum glx_driver glx_driver = 0;
|
enum glx_driver glx_driver = 0;
|
||||||
const char *env = getenv("MESA_LOADER_DRIVER_OVERRIDE");
|
const char *env = os_get_option("MESA_LOADER_DRIVER_OVERRIDE");
|
||||||
|
|
||||||
#if defined(GLX_DIRECT_RENDERING) && (!defined(GLX_USE_APPLEGL) || defined(GLX_USE_APPLE))
|
#if defined(GLX_DIRECT_RENDERING) && (!defined(GLX_USE_APPLEGL) || defined(GLX_USE_APPLE))
|
||||||
Bool glx_direct = !debug_get_bool_option("LIBGL_ALWAYS_INDIRECT", false);
|
Bool glx_direct = !debug_get_bool_option("LIBGL_ALWAYS_INDIRECT", false);
|
||||||
|
|
@ -1020,7 +1020,7 @@ __glXInitialize(Display * dpy)
|
||||||
glx_driver |= GLX_DRIVER_ZINK_INFER;
|
glx_driver |= GLX_DRIVER_ZINK_INFER;
|
||||||
#if defined(HAVE_ZINK)
|
#if defined(HAVE_ZINK)
|
||||||
if (!(glx_driver & GLX_DRIVER_DRI3))
|
if (!(glx_driver & GLX_DRIVER_DRI3))
|
||||||
if (kopper && !getenv("GALLIUM_DRIVER"))
|
if (kopper && !os_get_option("GALLIUM_DRIVER"))
|
||||||
glx_driver |= GLX_DRIVER_ZINK_INFER;
|
glx_driver |= GLX_DRIVER_ZINK_INFER;
|
||||||
#endif /* HAVE_ZINK */
|
#endif /* HAVE_ZINK */
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1148,7 +1148,7 @@ static VkResult pvr_physical_device_init(struct pvr_physical_device *pdevice,
|
||||||
goto err_pvr_winsys_destroy;
|
goto err_pvr_winsys_destroy;
|
||||||
|
|
||||||
if (!pvr_device_is_conformant(&pdevice->dev_info)) {
|
if (!pvr_device_is_conformant(&pdevice->dev_info)) {
|
||||||
if (!getenv("PVR_I_WANT_A_BROKEN_VULKAN_DRIVER")) {
|
if (!os_get_option("PVR_I_WANT_A_BROKEN_VULKAN_DRIVER")) {
|
||||||
result = vk_errorf(instance,
|
result = vk_errorf(instance,
|
||||||
VK_ERROR_INCOMPATIBLE_DRIVER,
|
VK_ERROR_INCOMPATIBLE_DRIVER,
|
||||||
"WARNING: powervr is not a conformant Vulkan "
|
"WARNING: powervr is not a conformant Vulkan "
|
||||||
|
|
|
||||||
|
|
@ -446,7 +446,7 @@ static char *drm_get_id_path_tag_for_fd(int fd)
|
||||||
|
|
||||||
bool loader_get_user_preferred_fd(int *fd_render_gpu, int *original_fd)
|
bool loader_get_user_preferred_fd(int *fd_render_gpu, int *original_fd)
|
||||||
{
|
{
|
||||||
const char *dri_prime = getenv("DRI_PRIME");
|
const char *dri_prime = os_get_option("DRI_PRIME");
|
||||||
bool debug = debug_get_bool_option("DRI_PRIME_DEBUG", false);
|
bool debug = debug_get_bool_option("DRI_PRIME_DEBUG", false);
|
||||||
char *default_tag = NULL;
|
char *default_tag = NULL;
|
||||||
drmDevicePtr devices[MAX_DRM_DEVICES];
|
drmDevicePtr devices[MAX_DRM_DEVICES];
|
||||||
|
|
|
||||||
|
|
@ -1415,7 +1415,7 @@ handle_first_current(struct gl_context *ctx)
|
||||||
* first time each context is made current we'll print some useful
|
* first time each context is made current we'll print some useful
|
||||||
* information.
|
* information.
|
||||||
*/
|
*/
|
||||||
if (getenv("MESA_INFO")) {
|
if (os_get_option("MESA_INFO")) {
|
||||||
_mesa_print_info(ctx);
|
_mesa_print_info(ctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -228,8 +228,8 @@ set_debug_flags(const char *str)
|
||||||
void
|
void
|
||||||
_mesa_init_debug( struct gl_context *ctx )
|
_mesa_init_debug( struct gl_context *ctx )
|
||||||
{
|
{
|
||||||
set_debug_flags(getenv("MESA_DEBUG"));
|
set_debug_flags(os_get_option("MESA_DEBUG"));
|
||||||
set_verbose_flags(getenv("MESA_VERBOSE"));
|
set_verbose_flags(os_get_option("MESA_VERBOSE"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ should_output(struct gl_context *ctx, GLenum error, const char *fmtString)
|
||||||
/* Check debug environment variable only once:
|
/* Check debug environment variable only once:
|
||||||
*/
|
*/
|
||||||
if (debug == -1) {
|
if (debug == -1) {
|
||||||
const char *debugEnv = getenv("MESA_DEBUG");
|
const char *debugEnv = os_get_option("MESA_DEBUG");
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if (debugEnv && strstr(debugEnv, "silent"))
|
if (debugEnv && strstr(debugEnv, "silent"))
|
||||||
|
|
|
||||||
|
|
@ -368,7 +368,7 @@ _mesa_make_extension_string(struct gl_context *ctx)
|
||||||
|
|
||||||
/* Check if the MESA_EXTENSION_MAX_YEAR env var is set */
|
/* Check if the MESA_EXTENSION_MAX_YEAR env var is set */
|
||||||
{
|
{
|
||||||
const char *env = getenv("MESA_EXTENSION_MAX_YEAR");
|
const char *env = os_get_option("MESA_EXTENSION_MAX_YEAR");
|
||||||
if (env) {
|
if (env) {
|
||||||
maxYear = atoi(env);
|
maxYear = atoi(env);
|
||||||
_mesa_debug(ctx, "Note: limiting GL extensions to %u or earlier\n",
|
_mesa_debug(ctx, "Note: limiting GL extensions to %u or earlier\n",
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ GLbitfield
|
||||||
_mesa_get_shader_flags(void)
|
_mesa_get_shader_flags(void)
|
||||||
{
|
{
|
||||||
GLbitfield flags = 0x0;
|
GLbitfield flags = 0x0;
|
||||||
const char *env = getenv("MESA_GLSL");
|
const char *env = os_get_option("MESA_GLSL");
|
||||||
|
|
||||||
if (env) {
|
if (env) {
|
||||||
if (strstr(env, "dump_on_error"))
|
if (strstr(env, "dump_on_error"))
|
||||||
|
|
@ -167,7 +167,7 @@ _mesa_get_shader_flags(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Memoized version of getenv("MESA_SHADER_CAPTURE_PATH").
|
* Memoized version of os_get_option_secure("MESA_SHADER_CAPTURE_PATH").
|
||||||
*/
|
*/
|
||||||
const char *
|
const char *
|
||||||
_mesa_get_shader_capture_path(void)
|
_mesa_get_shader_capture_path(void)
|
||||||
|
|
@ -2026,7 +2026,7 @@ GLcharARB *
|
||||||
_mesa_read_shader_source(const mesa_shader_stage stage, const char *source,
|
_mesa_read_shader_source(const mesa_shader_stage stage, const char *source,
|
||||||
const blake3_hash blake3)
|
const blake3_hash blake3)
|
||||||
{
|
{
|
||||||
char *read_path;
|
const char *read_path;
|
||||||
static bool path_exists = true;
|
static bool path_exists = true;
|
||||||
int len, shader_size = 0;
|
int len, shader_size = 0;
|
||||||
GLcharARB *buffer;
|
GLcharARB *buffer;
|
||||||
|
|
@ -2061,7 +2061,7 @@ _mesa_read_shader_source(const mesa_shader_stage stage, const char *source,
|
||||||
if (!path_exists)
|
if (!path_exists)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
read_path = getenv("MESA_SHADER_READ_PATH");
|
read_path = os_get_option("MESA_SHADER_READ_PATH");
|
||||||
if (!read_path) {
|
if (!read_path) {
|
||||||
path_exists = false;
|
path_exists = false;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
||||||
|
|
@ -230,7 +230,7 @@ _mesa_override_glsl_version(struct gl_constants *consts)
|
||||||
const char *version;
|
const char *version;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
version = getenv(env_var);
|
version = os_get_option(env_var);
|
||||||
if (!version) {
|
if (!version) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1801,7 +1801,7 @@ dzn_instance_create(const VkInstanceCreateInfo *pCreateInfo,
|
||||||
instance->vk.physical_devices.enumerate = dzn_enumerate_physical_devices;
|
instance->vk.physical_devices.enumerate = dzn_enumerate_physical_devices;
|
||||||
instance->vk.physical_devices.destroy = dzn_physical_device_destroy;
|
instance->vk.physical_devices.destroy = dzn_physical_device_destroy;
|
||||||
instance->debug_flags =
|
instance->debug_flags =
|
||||||
parse_debug_string(getenv("DZN_DEBUG"), dzn_debug_options);
|
parse_debug_string(os_get_option("DZN_DEBUG"), dzn_debug_options);
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (instance->debug_flags & DZN_DEBUG_DEBUGGER) {
|
if (instance->debug_flags & DZN_DEBUG_DEBUGGER) {
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@
|
||||||
#include "nouveau/nvif/ioctl.h"
|
#include "nouveau/nvif/ioctl.h"
|
||||||
#include "nouveau/nvif/cl0080.h"
|
#include "nouveau/nvif/cl0080.h"
|
||||||
#include "drm-shim/drm_shim.h"
|
#include "drm-shim/drm_shim.h"
|
||||||
|
#include "util/os_misc.h"
|
||||||
#include "util//u_math.h"
|
#include "util//u_math.h"
|
||||||
|
|
||||||
#include "../../gallium/drivers/nouveau/nv_object.xml.h"
|
#include "../../gallium/drivers/nouveau/nv_object.xml.h"
|
||||||
|
|
@ -414,7 +415,7 @@ static ioctl_fn_t driver_ioctls[] = {
|
||||||
static void
|
static void
|
||||||
nouveau_driver_get_device_info(void)
|
nouveau_driver_get_device_info(void)
|
||||||
{
|
{
|
||||||
const char *env = getenv("NOUVEAU_CHIPSET");
|
const char *env = os_get_option("NOUVEAU_CHIPSET");
|
||||||
|
|
||||||
if (!env) {
|
if (!env) {
|
||||||
device_info.chip_id = 0xf0;
|
device_info.chip_id = 0xf0;
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ nvk_init_debug_flags(struct nvk_instance *instance)
|
||||||
{ NULL, 0 },
|
{ NULL, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
instance->debug_flags = parse_debug_string(getenv("NVK_DEBUG"), flags);
|
instance->debug_flags = parse_debug_string(os_get_option("NVK_DEBUG"), flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const driOptionDescription nvk_dri_options[] = {
|
static const driOptionDescription nvk_dri_options[] = {
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ pps_deps += pps_datasources
|
||||||
lib_pps = static_library(
|
lib_pps = static_library(
|
||||||
'pps',
|
'pps',
|
||||||
sources: pps_sources,
|
sources: pps_sources,
|
||||||
include_directories: [include_pps, inc_src, pps_includes],
|
include_directories: [include_pps, inc_src, inc_util, pps_includes],
|
||||||
dependencies: pps_deps,
|
dependencies: pps_deps,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,8 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <xf86drm.h>
|
#include <xf86drm.h>
|
||||||
|
|
||||||
|
#include "util/os_misc.h"
|
||||||
|
|
||||||
namespace pps
|
namespace pps
|
||||||
{
|
{
|
||||||
#define MAX_DRM_DEVICES 64
|
#define MAX_DRM_DEVICES 64
|
||||||
|
|
@ -55,7 +57,7 @@ std::optional<DrmDevice> create_drm_device(int fd, int32_t gpu_num)
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *dri_prime = getenv("DRI_PRIME");
|
const char *dri_prime = os_get_option("DRI_PRIME");
|
||||||
if (dri_prime != NULL) {
|
if (dri_prime != NULL) {
|
||||||
drmDevicePtr drm_device;
|
drmDevicePtr drm_device;
|
||||||
uint16_t vendor_id, device_id;
|
uint16_t vendor_id, device_id;
|
||||||
|
|
|
||||||
|
|
@ -1021,9 +1021,9 @@ disk_cache_enabled()
|
||||||
#endif
|
#endif
|
||||||
char *envvar_name = "MESA_SHADER_CACHE_DISABLE";
|
char *envvar_name = "MESA_SHADER_CACHE_DISABLE";
|
||||||
#if !DETECT_OS_ANDROID
|
#if !DETECT_OS_ANDROID
|
||||||
if (!getenv(envvar_name)) {
|
if (!os_get_option(envvar_name)) {
|
||||||
envvar_name = "MESA_GLSL_CACHE_DISABLE";
|
envvar_name = "MESA_GLSL_CACHE_DISABLE";
|
||||||
if (getenv(envvar_name))
|
if (os_get_option(envvar_name))
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"*** MESA_GLSL_CACHE_DISABLE is deprecated; "
|
"*** MESA_GLSL_CACHE_DISABLE is deprecated; "
|
||||||
"use MESA_SHADER_CACHE_DISABLE instead ***\n");
|
"use MESA_SHADER_CACHE_DISABLE instead ***\n");
|
||||||
|
|
|
||||||
|
|
@ -279,7 +279,7 @@ fail:
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
load_foz_dbs_ro(struct foz_db *foz_db, char *foz_dbs_ro)
|
load_foz_dbs_ro(struct foz_db *foz_db, const char *foz_dbs_ro)
|
||||||
{
|
{
|
||||||
uint8_t file_idx = 1;
|
uint8_t file_idx = 1;
|
||||||
char *filename = NULL;
|
char *filename = NULL;
|
||||||
|
|
@ -454,7 +454,7 @@ foz_dbs_list_updater_thrd(void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
foz_dbs_list_updater_init(struct foz_db *foz_db, char *list_filename)
|
foz_dbs_list_updater_init(struct foz_db *foz_db, const char *list_filename)
|
||||||
{
|
{
|
||||||
struct foz_dbs_list_updater *updater = &foz_db->updater;
|
struct foz_dbs_list_updater *updater = &foz_db->updater;
|
||||||
|
|
||||||
|
|
@ -526,13 +526,13 @@ foz_prepare(struct foz_db *foz_db, char *cache_path)
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *foz_dbs_ro = getenv("MESA_DISK_CACHE_READ_ONLY_FOZ_DBS");
|
const char *foz_dbs_ro = os_get_option("MESA_DISK_CACHE_READ_ONLY_FOZ_DBS");
|
||||||
if (foz_dbs_ro)
|
if (foz_dbs_ro)
|
||||||
load_foz_dbs_ro(foz_db, foz_dbs_ro);
|
load_foz_dbs_ro(foz_db, foz_dbs_ro);
|
||||||
|
|
||||||
#ifdef FOZ_DB_UTIL_DYNAMIC_LIST
|
#ifdef FOZ_DB_UTIL_DYNAMIC_LIST
|
||||||
char *foz_dbs_list =
|
const char *foz_dbs_list =
|
||||||
getenv("MESA_DISK_CACHE_READ_ONLY_FOZ_DBS_DYNAMIC_LIST");
|
os_get_option("MESA_DISK_CACHE_READ_ONLY_FOZ_DBS_DYNAMIC_LIST");
|
||||||
if (foz_dbs_list)
|
if (foz_dbs_list)
|
||||||
foz_dbs_list_updater_init(foz_db, foz_dbs_list);
|
foz_dbs_list_updater_init(foz_db, foz_dbs_list);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,7 @@ mesa_log_if_debug(enum mesa_log_level level, const char *outputString)
|
||||||
|
|
||||||
/* Init the local 'debug' var once. */
|
/* Init the local 'debug' var once. */
|
||||||
if (debug == -1) {
|
if (debug == -1) {
|
||||||
const char *env = getenv("MESA_DEBUG");
|
const char *env = os_get_option("MESA_DEBUG");
|
||||||
bool silent = env && strstr(env, "silent") != NULL;
|
bool silent = env && strstr(env, "silent") != NULL;
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
/* in debug builds, print messages unless MESA_DEBUG="silent" */
|
/* in debug builds, print messages unless MESA_DEBUG="silent" */
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ test_util_get_process_name (void)
|
||||||
const char *expected = "process_test";
|
const char *expected = "process_test";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char *name_override = getenv("MESA_PROCESS_NAME");
|
const char *name_override = os_get_option("MESA_PROCESS_NAME");
|
||||||
if (name_override)
|
if (name_override)
|
||||||
expected = name_override;
|
expected = name_override;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,7 @@ check_os_altivec_support(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#elif DETECT_OS_LINUX /* !DETECT_OS_APPLE && !DETECT_OS_NETBSD && !DETECT_OS_OPENBSD */
|
#elif DETECT_OS_LINUX /* !DETECT_OS_APPLE && !DETECT_OS_NETBSD && !DETECT_OS_OPENBSD */
|
||||||
char *env_vsx = getenv("GALLIVM_VSX");
|
const char *env_vsx = os_get_option("GALLIVM_VSX");
|
||||||
uint64_t hwcap = getauxval(AT_HWCAP);
|
uint64_t hwcap = getauxval(AT_HWCAP);
|
||||||
util_cpu_caps.has_altivec = (hwcap >> 28) & 1;
|
util_cpu_caps.has_altivec = (hwcap >> 28) & 1;
|
||||||
if (!env_vsx || env_vsx[0] != '0')
|
if (!env_vsx || env_vsx[0] != '0')
|
||||||
|
|
@ -190,13 +190,13 @@ check_os_altivec_support(void)
|
||||||
* lp_build_create_jit_compiler_for_module().
|
* lp_build_create_jit_compiler_for_module().
|
||||||
* If you want to disable Altivec code generation, the best place to do it is here.
|
* If you want to disable Altivec code generation, the best place to do it is here.
|
||||||
*/
|
*/
|
||||||
char *env_control = getenv("GALLIVM_ALTIVEC"); /* 1=enable (default); 0=disable */
|
const char *env_control = os_get_option("GALLIVM_ALTIVEC"); /* 1=enable (default); 0=disable */
|
||||||
if (env_control && env_control[0] == '0') {
|
if (env_control && env_control[0] == '0') {
|
||||||
enable_altivec = false;
|
enable_altivec = false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* VSX instructions can be explicitly enabled/disabled via GALLIVM_VSX=1 or 0 */
|
/* VSX instructions can be explicitly enabled/disabled via GALLIVM_VSX=1 or 0 */
|
||||||
char *env_vsx = getenv("GALLIVM_VSX");
|
const char *env_vsx = os_get_option("GALLIVM_VSX");
|
||||||
if (env_vsx && env_vsx[0] == '0') {
|
if (env_vsx && env_vsx[0] == '0') {
|
||||||
enable_vsx = false;
|
enable_vsx = false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ static inline void regfree(regex_t* r) {}
|
||||||
static bool
|
static bool
|
||||||
be_verbose(void)
|
be_verbose(void)
|
||||||
{
|
{
|
||||||
const char *s = getenv("MESA_DEBUG");
|
const char *s = os_get_option("MESA_DEBUG");
|
||||||
if (!s)
|
if (!s)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
@ -599,7 +599,7 @@ __driUtilMessage(const char *f, ...)
|
||||||
va_list args;
|
va_list args;
|
||||||
const char *libgl_debug;
|
const char *libgl_debug;
|
||||||
|
|
||||||
libgl_debug=getenv("LIBGL_DEBUG");
|
libgl_debug=os_get_option("LIBGL_DEBUG");
|
||||||
if (libgl_debug && !strstr(libgl_debug, "quiet")) {
|
if (libgl_debug && !strstr(libgl_debug, "quiet")) {
|
||||||
fprintf(stderr, "libGL: ");
|
fprintf(stderr, "libGL: ");
|
||||||
va_start(args, f);
|
va_start(args, f);
|
||||||
|
|
@ -873,7 +873,7 @@ parseOptConfAttr(struct OptConfData *data, const char **attr)
|
||||||
/* don't use XML_WARNING, drirc defines options for all drivers,
|
/* don't use XML_WARNING, drirc defines options for all drivers,
|
||||||
* but not all drivers support them */
|
* but not all drivers support them */
|
||||||
return;
|
return;
|
||||||
else if (getenv(cache->info[opt].name)) {
|
else if (os_get_option(cache->info[opt].name)) {
|
||||||
/* don't use XML_WARNING, we want the user to see this! */
|
/* don't use XML_WARNING, we want the user to see this! */
|
||||||
if (be_verbose()) {
|
if (be_verbose()) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
|
|
@ -1256,10 +1256,11 @@ driParseConfigFiles(driOptionCache *cache, const driOptionCache *info,
|
||||||
userData.execName = execname;
|
userData.execName = execname;
|
||||||
|
|
||||||
#if WITH_XMLCONFIG
|
#if WITH_XMLCONFIG
|
||||||
char *home, *configdir;
|
const char *configdir;
|
||||||
|
char *home;
|
||||||
|
|
||||||
/* parse from either $DRIRC_CONFIGDIR or $datadir/drirc.d */
|
/* parse from either $DRIRC_CONFIGDIR or $datadir/drirc.d */
|
||||||
if ((configdir = getenv("DRIRC_CONFIGDIR")))
|
if ((configdir = os_get_option("DRIRC_CONFIGDIR")))
|
||||||
parseConfigDir(&userData, configdir);
|
parseConfigDir(&userData, configdir);
|
||||||
else {
|
else {
|
||||||
parseConfigDir(&userData, DATADIR "/drirc.d");
|
parseConfigDir(&userData, DATADIR "/drirc.d");
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ device_select_CreateInstance(const VkInstanceCreateInfo *pCreateInfo,
|
||||||
info->xserver = !strcmp(applicationName, "Xorg") || !strcmp(applicationName, "Xephyr");
|
info->xserver = !strcmp(applicationName, "Xorg") || !strcmp(applicationName, "Xephyr");
|
||||||
|
|
||||||
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
|
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
|
||||||
bool has_wayland = getenv("WAYLAND_DISPLAY") || getenv("WAYLAND_SOCKET");
|
bool has_wayland = os_get_option("WAYLAND_DISPLAY") || os_get_option("WAYLAND_SOCKET");
|
||||||
#endif
|
#endif
|
||||||
#ifdef VK_USE_PLATFORM_XCB_KHR
|
#ifdef VK_USE_PLATFORM_XCB_KHR
|
||||||
bool has_xcb = !!getenv("DISPLAY");
|
bool has_xcb = !!getenv("DISPLAY");
|
||||||
|
|
|
||||||
|
|
@ -2656,7 +2656,7 @@ static VkResult overlay_CreateInstance(
|
||||||
instance_data->instance);
|
instance_data->instance);
|
||||||
instance_data_map_physical_devices(instance_data, true);
|
instance_data_map_physical_devices(instance_data, true);
|
||||||
|
|
||||||
parse_overlay_env(&instance_data->params, getenv("VK_LAYER_MESA_OVERLAY_CONFIG"));
|
parse_overlay_env(&instance_data->params, os_get_option("VK_LAYER_MESA_OVERLAY_CONFIG"));
|
||||||
|
|
||||||
/* If there's no control file, and an output_file was specified, start
|
/* If there's no control file, and an output_file was specified, start
|
||||||
* capturing fps data right away.
|
* capturing fps data right away.
|
||||||
|
|
|
||||||
|
|
@ -203,7 +203,7 @@ vk_instance_init(struct vk_instance *instance,
|
||||||
return vk_error(instance, VK_ERROR_INITIALIZATION_FAILED);
|
return vk_error(instance, VK_ERROR_INITIALIZATION_FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
instance->trace_mode = parse_debug_string(getenv("MESA_VK_TRACE"), trace_options);
|
instance->trace_mode = parse_debug_string(os_get_option("MESA_VK_TRACE"), trace_options);
|
||||||
instance->trace_per_submit = debug_get_bool_option("MESA_VK_TRACE_PER_SUBMIT", false);
|
instance->trace_per_submit = debug_get_bool_option("MESA_VK_TRACE_PER_SUBMIT", false);
|
||||||
if (!instance->trace_per_submit) {
|
if (!instance->trace_per_submit) {
|
||||||
instance->trace_frame = (uint32_t)debug_get_num_option("MESA_VK_TRACE_FRAME", 0xFFFFFFFF);
|
instance->trace_frame = (uint32_t)debug_get_num_option("MESA_VK_TRACE_FRAME", 0xFFFFFFFF);
|
||||||
|
|
@ -403,7 +403,7 @@ void
|
||||||
vk_instance_add_driver_trace_modes(struct vk_instance *instance,
|
vk_instance_add_driver_trace_modes(struct vk_instance *instance,
|
||||||
const struct debug_control *modes)
|
const struct debug_control *modes)
|
||||||
{
|
{
|
||||||
instance->trace_mode |= parse_debug_string(getenv("MESA_VK_TRACE"), modes);
|
instance->trace_mode |= parse_debug_string(os_get_option("MESA_VK_TRACE"), modes);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VkResult
|
static VkResult
|
||||||
|
|
|
||||||
|
|
@ -1483,7 +1483,7 @@ static VkResult screenshot_CreateInstance(
|
||||||
instance_data->instance);
|
instance_data->instance);
|
||||||
instance_data_map_physical_devices(instance_data, true);
|
instance_data_map_physical_devices(instance_data, true);
|
||||||
|
|
||||||
parse_screenshot_env(&instance_data->params, getenv("VK_LAYER_MESA_SCREENSHOT_CONFIG"));
|
parse_screenshot_env(&instance_data->params, os_get_option("VK_LAYER_MESA_SCREENSHOT_CONFIG"));
|
||||||
|
|
||||||
if (!globalLockInitialized) {
|
if (!globalLockInitialized) {
|
||||||
loader_platform_thread_create_mutex(&globalLock);
|
loader_platform_thread_create_mutex(&globalLock);
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ uint32_t vk_get_driver_version(void)
|
||||||
|
|
||||||
uint32_t vk_get_version_override(void)
|
uint32_t vk_get_version_override(void)
|
||||||
{
|
{
|
||||||
const char *str = getenv("MESA_VK_VERSION_OVERRIDE");
|
const char *str = os_get_option("MESA_VK_VERSION_OVERRIDE");
|
||||||
if (str == NULL)
|
if (str == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ wsi_device_init(struct wsi_device *wsi,
|
||||||
const char *present_mode;
|
const char *present_mode;
|
||||||
UNUSED VkResult result;
|
UNUSED VkResult result;
|
||||||
|
|
||||||
WSI_DEBUG = parse_debug_string(getenv("MESA_VK_WSI_DEBUG"), debug_control);
|
WSI_DEBUG = parse_debug_string(os_get_option("MESA_VK_WSI_DEBUG"), debug_control);
|
||||||
|
|
||||||
util_cpu_trace_init();
|
util_cpu_trace_init();
|
||||||
|
|
||||||
|
|
@ -249,7 +249,7 @@ wsi_device_init(struct wsi_device *wsi,
|
||||||
goto fail;
|
goto fail;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
present_mode = getenv("MESA_VK_WSI_PRESENT_MODE");
|
present_mode = os_get_option("MESA_VK_WSI_PRESENT_MODE");
|
||||||
if (present_mode) {
|
if (present_mode) {
|
||||||
if (!strcmp(present_mode, "fifo")) {
|
if (!strcmp(present_mode, "fifo")) {
|
||||||
wsi->override_present_mode = VK_PRESENT_MODE_FIFO_KHR;
|
wsi->override_present_mode = VK_PRESENT_MODE_FIFO_KHR;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue