mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-07 18:13:23 +09:00
[Tools] (config): debug.mobilegl.env sets MOBILEGL_* knobs in an app-hosted Android process, and the device-state line carries them.
This commit is contained in:
@@ -142,6 +142,28 @@ namespace MobileGL::MG_ConfigLoader {
|
|||||||
if (IsServerProcess()) return;
|
if (IsServerProcess()) return;
|
||||||
ReadBackendFile(FilePathSetting("MOBILEGL_BACKEND_FILE", kDefaultBackendFile), out);
|
ReadBackendFile(FilePathSetting("MOBILEGL_BACKEND_FILE", kDefaultBackendFile), out);
|
||||||
ReadConfigFile(FilePathSetting("MOBILEGL_CONFIG_FILE", kDefaultConfigFile), out, log);
|
ReadConfigFile(FilePathSetting("MOBILEGL_CONFIG_FILE", kDefaultConfigFile), out, log);
|
||||||
|
#if defined(__ANDROID__)
|
||||||
|
// An app that hosts the library (FCL) owns its process environment, so a developer
|
||||||
|
// has no way to set a MOBILEGL_* knob in it. `adb shell setprop debug.mobilegl.env
|
||||||
|
// "MOBILEGL_A=1;MOBILEGL_B=0"` does it, below the environment like the Linux config
|
||||||
|
// file (PROP_VALUE_MAX bounds it to a few keys).
|
||||||
|
char property[PROP_VALUE_MAX] = {};
|
||||||
|
if (__system_property_get("debug.mobilegl.env", property) > 0) {
|
||||||
|
String all(property);
|
||||||
|
SizeT start = 0;
|
||||||
|
while (start < all.size()) {
|
||||||
|
SizeT end = all.find(';', start);
|
||||||
|
if (end == String::npos) end = all.size();
|
||||||
|
const String item = all.substr(start, end - start);
|
||||||
|
const SizeT eq = item.find('=');
|
||||||
|
if (eq != String::npos && eq > 0) {
|
||||||
|
out.emplace(item.substr(0, eq), item.substr(eq + 1));
|
||||||
|
if (log) MGLOG_I("Config: debug.mobilegl.env sets %s", item.c_str());
|
||||||
|
}
|
||||||
|
start = end + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|||||||
@@ -17,5 +17,5 @@ anland=$(adb -s "$SER" shell pidof com.anland.consumer.mobilegl | tr -dc '0-9' |
|
|||||||
p=$(cat "$out/profile.txt")
|
p=$(cat "$out/profile.txt")
|
||||||
pn=$(echo "$p" | sed -n 's/.*profile=\([^ ]*\).*/\1/p'); pc=$(echo "$p" | sed -n 's/.*cpu=\([0-9]*\).*/\1/p'); pl=$(echo "$p" | sed -n 's/.*little=\([0-9]*\).*/\1/p'); pg=$(echo "$p" | sed -n 's/.*gpu=\([0-9]*\).*/\1/p')
|
pn=$(echo "$p" | sed -n 's/.*profile=\([^ ]*\).*/\1/p'); pc=$(echo "$p" | sed -n 's/.*cpu=\([0-9]*\).*/\1/p'); pl=$(echo "$p" | sed -n 's/.*little=\([0-9]*\).*/\1/p'); pg=$(echo "$p" | sed -n 's/.*gpu=\([0-9]*\).*/\1/p')
|
||||||
[ "$kind" = trace ] && { ver=-; swap=pbuffer; }
|
[ "$kind" = trace ] && { ver=-; swap=pbuffer; }
|
||||||
line="STATE profile=${pn:-unpinned}(${pc:+$((pc/1000))/$((pl/1000))/$((pg/1000000))MHz}) $(head -1 "$out/valid.txt") daemons=$daemons mc=$ver swap=${swap:-?} anland=$([ -n "$anland" ] && echo on || echo off)"
|
line="STATE profile=${pn:-unpinned}(${pc:+$((pc/1000))/$((pl/1000))/$((pg/1000000))MHz}) $(head -1 "$out/valid.txt") daemons=$daemons mc=$ver swap=${swap:-?} anland=$([ -n "$anland" ] && echo on || echo off) $(cat "$out/env.txt" 2>/dev/null)"
|
||||||
echo "$line" > "$out/state.txt"; echo "$line"
|
echo "$line" > "$out/state.txt"; echo "$line"
|
||||||
|
|||||||
Reference in New Issue
Block a user