Skip to content

build(windows): add arm64 initial support #3905

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

rbqvq
Copy link
Contributor

@rbqvq rbqvq commented May 25, 2025

Description

This PR adds an arm64 build for Windows.

Todo:

  • Cross compile build-deps for arm

  • Some dependencies not available in clang-aarch64 environment

Screenshot

Issues Fixed or Closed

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Dependency update (updates to dependencies)
  • Documentation update (changes to documentation)
  • Repository update (changes to repository files, e.g. .github/...)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the in code docstring/documentation-blocks for new or existing methods/components

Question

Should we need disable all x86 hardware accel (nvenc, intel quicksync and amdvce) on windows arm64 build?

@rbqvq
Copy link
Contributor Author

rbqvq commented May 25, 2025

Known Issues

It crashed after moonlight connect

[2025-05-25 12:58:21.029]: Info: [libx264 @ 0000024346e9af20] kb/s:629.76
[2025-05-25 12:58:21.059]: Info:
Device Description : Qualcomm(R) Adreno(TM) 8cx Gen 3
Device Vendor ID   : 0x4D4F4351
Device Device ID   : 0x36333630
Device Video Mem   : 0 MiB
Device Sys Mem     : 1 MiB
Share Sys Mem      : 16081 MiB
Feature Level      : 0x0000B100
Capture size       : 2560x1440
Offset             : 0x0
Virtual Desktop    : 2560x1440
[2025-05-25 12:58:21.059]: Info: Active GPU has HAGS disabled
[2025-05-25 12:58:21.059]: Info: Using realtime GPU priority
[2025-05-25 12:58:21.059]: Info:
Colorspace         : DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709
Bits Per Color     : 8
Red Primary        : [0.673828,0.317383]
Green Primary      : [0.280273,0.660156]
Blue Primary       : [0.142578,0.0449219]
White Point        : [0.313477,0.329102]
Min Luminance      : 0.0745 nits
Max Luminance      : 445.761 nits
Max Full Luminance : 445.761 nits
[2025-05-25 12:58:21.059]: Info: Desktop resolution [2560x1440]
[2025-05-25 12:58:21.060]: Info: Desktop format [DXGI_FORMAT_B8G8R8A8_UNORM]
[2025-05-25 12:58:21.060]: Info: Display refresh rate [119.987Hz]
[2025-05-25 12:58:21.060]: Info: Requested frame rate [60fps]
[2025-05-25 12:58:21.065]: Info:
[2025-05-25 12:58:21.065]: Info: // Ignore any errors mentioned above, they are not relevant. //
[2025-05-25 12:58:21.065]: Info:
[2025-05-25 12:58:21.065]: Info: Found H.264 encoder: libx264 [software]
[2025-05-25 12:58:21.065]: Info: Executing [Desktop]
[2025-05-25 12:58:21.182]: Info: New streaming session started [active sessions: 1]
libc++abi: terminating due to uncaught exception of type boost::wrapexcept<std::out_of_range>: config out of range

@rbqvq rbqvq force-pushed the master branch 4 times, most recently from 0ccee19 to 4039fec Compare May 25, 2025 10:23
src/config.cpp Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes in this file don't make sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clangarm64 not support std
must use ::std

Copy link
Contributor Author

@rbqvq rbqvq May 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its necessary for clangarm64

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the other hundreds of files?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no problem.

After changing this file, clangarm64 works correctly

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it only happend in config::amd namespace, might it same error on x86?
Can u check it on Clang64?

This comment was marked as off-topic.

This comment was marked as off-topic.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's a great resolution

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the problem is actually caused by ln 115-117 in config.cpp. it imports headers in namespace amd, and the headers include std headers, which makes std redefine in namespace amd:

Sunshine/src/config.cpp

Lines 115 to 117 in a3ee774

#include <AMF/components/VideoEncoderAV1.h>
#include <AMF/components/VideoEncoderHEVC.h>
#include <AMF/components/VideoEncoderVCE.h>

@rbqvq
Copy link
Contributor Author

rbqvq commented Jun 2, 2025

Can we use this hardware encode? 🤔
obsproject/obs-studio#11993

@ReenigneArcher
Copy link
Member

I think MF encoder is already included with the FFmpeg build, so why not?

@rbqvq
Copy link
Contributor Author

rbqvq commented Jun 2, 2025

I think MF encoder is already included with the FFmpeg build, so why not?

Well, I didn't read the source code of sunshine.
This part is up to you. 🤪

@rbqvq

This comment was marked as resolved.

@rbqvq rbqvq force-pushed the master branch 11 times, most recently from 9d0c82c to b0e2234 Compare June 9, 2025 09:53
@rbqvq rbqvq force-pushed the master branch 2 times, most recently from 48376c4 to a3ee774 Compare June 30, 2025 05:21
@ReenigneArcher
Copy link
Member

ci has been refactored a bit, the windows build is now in a separate workflow. It's already setup for a matrix build so should be easy to adapt your changes.


// conditional includes
#if defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(__amd64__) || defined(_M_AMD64)
#include <MinHook.h>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we can/should do this. It might work now by luck because none of the Windows ARM64 machines out in the wild have a discrete GPU, but it is definitely not guaranteed to continue working. We should look into hooking libraries that support ARM64, like Detours.

Copy link
Contributor Author

@rbqvq rbqvq Jul 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MediaTek + NVIDIA SoCs in 2026
I'm not sure if this is integrated or discrete graphics.
At least until then, we don't have to do this.
We don't have any discrete GPU drivers for windows on arm

Step by step, complete the initial support first

rbqvq and others added 5 commits July 22, 2025 19:01
MinHook does not support arm64, add conditional check

Signed-off-by: Coia Prant <[email protected]>
Co-authored-by: ReenigneArcher <[email protected]>
Steam Audio Driver unavailable on Windows Arm64, add check

Signed-off-by: Coia Prant <[email protected]>
For AMF `#include`, clang will resolve `std` to `config::amd::std`

Use `::std` to force resolution to the global namespace

Signed-off-by: Coia Prant <[email protected]>
Co-authored-by: Ricky8955555 <[email protected]>
SyntheticPointerDevice does not support arm64, add conditional check

Signed-off-by: Coia Prant <[email protected]>
CLANGARM64 does not have libatomic which used by googletest, disable it

Signed-off-by: Coia Prant <[email protected]>
@rbqvq rbqvq force-pushed the master branch 3 times, most recently from 6862e9c to b720ab7 Compare July 22, 2025 19:10
rbqvq and others added 2 commits July 22, 2025 19:12
Boost v1.87.0 is not currently compatible with WoA, backport the following

context: Support building assembly files for mingw-w64 on arm64 with CMake
Link: boostorg/context@f82483d

uuid: Do not link to libatomic under any Clang/Windows
Link: boostorg/uuid@434329f

Signed-off-by: Coia Prant <[email protected]>
Add windows arm64 documents.

Signed-off-by: Coia Prant <[email protected]>
Co-authored-by: ReenigneArcher <[email protected]>
nsis does not support arm64, so we cannot create an installer at this time

Signed-off-by: Coia Prant <[email protected]>
Co-authored-by: ReenigneArcher <[email protected]>
Add missing TOSTRING for ICON

Signed-off-by: Coia Prant <[email protected]>
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LLVM Clang Build fails
6 participants