mirror of
https://github.com/Cateners/tiny_computer.git
synced 2026-05-20 16:35:47 +08:00
Turnip Option Added
This commit is contained in:
@@ -459,14 +459,11 @@ sed -i -E "s@^(VNC_RESOLUTION)=.*@\\1=${w}x${h}@" \$(command -v startvnc)""");
|
||||
ExpansionPanel(
|
||||
isExpanded: _expandState[5],
|
||||
headerBuilder: ((context, isExpanded) {
|
||||
return const ListTile(title: Text("virgl加速"), subtitle: Text("实验性功能"));
|
||||
return const ListTile(title: Text("图形加速"), subtitle: Text("实验性功能"));
|
||||
}), body: Padding(padding: const EdgeInsets.all(12), child: Column(children: [
|
||||
const Text("""virgl加速可部分利用设备GPU提升系统图形处理表现,但由于设备差异也可能导致容器系统及软件运行不稳定甚至异常退出。
|
||||
const Text("""图形加速可部分利用设备GPU提升系统图形处理表现,但由于设备差异也可能导致容器系统及软件运行不稳定甚至异常退出。
|
||||
|
||||
请先开启测试按钮启动virgl服务器,如果按钮没有自动关闭说明至少启动没问题;
|
||||
|
||||
不过运行情况依然无法保证。
|
||||
"""),
|
||||
Virgl可为使用OpenGL ES的应用提供加速。"""),
|
||||
const SizedBox.square(dimension: 16),
|
||||
TextFormField(maxLines: null, initialValue: Util.getGlobal("defaultVirglCommand") as String, decoration: const InputDecoration(border: OutlineInputBorder(), labelText: "virgl服务器参数"),
|
||||
onChanged: (value) async {
|
||||
@@ -474,37 +471,34 @@ sed -i -E "s@^(VNC_RESOLUTION)=.*@\\1=${w}x${h}@" \$(command -v startvnc)""");
|
||||
},
|
||||
),
|
||||
const SizedBox.square(dimension: 8),
|
||||
SwitchListTile(title: const Text("测试"), subtitle: const Text("启动virgl_test_server"), value: G.isVirglServerStarted, onChanged:(value) {
|
||||
switch (value) {
|
||||
case true: {
|
||||
G.virglServerPty = Pty.start("/system/bin/sh");
|
||||
G.virglServerPty.write(const Utf8Encoder().convert("export CONTAINER_DIR=${G.dataPath}/containers/${G.currentContainer}\n${G.dataPath}/bin/virgl_test_server ${Util.getGlobal("defaultVirglCommand")}\nexit\n"));
|
||||
G.virglServerPty.exitCode.then((value) {
|
||||
G.isVirglServerStarted = false;
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
break;
|
||||
case false: {
|
||||
G.virglServerPty.write(const Utf8Encoder().convert("\x03exit\n"));
|
||||
}
|
||||
break;
|
||||
}
|
||||
G.isVirglServerStarted = value;
|
||||
setState(() {});
|
||||
},),
|
||||
const SizedBox.square(dimension: 16),
|
||||
TextFormField(maxLines: null, initialValue: Util.getGlobal("defaultVirglOpt") as String, decoration: const InputDecoration(border: OutlineInputBorder(), labelText: "图形环境变量"),
|
||||
TextFormField(maxLines: null, initialValue: Util.getGlobal("defaultVirglOpt") as String, decoration: const InputDecoration(border: OutlineInputBorder(), labelText: "virgl环境变量"),
|
||||
onChanged: (value) async {
|
||||
await G.prefs.setString("defaultVirglOpt", value);
|
||||
},
|
||||
),
|
||||
const SizedBox.square(dimension: 8),
|
||||
SwitchListTile(title: const Text("启用virgl加速"), subtitle: const Text("下次启动时生效"), value: Util.getGlobal("virgl") as bool, onChanged:(value) {
|
||||
SwitchListTile(title: const Text("启用Virgl加速"), subtitle: const Text("下次启动时生效"), value: Util.getGlobal("virgl") as bool, onChanged:(value) {
|
||||
G.prefs.setBool("virgl", value);
|
||||
setState(() {});
|
||||
},),
|
||||
const SizedBox.square(dimension: 16),
|
||||
const Divider(height: 2, indent: 8, endIndent: 8),
|
||||
const SizedBox.square(dimension: 16),
|
||||
const Text("""搭载Adreno GPU的设备通常可以使用Turnip驱动加速使用Vulkan的软件。
|
||||
|
||||
(也就是搭载不太新也不太旧的骁龙处理器的设备)"""),
|
||||
const SizedBox.square(dimension: 8),
|
||||
TextFormField(maxLines: null, initialValue: Util.getGlobal("defaultTurnipOpt") as String, decoration: const InputDecoration(border: OutlineInputBorder(), labelText: "Turnip环境变量"),
|
||||
onChanged: (value) async {
|
||||
await G.prefs.setString("defaultTurnipOpt", value);
|
||||
},
|
||||
),
|
||||
const SizedBox.square(dimension: 8),
|
||||
SwitchListTile(title: const Text("启用Turnip驱动"), subtitle: const Text("下次启动时生效"), value: Util.getGlobal("turnip") as bool, onChanged:(value) async {
|
||||
G.prefs.setBool("turnip", value);
|
||||
setState(() {});
|
||||
},),
|
||||
const SizedBox.square(dimension: 16),
|
||||
],))),
|
||||
ExpansionPanel(
|
||||
isExpanded: _expandState[6],
|
||||
|
||||
@@ -116,12 +116,14 @@ class Util {
|
||||
case "isBoxEnabled" : return b ? G.prefs.getBool(key)! : (value){G.prefs.setBool(key, value); return value;}(false);
|
||||
case "isWineEnabled" : return b ? G.prefs.getBool(key)! : (value){G.prefs.setBool(key, value); return value;}(false);
|
||||
case "virgl" : return b ? G.prefs.getBool(key)! : (value){G.prefs.setBool(key, value); return value;}(false);
|
||||
case "turnip" : return b ? G.prefs.getBool(key)! : (value){G.prefs.setBool(key, value); return value;}(false);
|
||||
case "wakelock" : return b ? G.prefs.getBool(key)! : (value){G.prefs.setBool(key, value); return value;}(false);
|
||||
case "isHidpiEnabled" : return b ? G.prefs.getBool(key)! : (value){G.prefs.setBool(key, value); return value;}(false);
|
||||
case "useAvnc" : return b ? G.prefs.getBool(key)! : (value){G.prefs.setBool(key, value); return value;}(true);
|
||||
case "defaultFFmpegCommand" : return b ? G.prefs.getString(key)! : (value){G.prefs.setString(key, value); return value;}("-hide_banner -an -max_delay 1000000 -r 30 -f android_camera -camera_index 0 -i 0:0 -vf scale=iw/2:-1 -rtsp_transport udp -f rtsp rtsp://127.0.0.1:8554/stream");
|
||||
case "defaultVirglCommand" : return b ? G.prefs.getString(key)! : (value){G.prefs.setString(key, value); return value;}("--socket-path=\$CONTAINER_DIR/tmp/.virgl_test");
|
||||
case "defaultVirglOpt" : return b ? G.prefs.getString(key)! : (value){G.prefs.setString(key, value); return value;}("GALLIUM_DRIVER=virpipe");
|
||||
case "defaultTurnipOpt" : return b ? G.prefs.getString(key)! : (value){G.prefs.setString(key, value); return value;}("VK_ICD_FILENAMES=/home/tiny/.local/share/tiny/extra/freedreno_icd.aarch64.json TU_DEBUG=noconform MESA_VK_WSI_DEBUG=sw");
|
||||
case "defaultHidpiOpt" : return b ? G.prefs.getString(key)! : (value){G.prefs.setString(key, value); return value;}("GDK_SCALE=2 QT_FONT_DPI=192");
|
||||
case "containersInfo" : return G.prefs.getStringList(key)!;
|
||||
}
|
||||
@@ -398,6 +400,7 @@ VSCode、输入法
|
||||
|
||||
请几个小时后再试一次"""},
|
||||
{"q":"找不到sys/cdefs.h", "a":"""点击上面无法编译C语言程序的快捷指令"""},
|
||||
{"q":"安装box86/box64/wine很慢", "a":"""请尝试使用魔法"""},
|
||||
];
|
||||
|
||||
//默认快捷指令
|
||||
@@ -510,8 +513,6 @@ class G {
|
||||
//static int? streamingPid;
|
||||
static String streamingOutput = "";
|
||||
static late Pty streamServerPty;
|
||||
static bool isVirglServerStarted = false;
|
||||
static late Pty virglServerPty;
|
||||
//static int? virglPid;
|
||||
static ValueNotifier<int> pageIndex = ValueNotifier(0); //主界面索引
|
||||
static ValueNotifier<bool> terminalPageChange = ValueNotifier(true); //更改值,用于刷新小键盘
|
||||
@@ -772,6 +773,9 @@ export CONTAINER_DIR=\$DATA_DIR/containers/${G.currentContainer}
|
||||
${G.dataPath}/bin/virgl_test_server ${Util.getGlobal("defaultVirglCommand")}""");
|
||||
extraOpt += "${Util.getGlobal("defaultVirglOpt")} ";
|
||||
}
|
||||
if (Util.getGlobal("turnip")) {
|
||||
extraOpt += "${Util.getGlobal("defaultTurnipOpt")} ";
|
||||
}
|
||||
if (Util.getGlobal("isBoxEnabled")) {
|
||||
G.wasBoxEnabled = true;
|
||||
extraMount += "--x86=/home/tiny/.local/bin/box86 --x64=/home/tiny/.local/bin/box64 ";
|
||||
|
||||
Reference in New Issue
Block a user