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

NOTICE: Mesa after 22.1.7 is broken (black screen, crashing apps) #4983

Closed
ktprograms opened this issue Jan 31, 2023 · 47 comments
Closed

NOTICE: Mesa after 22.1.7 is broken (black screen, crashing apps) #4983

ktprograms opened this issue Jan 31, 2023 · 47 comments
Labels
virgl virglrenderer issues

Comments

@ktprograms
Copy link
Contributor

ktprograms commented Jan 31, 2023

Thanks everyone who's reported this issue, I've found that it's because of a switch to NIR-to-TGSI between 22.1.7 and 22.2.0.

There's 2 mitigations currently, pick between 1 and 2 based on your priorities (if its keeping your distro configs, then choose 1, or if you need GPU acceleration, then choose 2):

  1. Change the Emulated Display Card to virtio-ramfb or any other card without a -gl suffix.
  2. Switch to a distro that ships mesa<=22.1.7, such as Debian 11 or Alpine 3.16

If anyone has knowledge on how this can be debugged or fixed, please don't hesitate to comment on this issue (or join the UTM Discord server if this issue has comments locked). Please note that I don't particularly need logs (I already have virglrenderer traces), but if you have logs that point to the problematic code, please share them :)

@fabiensanglard
Copy link

fabiensanglard commented Feb 23, 2023

Is the issue really with Mesa's TGSI or is it a problem with virtio implementation replying on unspecified behavior of Mesa NIR? ?

In other words: Should we report this issue to Mesa (can they fix it on their end)? Or should we report this issue to whoever maintains virtio implementation?

@tvolin
Copy link

tvolin commented Feb 26, 2023

I don't consider #4982 a dupe of this bug. As per my comment on that issue, I suggest you change the defaults or add something to the doc page for installing Fedora.
This Mesa issue reports the upstream cause, but the symptom is easy for UTM itself to address

@osy
Copy link
Contributor

osy commented Feb 26, 2023

I opened an issue with mesa and hopefully we can get some help root causing it: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8382

In the meantime, we will revert the change in 4.1 so by default GPU acceleration is disabled again.

@archanox
Copy link

archanox commented Mar 5, 2023

I followed option 3 as stated above, and ran glxgears which got me the following appear in the console

Mesa: warning: failed to remap glDrawRangeElementsBaseVertex
Mesa: warning: failed to remap glMultiDrawElementsBaseVertex
Mesa: warning: failed to remap glDrawArraysInstancedBaseInstance
Mesa: warning: failed to remap glDrawElementsInstancedBaseVertexBaseInstance
Mesa: warning: failed to remap glGetObjectLabelEXT
Mesa: warning: failed to remap glLabelObjectEXT
Mesa: warning: failed to remap glDrawArraysUserBuf
Mesa: warning: failed to remap glDrawElementsUserBuf
Mesa: warning: failed to remap glMultiDrawArraysUserBuf
Mesa: warning: failed to remap glMultiDrawElementsUserBuf
Mesa: warning: failed to remap glDrawArraysInstancedBaseInstanceDrawID
Mesa: warning: failed to remap glDrawElementsInstancedBaseVertexBaseInstanceDrawID

And I still have a black window.

@ktprograms
Copy link
Contributor Author

ktprograms commented Mar 6, 2023

Weird. Sorry, but I don't have time to debug why the patch doesn't work for some people, as well as trying to help figure out the bug itself, so I'll be removing the patch instructions.

If you're okay with using Debian, Debian 11 still uses an old enough mesa that the issue doesn't affect it. Alpine 3.16 would also work (and so would any distro that ships mesa<=22.1.7)

@KimonHoffmann
Copy link

KimonHoffmann commented Mar 6, 2023

I can second that applying the patch above did not fix the problem for me either. I have tested it against Mesa 22.3.2 as well as Mesa 22.3.5.
If there is more information I can supply to help the search for the root cause along, please give me a shout.

@zuzzurro
Copy link

zuzzurro commented Mar 6, 2023

Fedora 38 beta (just upgraded) runs again fine with acceleration enabled (using virtio-gpu-gl-pci). Here's a screenshot:

Screenshot 2023-03-06 at 20 39 45

Please note the broken (not round) right-top and left-bottom corners of the settings window. I think I've had them like this since I started using accelerated drivers. Did anyone else notice the same issue?

@thedustinmiller
Copy link

I can confirm partial improvements with Fedora 38. More things work, like firefox is able to render basic pages, however anything requiring opengl or vulkan acceleration is still failing. This is using both metal and opengl backends and both KDE and GNOME.

Notably, Fedora 38 is using mesa 23.0.0.

@tifasoftware
Copy link

I am observing the same corner glitch in Ubuntu 22.10. Im using ANGLE (Metal)

@driversti
Copy link

Hi all. I'm not sure if my issue is related to the one mentioned here, but I cannot boot into my VM. This is what I'm seeing now:
image
From yesterday, I had 3 identical VM running (Debian 11 (LXDE)). But a few hours ago UTM unexpectedly closed. After that one VM doesn't boot. I had the same about 2-3 days ago. Configuring my VM takes some time and is quite annoying, so this situation doesn't make me happy.
What can cause this issue? How can I avoid it? Setting up 3 VMs every a few days will make me crazy :D

@tifasoftware
Copy link

What is your emulated display device?

@driversti
Copy link

Thank you for the replay, @tifasoftware. I use the default one for a downloaded image - virtio-ramfb

@tifasoftware
Copy link

Thank you for the replay, @tifasoftware. I use the default one for a downloaded image - virtio-ramfb

This issue concerns cards with 3D acceleration that include -gl in its name. Your card is not 3D accelerated and is unaffected by this issue.

@driversti
Copy link

Okay, thanks. @tifasoftware Do you know if there is already an issue related to my problem?

@tifasoftware
Copy link

Okay, thanks. @tifasoftware Do you know if there is already an issue related to my problem?

I recommend opening a new issue

@driversti
Copy link

Okay, thanks. @tifasoftware Do you know if there is already an issue related to my problem?

I recommend opening a new issue

Thank you :)

@csmaxx
Copy link

csmaxx commented Mar 20, 2023

I'm running Ubuntu 22.04 and it renders GDM and the gnome desktop just fine with one of the gl devices.
I tried to install lightdm, qtile and xmonad tiling window managers. but none if that renders it shows a black screen.
The ui is there the mouse cursor changes to an I-beam cursor when hovering over text fields.

So it seems that the gl devices only works with GDM and gnome desktop.

@farovitus
Copy link

I'm running Ubuntu 22.04 and it renders GDM and the gnome desktop just fine with one of the gl devices. I tried to install lightdm, qtile and xmonad tiling window managers. but none if that renders it shows a black screen. The ui is there the mouse cursor changes to an I-beam cursor when hovering over text fields.

So it seems that the gl devices only works with GDM and gnome desktop.

i am trying to install Ubuntu 22.04.2 LTS (Jammy Jellyfish) Daily Build on mac m1 and it doesn't open installation windows or any app in the live version, i only get black windows when using -gl

@DragonSWDev
Copy link

Isn't it possible to disable NIR-to-TGSI with some environmental variable? I've found that there is environmental variable called "VIRGL_DEBUG" where you can set it to "use_tgsi" and that should force Mesa to use TGSI directly but it didn't help, still some applications (like Firefox or glxgears) can't render properly.

@EvanCarroll
Copy link

This is such a major issue, not having hardware accl on apple silicon in a VM really sucks. I hate OSX so I basically use a VM to host a Linux desktop running i3. Because I lack hardware acceleration, I can't run Slack and Zoom in the VM. Because of that, I can't give the VM the sound card because I need it for Slack and Zoom. So my VM has no sound.

Can we bug bounty this? This M1 mac is a total nightmare.

@osy
Copy link
Contributor

osy commented Apr 19, 2023

It’s a Mesa driver bug and we need either help from them or someone to test and send feedback to them.

@osy
Copy link
Contributor

osy commented Apr 21, 2023

@akihikodaki Curious if you ran into similar issues with Mesa in your QEMU fork?

@akihikodaki
Copy link
Contributor

@osy It's not Mesa bug but ANGLE one. (Well, TGSI-to-NIR change is so big that actually there can be other bugs, but the major issue is in ANGLE.) The bug is fixed with:
https://chromium-review.googlesource.com/c/angle/angle/+/3996520

So updating ANGLE should fix it.

osy added a commit that referenced this issue Apr 22, 2023
This includes a fix for a shader issue that is exposed by Mesa's TGSI-to-NIR
change (see #4983). However, prelimiary testing on M1 Macs shows that the Metal
backend doesn't work properly now and issues with Wayland still persist.
@osy
Copy link
Contributor

osy commented Apr 22, 2023

Thanks @akihikodaki it seems like updating ANGLE fixes the black window issue when launching X11 apps. It seems that there are still Wayland issues (Firefox crashing on launch for example) but can be mitigated by logging in with Ubuntu on Xorg or Debian on Xorg option. The latest ANGLE also seems to introduce more issue in the Metal backend because it no longer is able to fully render the login screen (the prompt and buttons don't appear).

@archanox
Copy link

Can the ANGLE issues be mitigated by migrating to Zink + MoltenVk?

@osy
Copy link
Contributor

osy commented Apr 23, 2023

@archanox As far as I’m aware, Zink isn’t available for macOS. The closest thing to ANGLE is MoltenGL which is a commercial product.

@akihikodaki
Copy link
Contributor

@osy I guess that problem is fixed with: https://gitlab.freedesktop.org/mesa/mesa/-/commit/36d050210ea854f2632c8c2a960dca94dabbf526

Metal backend is marked ready in the latest main branch but not in stable release. OpenGL backend is still the default and Chromium also doesn't use it. You cannot still use Metal backend.

Use latest stable ANGLE and Mesa with my patched virglrenderer and QEMU. Expect any kind of failures if you use something outdated.

@osy
Copy link
Contributor

osy commented Apr 23, 2023

I've done a bad thing and built the latest Mesa git commit masquerading as 22.2.5 (because I didn't want to mess with dependencies). If you are running ARM64 Ubuntu 22.04.1 (and ONLY that version), you can install these replacement DEBs to get Wayland apps like Firefox to work.

mesa-a18a51a708a86f51e0a5ab031b379f65bc84fb49.tgz

@Andy312432
Copy link

The latest commit in virglrenderer seems to adjust something about tgsi…
Maybe update sync the commit again?

@osy
Copy link
Contributor

osy commented Apr 23, 2023

@Andy312432 who are you replying to? I just built commit a18a51a708a86f51e0a5ab031b379f65bc84fb49 and also I said it was working so I'm not understanding your comment

@Andy312432
Copy link

Oh I thought wayland wayland problem still persist and we haven't update that... Sorry!!

@Andy312432
Copy link

@osy Sorry that maybe I didn't express it well, but I think maybe we can update the virglrenderer to the latest commit so that maybe it will fix something?

And a little bit off topic, since angle seems to have opengles 3.0 ready, can we have opengl 3 in our VM?

@osy
Copy link
Contributor

osy commented Apr 24, 2023

@Andy312432 as we’ve discussed above, the issue isn’t with virglrenderer PLUS it’s already updated to the latest (well it’s a few weeks old now but it’s long after this ticket was opened). Please keep up with the conversation.

ANGLE does not have full 3.0 support for Apple systems.

@gasinvein
Copy link

This seems to be fixed in 4.2.4. Tested with Fedora 38, GNOME Wayland session, booted with initcall_blacklist=sysfb_init; used glmark2 and glmark2-wayland programs.
Oddly enough and contrary to the known issues list, it seems to work fine with the Metal ANGLE backend as well.

@EvanCarroll
Copy link

EvanCarroll commented Apr 25, 2023

Just wanted to confirm the fix. I'm using an unmodified version of Debian testing and things work with OpenGL virtio-ramfb-gl Kudos.

@DragonSWDev
Copy link

I also can confirm fix. On UTM version 4.2.5 3D acceleration with GPU set to virtio-gpu-gl-pci works as expected on Fedora 38 guest. I'm using GNOME Wayland session and both Wayland and X11 applications are working without issues. I have ANGLE set to use OpenGL backend, I haven't tried Metal backend yet.

@archanox
Copy link

UTM is still on 4.1.6 in the Appstore, is there an issue with deployment there?

@thedustinmiller
Copy link

4.2.5 on MacBook air M2 has 3d acceleration working with my Arch install with KDE Plasma, both Wayland and X11.

@EvanCarroll
Copy link

UTM is still on 4.1.6 in the Appstore, is there an issue with deployment there?

New version in brew. Why let Apple do what the open source community does better.

@osy osy unpinned this issue Apr 25, 2023
@osy
Copy link
Contributor

osy commented Apr 25, 2023

I will close the issue since it seems like the main issues are resolved and we’re veering off topic. If any new graphics issues arise, we can open a new one.

@osy osy closed this as completed Apr 25, 2023
@archanox
Copy link

New version in brew. Why let Apple do what the open source community does better.

Because the appstore auto updates, I can support the project financially, and the app store is fine, it's just updates aren't getting pushed out by the project for whatever reason.

@osy
Copy link
Contributor

osy commented Apr 26, 2023

for whatever reason

Reason being that it’s been 24 hours (v4.2.4 was approved but I pulled it last second due to the Monterey mouse cursor problem).

@archanox
Copy link

As far as I’m aware, Zink isn’t available for macOS.

Did a quick google and found this https://www.phoronix.com/news/Mesa-22.0-Build-macOS-Zink

@osy
Copy link
Contributor

osy commented Apr 27, 2023

Yeah I know about the super experimental stuff. If you really believe the thing that nobody has used in production would work better than the thing Google is actively developing and distributing as part of Chrome, then please put in the effort to get it working and open a pull request and I’ll review it 🙂

@trevorstr
Copy link

I had the same problem: black screen upon installing Ubuntu Desktop 22.04 LTS Jammy Jellyfish on UTM 4.3.5.

Environment

  • MacBook M2 Pro CPU
  • 16GB RAM
  • MacOS Ventura 13.6
  • UTM 4.3.5 (installed via Homebrew)

Workaround

I changed the display adapter to virtio-ramfb, and it works alright. I can see the Ubuntu login screen and desktop now.

I wonder if there's a better user experience than requiring a Google search to use Ubuntu Desktop? If someone tries installing Ubuntu Desktop, should they be prompted to use a different display adapter?

@osy
Copy link
Contributor

osy commented Oct 15, 2023

There is no way for UTM to know that Mesa upstream went and broke some feature. By the way you're on the wrong issue, this is very old, you're looking at the new Mesa-breaking-all-vms issue here #5749

@juicejuice
Copy link

Just to note that whatever this is still seems to be occurring in August 2024. Yesterday, I downloaded UTM and pre-packaged Ubuntu 22.04. When I started the VM it went black so I googled and found this issue. The solution, of course, is to switch display adapter to virtio-ramfb.

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

No branches or pull requests