Closed MikeWang000000 closed 8 months ago
感谢建议,ARM64EC 解决了将 Magpie 移植为 ARM64 的主要困难。感觉微软为了推广ARM平台不遗余力了
我已经决定在未来添加 ARM64 的支持,可能是原生或者 ARM64EC
非常高兴得知 Magpie 在 arm64 方面有了新的进展!🎉
不过,目前的环境中,Magpie(arm64) 还不能正常运作。
已知情况:
Anime4K_Upscale_S
可满帧率,虽然是以较大的耗电量。总的来说,系统由于The system detected an overrun of a stack-based buffer in this application. This overrun could potentially allow a malicious user to gain control of this application.
结束了进程。
我没有这方面的经验,暂时无法判断是不是我自身环境依赖的问题。
不过,如有需要,我可以随时提供测试:)
有条件的话我推荐你自行编译。切换到 mega/xaml 分支选择 ARM64 平台即可。
编译为 ARM64 是完全可能的,v0.10 不再使用 .NET,且所有依赖都可以使用 conan 编译为 ARM64。运行不了的原因我没有头绪...
非常感谢。 我会尝试自行编译,如果有有用的信息会在这里汇报。 (近期有些个人事务,可能更新不太及时哈)
有条件的话我推荐你自行编译。切换到 mega/xaml 分支选择 ARM64 平台即可。
编译为 ARM64 是完全可能的,v0.10 不再使用 .NET,且所有依赖都可以使用 conan 编译为 ARM64。运行不了的原因我没有头绪...
mega/xaml
分支在我这里无法编译(x64, arm64 均不可),主分支 x64 我是可以编译的。
The Windows SDK version 10.0.17134.0 (or later) was not found. Install the required version of Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and selecting "Retarget solution".
而我是有 10.0.22000.0
的 SDK 的,不知道编译环境发生了什么样的改变?
mega/xaml 使用了完全不同的技术,你需要安装 UWP 开发环境。SDK 只要求 22000,你可以重定目标解决方案。
(mega/xaml 分支没实现任何功能,还在开发中)
隔了很久以后的回复: ARM64 的适配没有我想象的那么简单,辛苦 Magpie 开发者了。
目前编译 ARM64 中可能会遇到的困难有:
ARM64 中缺少 _umul128()
支持:
https://github.com/Blinue/Magpie/blob/25107154c76e60319196254bcaff5e1b7dfa4f3d/src/Shared/Utils.cpp#L47
ARM64 中缺少 __cpuid()
支持:
https://github.com/Blinue/Magpie/blob/25107154c76e60319196254bcaff5e1b7dfa4f3d/src/Magpie.Core/OverlayDrawer.cpp#L376-L402
ARM64 中 yas
依赖中判断大小端代码中的宏存在问题,上游将下面 PR 合并后可解决:
niXman/yas #121
此外,因为以下更新的影响,22000
的 SDK 已经不能编译了(这是题外话)
https://github.com/Blinue/Magpie/blob/25107154c76e60319196254bcaff5e1b7dfa4f3d/src/Magpie/XamlApp.cpp#L375-L379
然而编译完成之后仍会出现 The Application Was Unable To Start Correctly (0xc00007b)
错误。
由于 Visual Studio 要求对 ARM64 设备 “remotely target”,我还不具备这种调试的条件,因此现在还没有新进展。
现在仔细分析了一下,ARM64 下,Magpie 在微软的 x64 实时二进制翻译下可以完美运行,而 Magpie 本身是 GPU 密集型的,CPU 占用率不到 1%,因此性能损失也不是很大。 Magpie 使用的 DirectX 部分则是以原生 ARM64 的方式工作的,而 GPU 的部分则更不用谈二进制翻译了。 原生 ARM64 作为将来的一个选项保留着不错,现在可能还不太成熟...
谢谢做了这么多工作!
winui是一个笨重的框架,可能的话我会实现原生arm64。现在程序里确实使用了x86机器指令,因此需要一些适配工作。
sdk版本已升级为22621。
你试试https://github.com/Blinue/Xaml-Islands-Cpp 能编译成arm64吗?
姑且修复了 ARM64 的编译错误。
_umul128 和 __cpuid 已修复。 YAS 暂时使用 workaround 修复编译。 https://github.com/Blinue/Magpie/blob/440d6a7688dcee20e8f838fd8efa6ee6093ec8e6/src/Magpie.Core/EffectCacheManager.cpp#L10-L14
我发现了一个愚蠢的错误,Magpie.Core 在 ARM64 配置下居然编译了 x64 版本。现在已修复,有空的话你可以再试试。
https://github.com/Blinue/Magpie/blob/0d043df1df8290f1005cd5fc72bd55240c4c0e59/Magpie.sln#L85-L86
在 dev
分支编译一切正常了。另外,我仍是使用 22000 编译的。
不过依然是 0xc0000409
,与您在 6 月时提供的二进制文件是同一个问题。
表现为启动时创建了 logs\magpie.log
目录和文件,没有 UI 呈现,并 crash 。magpie.log
内容为空。事件查看器显示 0xc0000409
。
同样地 Xaml-Islands-Cpp
可编译,但亦无法运行:0xc0000409
。
编译出的二进制和 crash dump 均放在附件了,不知能否有所帮助。
环境:
Windows 11 Pro 21H2 (10.0.22000.376)
64-bit operating system, ARM-based processor
非常感谢测试。如果不能亲自调试的话恐怕找不出这个错误。这个功能只能暂且搁置了,希望尽快有 ARM64 的虚拟机吧。
@all-contributors please add @MikeWang000000 for userTesting
@Blinue
I've put up a pull request to add @MikeWang000000! :tada:
这个 issue 已经很久,我终于通过 QEMU 成功运行 Win11 ARM64。正在调查崩溃问题!
经过艰苦的调试,终于解决了。原因是 ARM64 配置下不会自动导出 DllGetActivationFactory,不知道为什么和 x64 不同,可能是编译器的 bug。就连官方示例都因为这个错误无法在 ARM64 上运行。
这是一个能正常运行的 XAML Islands 程序:XamlIslandsCpp.zip
下载 ARM64 版本 -> https://github.com/Blinue/Magpie/actions/runs/7348817673/artifacts/1138027062
因为虚拟机太慢了,我只进行了简单的测试,基本功能是没问题的。
感谢 Blinue 大佬的工作,目前这个版本在我的机器上可以正常运行。 进行了简单的测试工作,目前四种捕获方式中:
Graphics Capture: 一切正常。
Desktop Duplication: 不工作(未知的捕获模式)。
GDI: 有缺陷地工作。
DwmSharedSurface: 不工作(未知的捕获模式)。
arm64 分支是从 #643 分叉的,Desktop Duplication 和 DwmSharedSurface 还没有实现。资源管理器的问题是因为 GDI 无法捕获到 XAML Islands,是捕获方式的固有缺陷,GDI 也无法捕获 Magpie 主窗口。
现有代码没有对 ARM64 做适配,所以可能会有 bug,遇到的话请提新 issue🥳
Good job! 那这样基本功能都是处于通过可用的状态了。
刚刚测试 ARM 版本遇到的另一个小问题,就是 FPS 指示没有工作,不知道是不是这个分支还没有实现?
刚刚测试 ARM 版本遇到的另一个小问题,就是 FPS 指示没有工作,不知道是不是这个分支还没有实现?
还没有实现。新架构有两种帧率,有点复杂。
虽然有点本末倒置还是好奇有没有可能临时让arm版本Desktop Duplication正常工作,比如调用x86的接口。。不太指望得上微软将来哪一天会支持这些边边角角的问题。
请问Blinue大人是否可以私信我留下电子邮箱地址,我可以无偿提供arm设备,如果您不方便的话就算了。
@luojunyuan 你可能误解了,还有两种捕获方式没有实现是因为 PR 还没有完成,而不是实现不了。另外在新架构中,Desktop Duplication 没有功耗优势了,Graphics Capture 是最推荐的。
请问Blinue大人是否可以私信我留下电子邮箱地址,我可以无偿提供arm设备,如果您不方便的话就算了。
谢谢好意,但不必麻烦了。ARM64 已经适配完成,请等待 v1.0 发布。
Expected behavior 预期的功能
与 #161 不同,微软目前提出了新的 ABI(即ARM64EC),可以让使用 x86 或 x64 依赖的程序生成 arm64 兼容代码。
Magpie 目前基于 .Net 6.0,亦拥有 arm64 支持。这让编译程序为 arm64 架构成为可能。
事实上,在目前最新的 Windows 11 on ARM 并装有 .NET 6.0 (x64) 的情况下,借助系统内部的二进制翻译,Magpie 已经能够完美运行。
但是,如果能提供 ARM64EC build,Surface Pro X 和 Apple Silicon 虚拟机用户将能获得更高的性能体验。
Different from #161, Microsoft has announced a new ABI (ARM64EC) that allows programs that use x86 or x64 dependencies to generate arm64 compatible code.
Magpie is currently based on .Net 6.0 which also has arm64 support. This makes it possible to compile programs for the arm64 architecture.
In fact, with the latest Windows 11 on ARM with .NET 6.0 (x64) installed, Magpie already works fine thanks to the binary translation inside the system.
But Surface Pro X and Apple Silicon virtual machine users will be able to get a higher performance experience if ARM64EC builds are available.
Reference:
目前ARM64EC还在Preview,不过还是希望可以作为Magpie的将来考虑。
Alternative behavior (optional) 近似的功能(可选)
No response