bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
36.28k stars 3.58k forks source link

On Steam Deck in gaming mode the screen does not update #15193

Open tad-lispy opened 2 months ago

tad-lispy commented 2 months ago

Bevy version

0.14.2

Relevant system information

$ cargo --version
cargo 1.80.1 (376290515 2024-07-16)
$ uname --all
Linux steamdeck 6.1.52-valve16-1-neptune-61 #1 SMP PREEMPT_DYNAMIC Tue, 06 Feb 2024 00:51:49 +0000 x86_64 GNU/Linux
AdapterInfo { name: "AMD Radeon Graphics (RADV VANGOGH)", vendor: 4098, device: 5173, device_type: IntegratedGpu, driver: "radv", driver_info: "Mesa 23.3.0-devel (git-4870e346ff)", backend: Vulkan }

What you did

MRE with some observation at https://gitlab.com/tad-lispy/bevy-0.14-steam-deck-no-refresh

What went wrong

The program should display a single green dot in the middle of the screen. The dot should slowly rotate around the X axis. This works as intended on my laptop (NixOS with Wayland) and on Steam Deck in desktop mode (SteamOS with X11). In gaming mode (Game Scope compositor?) it does not move at all, and about half of the times the dot does not even show on screen.

Looking at the logs I see that the systems are running (rotation is updated), but very rarely (few times per second at most).

Additional information

Discussion in General channel of Bevy Discord (with very helpful @alice-i-cecile and @Shatur).

Logs, workarounds, build instructions etc. in the readme of my MRE repository.

ldubos commented 2 months ago

I can confirm there’s an issue with SteamDeck. When running .add_systems(Update, || info!("Update"));, I encountered unexpected behavior, as shown in my video, the system is running very slowly, about once per second.

In my case, I used Steamworks to retrieve the friends list and display it in a TextBundle. However, sometimes nothing appears on the screen. I tried simplifying the setup with a basic TextBundle displaying "Hello World" (without Steamworks), but the problem persists. I often need to restart the app multiple times before anything renders correctly.

I also tested with and without wayland, but didn’t notice any difference.

Here’s my setup:

[target.x86_64-unknown-linux-gnu]
rustflags = [
  # SteamDeck uses Zen2 architecture (https://www.steamdeck.com/en/tech)
  "-Ctarget-cpu=znver2",
  "-Zshare-generics=y",
  "-Zthreads=8",
]

https://github.com/user-attachments/assets/28d199f3-1ad1-4107-82ea-a4ed6e4f89e4

ldubos commented 2 months ago

I tried to do a tracy capture but I was only able to capture the first milliseconds of the program after that the program froze, I also enabled the Steam performance overlay and it also froze so... I don't know what could generate this kind of issues, I checked on WGPU and Winit and I didn't found any issues related to this problem.

Shatur commented 2 months ago

It's strange my project runs fine on SteamDeck: https://github.com/projectharmonia/project_harmonia Maybe it's related to the configuration?

ldubos commented 1 month ago

It's strange my project runs fine on SteamDeck

On my side I have the same issue with your project. What is your config? What "procedure" do you use to build for SteamDeck?

I built it with WSL then used SteamOS Devkit to transfer the app.

$ rustc --version
rustc 1.81.0 (eeb90cda1 2024-09-04)

My SteamDeck:

Shatur commented 1 month ago

I compile the project on the SteamDeck inside Distrobox with ArchLinux. I have the latest firmware and the container also have all packages up to date.

Everything else is the same, including the Rust version and SteamDeck model. I run the project from the gaming mode.

robtfm commented 1 month ago

just wanted to confirm i see the same issue - 0.13 worked, 0.14 all good in desktop mode but in gaming mode my app is locked at just under 1fps and doesn't display properly.

not sure if anyone else has tried dissecting yet / has any further ideas?

alice-i-cecile commented 1 month ago

I guarantee this is due to the winit event loop rework done in #13366.

mmatvein commented 2 weeks ago

We're encountering this issue as well with Bevy 0.14.2 (and prior 0.14 versions as well). The interesting part is that we only just found out, as we've only been testing our game with the Steam Deck docked and connected to a TV. Seems like when the deck is connected to an external display things work fine. The game also runs fine on the Steam Deck in Desktop mode.

Additionally we've had to run the game in windowed mode to get it to run on the Steam Deck when connected to the external display. I don't know if it is at all related to this issue, though, because this was already the case pre-0.14.