mirror of
https://github.com/ARMSX2/ARMSX3.git
synced 2026-08-24 16:58:52 -07:00
Log the driver options actually applied
The previous commit read driver_env.txt before the log file was opened, so the one thing worth knowing -- whether the option was applied -- was written into a listener that did not exist yet and then thrown away when the log rotated. Move the read to just after the log file is created and report each option by reading it back rather than echoing what was meant to be set. There is no other honest confirmation available: /proc/<pid>/environ is the snapshot taken at exec and never reflects a runtime setenv, and Mesa's own logging goes to stderr, which Android discards. Still long before any Vulkan instance exists, which is the only ordering Mesa cares about.
This commit is contained in:
@@ -2148,32 +2148,6 @@ extern "C" bool _rpcsx_initialize(std::string_view rootDir,
|
||||
// std::filesystem::remove_all(g_android_cache_dir, ec);
|
||||
std::filesystem::create_directories(g_android_cache_dir);
|
||||
|
||||
// Mesa driver options, from <root>/driver_env.txt, one NAME=VALUE per line.
|
||||
//
|
||||
// This device needs Turnip -- the stock Adreno driver does not render at all -- and
|
||||
// Turnip's behaviour is steered by environment variables such as TU_DEBUG. The usual way
|
||||
// to set those, the wrap.<package> property, is ignored on a user build: it can be set and
|
||||
// read back while never reaching the process environment, which makes a flag that did
|
||||
// nothing look exactly like a flag that made no difference.
|
||||
//
|
||||
// Read before any Vulkan instance exists, because Mesa caches each option the first time
|
||||
// it is queried. A missing file is the normal case and does nothing.
|
||||
if (std::ifstream env_file(rootDirStr + "driver_env.txt"); env_file.is_open()) {
|
||||
std::string line;
|
||||
while (std::getline(env_file, line)) {
|
||||
if (const auto eq = line.find('=');
|
||||
eq != std::string::npos && !line.empty() && line[0] != '#') {
|
||||
auto name = line.substr(0, eq);
|
||||
auto value = line.substr(eq + 1);
|
||||
|
||||
while (!value.empty() && (value.back() == '\r' || value.back() == ' ')) {
|
||||
value.pop_back();
|
||||
}
|
||||
|
||||
setenv(name.c_str(), value.c_str(), 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (g_initialized) {
|
||||
@@ -2215,6 +2189,42 @@ extern "C" bool _rpcsx_initialize(std::string_view rootDir,
|
||||
stats.avail_free / 4);
|
||||
}
|
||||
|
||||
// Mesa driver options, from <root>/driver_env.txt, one NAME=VALUE per line.
|
||||
//
|
||||
// This device needs Turnip -- the stock Adreno driver does not render the game at all -- and
|
||||
// Turnip is steered by environment variables such as TU_DEBUG. The usual way to set one,
|
||||
// the wrap.<package> property, is ignored on a user build: it can be set and read back while
|
||||
// never reaching the process, so a flag that never applied looks exactly like a flag that
|
||||
// made no difference.
|
||||
//
|
||||
// Here rather than earlier, because this is the first point the log file exists; anything
|
||||
// written before it is opened is discarded, and the whole value of this is being able to see
|
||||
// that the option was applied. Still long before any Vulkan instance, which is what matters:
|
||||
// Mesa caches each option the first time it is read.
|
||||
//
|
||||
// A missing file does nothing, which is the normal case.
|
||||
if (std::ifstream env_file(g_android_executable_dir + "driver_env.txt"); env_file.is_open()) {
|
||||
std::string line;
|
||||
while (std::getline(env_file, line)) {
|
||||
if (const auto eq = line.find('=');
|
||||
eq != std::string::npos && !line.empty() && line[0] != '#') {
|
||||
auto name = line.substr(0, eq);
|
||||
auto value = line.substr(eq + 1);
|
||||
|
||||
while (!value.empty() && (value.back() == '\r' || value.back() == ' ')) {
|
||||
value.pop_back();
|
||||
}
|
||||
|
||||
setenv(name.c_str(), value.c_str(), 1);
|
||||
|
||||
// Read it back rather than echoing what we meant to set. /proc/<pid>/environ is the
|
||||
// snapshot taken at exec and never reflects a runtime setenv, and Mesa's own logging
|
||||
// may go to stderr, which Android drops, so this is the only honest confirmation.
|
||||
rpcsx_android.warning("driver_env: %s=%s", name, getenv(name.c_str()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
logs::stored_message ver{rpcsx_android.always()};
|
||||
ver.text = fmt::format("RPCSX-ps3-android v%s", rpcs3::get_version().to_string());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user