VR/zh: Difference between revisions
Created page with "[https://gitlab.com/znixian/OpenOVR OpenComposite] 是一个兼容层,用于在 Monado 等 OpenXR 运行时上运行 OpenVR 应用程序。它与 DXVK 或 vkd3d 等工具类似,但用于将 OpenVR 调用转换为 OpenXR。" |
Updating to match new version of source page |
||
| Line 55: | Line 55: | ||
有关可用环境变量和调整的更多信息,请参阅 [https://lvra.gitlab.io/docs/fossvr/monado/ Linux VR Adventures wiki] 和 [https://monado.freedesktop.org/getting-started.html#environment-variables Monado 文档关于环境变量的部分] | 有关可用环境变量和调整的更多信息,请参阅 [https://lvra.gitlab.io/docs/fossvr/monado/ Linux VR Adventures wiki] 和 [https://monado.freedesktop.org/getting-started.html#environment-variables Monado 文档关于环境变量的部分] | ||
== OpenComposite == | == OpenComposite == | ||
| Line 63: | Line 62: | ||
为了在 SteamVR 以外的任何平台上运行 OpenVR 游戏,您需要配置 <code>~/.config/openvr/openvrpaths.vrpath</code> 中定义的 OpenVR 运行时路径。一个可靠的方法是使用 [[Special:MyLanguage/Home Manager|Home Manager]] 创建此文件。 | 为了在 SteamVR 以外的任何平台上运行 OpenVR 游戏,您需要配置 <code>~/.config/openvr/openvrpaths.vrpath</code> 中定义的 OpenVR 运行时路径。一个可靠的方法是使用 [[Special:MyLanguage/Home Manager|Home Manager]] 创建此文件。 | ||
{{Warning|旧版本的 Proton 将始终查询当前的 OpenVR 和 OpenXR 运行时。如果您使用 OpenComposite,并且它无法初始化 OpenXR 环境,Proton 将无法启动。解决方法是删除 ~/.config/openvr/openvrpaths.vrpath 文件,然后重试启动游戏。}} | {{Warning|<span class="mw-translate-fuzzy">{{Warning|旧版本的 Proton 将始终查询当前的 OpenVR 和 OpenXR 运行时。如果您使用 OpenComposite,并且它无法初始化 OpenXR 环境,Proton 将无法启动。解决方法是删除 ~/.config/openvr/openvrpaths.vrpath 文件,然后重试启动游戏。}}</span>}} | ||
如果此文件未设置为只读,SteamVR 将添加其运行时路径,因此可以使用 Home Manager。 | 如果此文件未设置为只读,SteamVR 将添加其运行时路径,因此可以使用 Home Manager。 | ||
| Line 102: | Line 101: | ||
WiVRn 模块的示例用法: | WiVRn 模块的示例用法: | ||
{{Warning|从 WiVRn 0.23 版本开始,WiVRn 会自行管理 opencomposite 路径。仅在使用低于 v0.23 的版本时使用上述 opencomposite 配置。}} | {{Warning|<span class="mw-translate-fuzzy">{{Warning|从 WiVRn 0.23 版本开始,WiVRn 会自行管理 opencomposite 路径。仅在使用低于 v0.23 的版本时使用上述 opencomposite 配置。}}</span>}} | ||
{{File|/etc/nixos/configuration.nix|nix|3=services.wivrn = { | {{File|/etc/nixos/configuration.nix|nix|3=services.wivrn = { | ||
| Line 158: | Line 157: | ||
在初始设置时,SteamVR 会请求提升权限,以便为其某个二进制文件设置文件能力(file capability)。这是使异步再投影技术正常工作所必需的。客户端需要拥有 <code>CAP_SYS_NICE</code> 授权来获取高优先级环境,这是异步再投影技术的必要条件。 | 在初始设置时,SteamVR 会请求提升权限,以便为其某个二进制文件设置文件能力(file capability)。这是使异步再投影技术正常工作所必需的。客户端需要拥有 <code>CAP_SYS_NICE</code> 授权来获取高优先级环境,这是异步再投影技术的必要条件。 | ||
{{Note|Steam 在基于 bubblewrap 的 FHS 环境中运行。此环境在用户命名空间中运行 Steam,这阻止它使用任何能力(capabilities)或为二进制文件 setuid。这意味着除非修补内核以完全消除这些限制,否则异步再投影技术无法在 NixOS 上使用。请参阅此 [https://github.com/NixOS/nixpkgs/issues/217119 Nixpkgs 问题]}} | {{Note|<span class="mw-translate-fuzzy">{{Note|Steam 在基于 bubblewrap 的 FHS 环境中运行。此环境在用户命名空间中运行 Steam,这阻止它使用任何能力(capabilities)或为二进制文件 setuid。这意味着除非修补内核以完全消除这些限制,否则异步再投影技术无法在 NixOS 上使用。请参阅此 [https://github.com/NixOS/nixpkgs/issues/217119 Nixpkgs 问题]}}</span>}} | ||
<span id="Patching_AMDGPU_to_allow_high_priority_queues"></span> | <span id="Patching_AMDGPU_to_allow_high_priority_queues"></span> | ||
| Line 165: | Line 164: | ||
通过应用 [https://github.com/Frogging-Family/community-patches/blob/a6a468420c0df18d51342ac6864ecd3f99f7011e/linux61-tkg/cap_sys_nice_begone.mypatch 此补丁],AMDGPU 内核驱动程序将忽略进程权限并允许任何应用程序创建高优先级环境(high priority contexts)。 | 通过应用 [https://github.com/Frogging-Family/community-patches/blob/a6a468420c0df18d51342ac6864ecd3f99f7011e/linux61-tkg/cap_sys_nice_begone.mypatch 此补丁],AMDGPU 内核驱动程序将忽略进程权限并允许任何应用程序创建高优先级环境(high priority contexts)。 | ||
{{Warning|这将移除内核中特意设置的限制,并可能导致调度问题。虽然目前尚未收到导致问题的报告,但这应被视为不受支持的配置。}} | {{Warning|<span class="mw-translate-fuzzy">{{Warning|这将移除内核中特意设置的限制,并可能导致调度问题。虽然目前尚未收到导致问题的报告,但这应被视为不受支持的配置。}}</span>}} | ||
<span id="Applying_as_a_NixOS_kernel_patch"></span> | <span id="Applying_as_a_NixOS_kernel_patch"></span> | ||
| Line 185: | Line 184: | ||
也可以只修补 amdgpu 并将其构建为树外模块(out-of-tree module),如 [[Special:MyLanguage/Linux_kernel#Patching_a_single_In-tree_kernel_module|Pacthing a single In-tree Kernel Module]] 中所述 | 也可以只修补 amdgpu 并将其构建为树外模块(out-of-tree module),如 [[Special:MyLanguage/Linux_kernel#Patching_a_single_In-tree_kernel_module|Pacthing a single In-tree Kernel Module]] 中所述 | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
=== Patching bubblewrap to allow capabilities === | |||
</div> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
By modifying the bubblewrap binary used for running Steam, you can allow processes in that FHS environment to acquire capabilities. This removes the need for patching the kernel directly. | |||
</div> | |||
{{Warning|<span lang="en" dir="ltr" class="mw-content-ltr">This circumvents an intended security mechanism in bubblewrap, and allows all other software launched by steam, or running via steam-run to acquire these capabilities as well.</span>}} | |||
{{file|/etc/nixos/configuration.nix|nix|3=programs.steam = let | |||
patchedBwrap = pkgs.bubblewrap.overrideAttrs (o: { | |||
patches = (o.patches or []) ++ [ | |||
./bwrap.patch | |||
]; | |||
}); | |||
in { | |||
enable = true; | |||
package = pkgs.steam.override { | |||
buildFHSEnv = (args: ((pkgs.buildFHSEnv.override { | |||
bubblewrap = patchedBwrap; | |||
}) (args // { | |||
extraBwrapArgs = (args.extraBwrapArgs or []) ++ [ "--cap-add ALL" ]; | |||
}))); | |||
}; | |||
}; | |||
}} | |||
{{file|/etc/nixos/bwrap.patch|diff|3=diff --git a/bubblewrap.c b/bubblewrap.c | |||
index 8322ea0..4e20262 100644 | |||
--- a/bubblewrap.c | |||
+++ b/bubblewrap.c | |||
@@ -868,13 +868,6 @@ acquire_privs (void) | |||
/* Keep only the required capabilities for setup */ | |||
set_required_caps (); | |||
} | |||
- else if (real_uid != 0 && has_caps ()) | |||
- { | |||
- /* We have some capabilities in the non-setuid case, which should not happen. | |||
- Probably caused by the binary being setcap instead of setuid which we | |||
- don't support anymore */ | |||
- die ("Unexpected capabilities but not setuid, old file caps config?"); | |||
- } | |||
else if (real_uid == 0) | |||
{ | |||
/* If our uid is 0, default to inheriting all caps; the caller | |||
}} | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
as an additional change, you may also need to replace Steam's own bwrap binary with a symbolic link to this modified bwrap binary, found at <code>~/.local/share/Steam/ubuntu12_32/steam-runtime/usr/libexec/steam-runtime-tools-0/srt-bwrap</code>. | |||
</div> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
Steam will periodically replace this modification with its own binary when steam-runtime updates, so you may need to re-apply this change if it breaks. | |||
</div> | |||
== wlx-overlay-s == | == wlx-overlay-s == | ||
| Line 193: | Line 247: | ||
==== SteamVR 自动启动 ==== | ==== SteamVR 自动启动 ==== | ||
<div class="mw-translate-fuzzy"> | |||
在 SteamVR(或任何 OpenVR 合成器)中启动 wlx-overlay-s 时,它会注册一个自动启动清单。目前,此清单将引用 wlx-overlay-s 的 Nix 存储路径,该路径可能会在重建 NixOS/Nix 配置文件后被垃圾回收。一种解决方法是定期运行以下命令来更新清单的存储路径:{{Commands| | 在 SteamVR(或任何 OpenVR 合成器)中启动 wlx-overlay-s 时,它会注册一个自动启动清单。目前,此清单将引用 wlx-overlay-s 的 Nix 存储路径,该路径可能会在重建 NixOS/Nix 配置文件后被垃圾回收。一种解决方法是定期运行以下命令来更新清单的存储路径:{{Commands| | ||
# 运行 wlx-overlay-s 并替换任何正在运行的实例 | # 运行 wlx-overlay-s 并替换任何正在运行的实例 | ||
$ wlx-overlay-s --replace}} | |||
</div> | |||
{{Commands| | |||
# <span lang="en" dir="ltr" class="mw-content-ltr">Run wlx-overlay-s and replace any running instance</span> | |||
$ wlx-overlay-s --replace}} | $ wlx-overlay-s --replace}} | ||
| Line 200: | Line 260: | ||
== 另见 == | == 另见 == | ||
<div class="mw-translate-fuzzy"> | |||
* [https://lvra.gitlab.io Linux VR Adventures Wiki] | * [https://lvra.gitlab.io Linux VR Adventures Wiki] | ||
[[Category:Video/zh|分类:视频]] | [[Category:Video/zh|分类:视频]] | ||
| Line 205: | Line 266: | ||
[[Category:Desktop/zh|分类:桌面]] | [[Category:Desktop/zh|分类:桌面]] | ||
[[Category:Gaming/zh|分类:游戏]] | [[Category:Gaming/zh|分类:游戏]] | ||
</div> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
[[Category:Video]] | |||
[[Category:Hardware]] | |||
[[Category:Desktop]] | |||
[[Category:Gaming]] | |||
</div> | |||