projectM-visualizer / projectm

projectM - Cross-platform Music Visualization Library. Open-source and Milkdrop-compatible.
https://discord.gg/mMrxAqaa3W
GNU Lesser General Public License v2.1
3.37k stars 375 forks source link

[APP BUG] projectM suspends when another application goes fullscreen #842

Closed sfjuocekr closed 1 month ago

sfjuocekr commented 1 month ago

Please confirm the following points:

Affected Application

projectM Standalone SDL2 Frontend (includes the Steam app)

Affected Version

4.1.0

Operating System

Linux (Desktop)

Additional Application Details

Using from AUR: projectm-sdl2-git

Type of Defect

Graphical issue (rendering glitches, black screen, heavy flickering)

Log Output

Nothing of value is shown in the log:

Events enabled: 1
Recording audio from device "MusicSink" (ID 6).
Opened audio recording device "MusicSink" (ID 6) with 2 channels at 44100 Hz.
Displaying preset: /usr/share/projectM/presets/cream-of-the-crop/Dancer/Hatches/suksma - thwomp murder laser.milk
Displaying preset: /usr/share/projectM/presets/cream-of-the-crop/Fractal/Core Tunnel/A Tribute to Martin - bombyx mori - Ft Flexi - AdamFX - StahlRegen - Krash - Rovastar -  Hd in Milk T.milk
Displaying preset: /usr/share/projectM/presets/cream-of-the-crop/Fractal/Lattice/ethical rotterdamasm.milk
Displaying preset: /usr/share/projectM/presets/cream-of-the-crop/Dancer/Wake/suksma - yin - 395 - Artificial Inspiration (brainstorming - outward) + martin + stahlregen - elephant mating nz+2.milk


### Describe the Issue

I used to have everything on X11 with the "older" 3.1.12 but recently switched to Wayland where this 3.x version started misbehaving (ignores CLI parameters) unless I use QT_QPA_PLATFORM=xcb but then it will just render a black screen and crash.

So I switched to the SDL2 build instead, which seems to work flawless besides one aspect... when I go fullscreen with for example a video playing with ffplay the visualization comes to a halt. Tabbing back to the visualization with the video still full screen will continue the visualization, so I assume the window somehow gets throttled/suspended when it goes in the background.

I have tried switching SDL_VIDEO_DRIVER, but this seems to be ignored.
kblaschke commented 1 month ago

From the application's side, I don't see much we could do here, since it seems to be the windowing system/Wayland performing the actual throttling, which is well outside the application's control.

One reason that might play into it and possibly also causes Qt to misbehave on Wayland is that Wayland solely uses EGL for rendering, while projectM and many other applications still use the classic GLX interface. Wayland might have some EGL-to-GLX bridge, but could possibly decide to throttle applications using GLX which aren't in focus to save some resources.

There might be a setting to control this, but since I've not migrated to Wayland for these compatibility reasons yet, I've not dug deeply into it.

I'll update this bug report if I can find something. Anyone else is also invited to give some advice here, e.g. users having more experience with Wayland.

sfjuocekr commented 1 month ago

This issue has some information: https://github.com/libsdl-org/SDL/pull/9345

sfjuocekr commented 1 month ago

I closed this because it seems to be an oversight in the Wayland protocol that is pending a fix.

sfjuocekr commented 1 month ago

And I want to add that anyone that runs into this issue can circumvent it by checking this box:

image