Skip to content
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

[ARM64][Windows 11]: Running Freshly Created Avalonia 11.0.0-preview4/5 application returns a transparent window #10405

Open
snickler opened this issue Feb 20, 2023 · 115 comments · Fixed by #13080 or #13538

Comments

@snickler
Copy link

snickler commented Feb 20, 2023

Describe the bug
Running Avalonia applications using 11.0.0-preview4,preview-5 and even nightly builds on native Windows on Arm devices (Surface Pro X / Windows Dev Kit 2023) fail to properly display window contents. By default, only the outer frame of the window is created while the inner contents are completely transparent.

To Reproduce
Steps to reproduce the behavior:

  1. Run dotnet new avalonia.app -f net7.0 -av 11.0.0-preview4 from an Arm64 Windows 11 device
  2. Run dotnet publish -c Release -r win10-arm64
  3. Execute the exe from the published output directory
  4. Notice the app runs with a transparent window
  5. Update the dependencies to 11.0.0-preview5
  6. Remove Mode property from declaration in App.axml
  7. Execute the same process
  8. Notice the transparent window exists

Expected behavior
Creating a new application from the Avalonia.Templates should properly run without modification for Windows Arm64.

Screenshots
If applicable, add screenshots to help explain your problem.
image

Desktop (please complete the following information):

  • OS: Windows 11 22530 Arm64
  • Version 11.0.0-preview5

Additional context
The interesting thing is deleting av_libglesv2.dll from the output directory will cause the app to load properly. I'm assuming this is a composition issue related to #8776 ?

image

@maxkatz6
Copy link
Member

I am unable to reproduce this issue on parallels for m1
image

@maxkatz6
Copy link
Member

Including preview5 and enabled Mica (which requires winui composition to be enabed).
image

@snickler
Copy link
Author

Including preview5 and enabled Mica (which requires winui composition to be enabed). image

@maxkatz6
I've reproduced this on my Surface Pro X running 10.0.25295 and my Volterra running 10.0.25300. No modifications, just a new app created from the Avalonia Template.

avaloniarepro.mp4

@maxkatz6
Copy link
Member

Don't use preview4 just in case.

@snickler
Copy link
Author

Don't use preview4 just in case.

I switched it to preview5 in the video after showing it not work out of the box with one targeting preview4

@snickler
Copy link
Author

I actually suspect that it's only working within Parallels due to Parallels Tools drivers interacting with the Mac's video acceleration, etc.

@timunie
Copy link
Contributor

timunie commented Feb 24, 2023

I switched it to preview5 in the video after showing it not work out of the box with one targeting preview4

best would be to try it again with latest master / nightly build. This way, you have most fixes inside. If you target preview4 right now, some breaking changes are expected but they are easy to fix. Read breaking changes page for reference.

@kekekeks
Copy link
Member

Note that M1 doesn't have strict memory alignment rules like "normal" ARM CPUs.

@snickler
Copy link
Author

I switched it to preview5 in the video after showing it not work out of the box with one targeting preview4

best would be to try it again with latest master / nightly build. This way, you have most fixes inside. If you target preview4 right now, some breaking changes are expected but they are easy to fix. Read breaking changes page for reference.

Tried the latest nightly, same result

image

@snickler
Copy link
Author

Okay, so I was able to get this working by using the native Windows OpenGL 🤔.

   public static AppBuilder BuildAvaloniaApp()
        => AppBuilder.Configure<App>()
            .UsePlatformDetect().With(new Win32PlatformOptions
            {
                **UseWgl = true,**
                UseWindowsUIComposition = true
            })

image

@snickler
Copy link
Author

Ah, but since it's not using glES - composition isn't working properly when attempting to apply transparency with mica

image

@snickler
Copy link
Author

WAIT.... This is even more weird.

So, it seems for anything to work with glES enabled, you HAVE to set TransparencyLevelHint in the XAML of the window. It works with both AcrylicBlur and Mica, BUT only the raw composition effects are there. No the elements defined.

AcrylicBlur
image

Wgl on and Transparency unset

image

@snickler
Copy link
Author

@danwalmsley - Have you been able to repro this issue? :)

@iksi4prs

This comment was marked as off-topic.

@timunie

This comment was marked as off-topic.

@iksi4prs

This comment was marked as off-topic.

@jp2masa

This comment was marked as off-topic.

@iksi4prs

This comment was marked as off-topic.

@jp2masa

This comment was marked as off-topic.

@iksi4prs

This comment was marked as off-topic.

@snickler
Copy link
Author

@jp2masa 10x, but doesnt work for me. preview4 works, but if I change to preview5, and remove the "Mode" to bypass compilation error, it doesnt work, namely I get a "transparent" window.

Which device are you using to run this?

@timunie
Copy link
Contributor

timunie commented Mar 14, 2023

@iksi4prs please try also latest nightly builds in a really simple App. If that does not work, please share the sample with us to double-check if anything obvious is missing. Thx.

@snickler
Copy link
Author

@iksi4prs please try also latest nightly builds in a really simple App. If that does not work, please share the sample with us to double-check if anything obvious is missing. Thx.

Nightly builds have the same issue. This is something that seems to be specific to the native Windows on Arm devices rather than Parallels specific VMs.

@timunie
Copy link
Contributor

timunie commented Mar 14, 2023

@snickler the issue thread at all, yes. But I have the feeling that @iksi4prs is facing a different issue. But without a sample, I cannot say for 100 %

@snickler
Copy link
Author

snickler commented Mar 14, 2023

@snickler the issue thread at all, yes. But I have the feeling that @iksi4prs is facing a different issue. But without a sample, I cannot say for 100 %

Their reply

it doesnt work, namely I get a "transparent" window.

Is EXACTLY what I'm facing. It seems to only be reproducible on native Windows on Arm devices like the Pro X and Win Dev Kit 2023 for example. This isn't reproducible on WoA Parallels VMs.

@afunc233
Copy link
Contributor

afunc233 commented Nov 8, 2023

@snickler @AArnott can you check this PR? #13538
屏幕截图 2023-11-08 183404
屏幕截图 2023-11-08 183511

@maxkatz6 hi ,i had try this PR,it looks good

@snickler
Copy link
Author

snickler commented Nov 8, 2023

@snickler @AArnott can you check this PR? #13538

Created a new avalonia.app, switched the packages to the CI build, seems to load the black window with white text which means that it'll work out of the box. One thing I'm not seeing is the titlebar and transparency out of the box, but I assume that's to be expected if it's falling back to the Microsoft Basic Display Adapter.

Surface Pro X
image

Parallels
image

But you know what? This will do for now! I need to play around and try some more things, but the initial issue related to the window being fully transparent without showing any elements is good to go with that PR! I can create a separate issue for keeping an eye on the Adreno adapter since this gets us forward.

\o/ Thanks @maxkatz6 and everyone!!!

@AArnott
Copy link
Sponsor Contributor

AArnott commented Nov 8, 2023

I can't find the packages from the PR build, which claims to have built 11.0.999-cibuild0041739-beta.

image

This is the list of packages available from the https://nuget-feed-nightly.avaloniaui.net/v3/index.json feed.

@snickler
Copy link
Author

snickler commented Nov 8, 2023 via email

@AArnott
Copy link
Sponsor Contributor

AArnott commented Nov 8, 2023

I'm not sure why I'd look for a 11.1.999 version when the PR build says to use a 11.0.999 version. But I tried changing the 0 to 1 as you seemed to suggest. It still fails:

error NU1102: Unable to find package Avalonia.Diagnostics with version (>= 11.1.999-cibuild0041739-beta)
error NU1102: - Found 303 version(s) in avalonia-nightly [ Nearest version: 11.1.999-cibuild0041722-beta ]

@AArnott
Copy link
Sponsor Contributor

AArnott commented Nov 8, 2023

Apparently I need to combine the 0->1 change with a fix to the feed I was using. I should have been using https://nuget-feed-all.avaloniaui.net/v3/index.json rather than the nightly feed.

With that, I no longer have a transparent window. But what is drawn looks butt-ugly.
image

It's supposed to look like this (as seen on an x64 machine):
image

@timunie
Copy link
Contributor

timunie commented Nov 9, 2023

@AArnott check RequestedThemeVariant in App.axaml. It should be Light in your case.

@AArnott
Copy link
Sponsor Contributor

AArnott commented Nov 10, 2023

It was RequestedThemeVariant="Default", as your very astute suggestion probably anticipated. I've corrected it, and now it looks great. Dark theme on the arm64 device I guess.

I like your PR!

@snickler
Copy link
Author

Oof.. The lack of hardware acceleration is definitely visible.

Recording.2023-11-10.101449.mp4

@GrfxArik
Copy link

GrfxArik commented Nov 10, 2023

I strongly suggest using WGL for ARM64 instead of the software renderer. The user needs to have the OpenGL compatability app (available for free form the store https://apps.microsoft.com/detail/9NQPSL29BFFF)

@snickler
Copy link
Author

I strongly suggest using WGL for ARM64 instead of the software renderer.

Hmmm yeah... I edited my local copy of WalletWasabi to use Wgl and 11.0.5 instead of the PR version and it's much smoother. I do wonder if the move is to force Wgl for any adreno gpu attempting Egl for the time being?

Recording.2023-11-10.104639.mp4

@maxkatz6
Copy link
Member

I don’t think it’s a good idea. Wgl by itself has tons of issues, and half of them were reported here already. Microsoft basic renderer should provide stability that is missing on arm devices. And we can hope it will be better with next gen arm chips and new drivers.

Although, ideally we should report it to adreno, so they could take a look and diagnose this problem from their side. Does anybody know the right tracker?

@driver1998
Copy link

Maybe raise the issue at https://linaro.atlassian.net/wiki/spaces/WOAR/overview? There are contacts with Qualcomm and Microsoft.

@jmacato
Copy link
Member

jmacato commented Dec 1, 2023

Reopening per @snickler 's request

@jmacato jmacato reopened this Dec 1, 2023
@GrfxArik
Copy link

I can confirm the issue is a driver issue and a fix is planned for the near future. I'll update once the new driver is available.

@maxkatz6
Copy link
Member

@GrfxArik is there a way to programmatically detect a new driver? Will it have a different dx-adapter name, or maybe another dx/win32 api to know? Otherwise, we might stack with a current solution for a while.

@GrfxArik
Copy link

@maxkatz6 I found https://stackoverflow.com/questions/56935213/how-to-get-adapter-driver-version-in-directx12 that can be used, but completely understandable the need to have the workaround for a while

@StayMeaty
Copy link

Any updates on this? We have the same problem with Surface Pro 5 devices with Microsoft SQ1 ARM processors. The plain window appears and brings a mica effect, but there's no window content.

@maxkatz6
Copy link
Member

@StayMeaty

  1. We have a workaround enabled by default since November (december+ releases).
  2. And original driver issue should be fixed by Qualcomm as well according to @GrfxArik

@snickler
Copy link
Author

@StayMeaty

  1. We have a workaround enabled by default since November (december+ releases).
  2. And original driver issue should be fixed by Qualcomm as well according to @GrfxArik

I will second the workaround is pretty feasible.

As far as the fix, it will be coming soon but for 8cx Gen 3 devices as of now (Surface Pro 9 5g, Win Dev Kit 2023, Lenovo ThinkPad X13s).

@maxkatz6 , when the update becomes available I'll look to put in a PR that will exclude those devices from the workaround

@reflectronic
Copy link

Is there a timeline for the updated graphics driver? It is still coming to 8cx Gen 3 devices, right?

@snickler
Copy link
Author

Is there a timeline for the updated graphics driver? It is still coming to 8cx Gen 3 devices, right?

Just received word that the updated graphics driver is out!

@driver1998
Copy link

driver1998 commented Jul 24, 2024

@GrfxArik Will 8cx Gen 1/Gen 2 receive the same update? I know Qualcomm does not provide downloads for these platforms, so please provide a version number that fixes the issue.

@driver1998
Copy link

For reference: from the download linked above, on 8cx Gen 3 it would be 30.0.4035.6900.

@snickler
Copy link
Author

@GrfxArik Will 8cx Gen 1/Gen 2 receive the same update? I know Qualcomm does not provide downloads for these platforms, so please provide a version number that fixes the issue.

No. the fix was only done for 8cx Gen 3 and included in the X Series devices. Gen 1/2 aren't being offered the fix unfortunately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment