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

Screen sleep isn't suppressed with the suspend screensaver option turned on #58

Open
gmdvieira opened this issue May 10, 2018 · 22 comments · Fixed by #61
Open

Screen sleep isn't suppressed with the suspend screensaver option turned on #58

gmdvieira opened this issue May 10, 2018 · 22 comments · Fixed by #61

Comments

@gmdvieira
Copy link
Contributor

I don't have a screen saver, but my screen turns off after some time of inactivity. When running Retroarch, joypad input doesn't count as activity and the suspend screensaver option does not keep the screen from sleeping. After some research, I believe this option (suspend screensaver) should suppress screen sleep in Linux and that it is Dbus related:
libretro/RetroArch#2026
libretro/RetroArch@05df632

Maybe the Retroarch flatpak doesn't support the correct Dbus interface?

@RobLoach
Copy link
Collaborator

Does this happen on the master branch? Without using Flatpak?

@TingPing
Copy link
Member

Just add --talk-name=org.freedesktop.ScreenSaver

@gmdvieira
Copy link
Contributor Author

I've only tested using Flatpak.

--talk-name=org.freedesktop.ScreenSaver when running doesn't solve the problem.

@TingPing
Copy link
Member

TingPing commented May 11, 2018

Can you post the output of:

flatpak run --talk-name=org.freedesktop.ScreenSaver --log-session-bus org.libretro.RetroArch

(Up to the point where it should be inhibiting)

@gmdvieira
Copy link
Contributor Author

Weird, there is no output at all on the terminal. Should I look somewhere alse?

@RobLoach
Copy link
Collaborator

--verbose will force stdout

@TingPing
Copy link
Member

flatpak itself should absolutely be printing output...

@gmdvieira
Copy link
Contributor Author

$ flatpak run --talk-name=org.freedesktop.ScreenSaver --log-session-bus --verbose org.libretro.RetroArch
F: No installations directory in /etc/flatpak/installations.d. Skipping
F: Opening user flatpak installation at path /home/gustavo/.local/share/flatpak
F: Opening system flatpak installation at path /var/lib/flatpak
F: Opening user flatpak installation at path /home/gustavo/.local/share/flatpak
F: Opening system flatpak installation at path /var/lib/flatpak
F: Allowing host-fs access
F: Allowing x11 access
F: Allowing wayland access
F: Allowing pulseaudio access

I started Retroarch, started some content and did nothing until the screen faded.

This doesn't seem very helpful. Strange, I remember that when I first tried Retroarch flatpak a couple of weeks ago it printed more when started on the command line. I updated recently. Is there a way to downgrade to a previous flatpak release?

@RobLoach
Copy link
Collaborator

Is there a way to downgrade to a previous flatpak release?

Would like to fix this issue before we come to that... Does this happen on RetroArch 1.7.3 without Flatpak for you? There's been some updates in the gfx drivers.

@gmdvieira
Copy link
Contributor Author

Well, I'm relying on Flatpak to get RetroArch effortlessly. :)

But, I can recognize when it's time to help nice people trying to help you. I'll try to make a local build this weekend and report my findings.

By the way, I've experienced a framerate reduction such that I can't really make any core run smoothly. This was running smoothly (after setting the framerate) in 1.7.2. I will test the local build and file an issue if it appears to be Flatpak related.

@RobLoach
Copy link
Collaborator

Wouldn't be one of these, right? https://github.com/flathub/org.libretro.RetroArch/pull/54/files

@TingPing
Copy link
Member

--socket=system-bus very well could be relevant. but their flatpak apparently is broken and doesn't print logs, so we can't track it down...

@TingPing
Copy link
Member

TingPing commented May 12, 2018

(Actually I can confirm retroarch breaks flatpak logging here too.. must be doing something naughty to stdout/stderr)

@gmdvieira
Copy link
Contributor Author

Ok, I managed to compile 1.7.3 (and master, and 1.7.2) and the problem isn't related to Flatpak. The culprit appears to be Wayland support. Also the framerate problem seems to be Wayland related. If I compile without Wayland support both problems disappear. I will create bug reports directly to RetroArch.

@gmdvieira
Copy link
Contributor Author

gmdvieira commented May 27, 2018

Well, this issue is more subtle than it appears. We have actually two different bugs that confused me.

The first is that (apparently) Suspend screensaver doesn't work under Wayland. This isn't Flatpak related and I've reported it here: libretro/RetroArch#6830

However, when I've tried to run the Flatpak RetroArch under X the Suspend screensaver did not work, while it worked in a version I compiled and run under X. Luckily I managed to get logs working (the -v should be last!) and look what I've found!

[INFO] [Font]: Using font rendering backend: bitmap.
[INFO] [X11]: Suspending screensaver (X11, xdg-screensaver).
[INFO] [autoconf]: selected configuration: /home/jogos/.var/app/org.libretro.RetroArch/config/retroarch/autoconfig/sdl2/X360 Wireless Controller.cfg
sh: xdg-screensaver: command not found
[WARN] Could not suspend screen saver.
[INFO] [Video]: Found display server: x11

The problem, at least under X, seems to be Flatpak related after all. There is a binary missing. Reopening the bug.

@gmdvieira gmdvieira reopened this May 27, 2018
@gmdvieira
Copy link
Contributor Author

The plot thickens! I discovered something interesting peeking at the code: xdg-screensaver is a fallback, the primary way to inhibit the screensaver is Dbus. The default RetroArch build options have Dbus support disabled, and so did my own builds. If I enable Dbus support and recompile I get (under X):

[INFO] [Font]: Using font rendering backend: bitmap.
[INFO] [DBus]: Suspended screensaver via DBus.
[INFO] [Video]: Found display server: x11

It works perfectly. I'm not sure, but it appears that the Flatpak builds use the default configuration, then Dbus is disabled. Maybe it is better for the Flatpak build to enable Dbus instead of trying to add xdg-screensaver.

@gmdvieira
Copy link
Contributor Author

Bug libretro/RetroArch#6830 has been closed. Wayland support for suppressing the screensaver is Dbus only. So, I suppose the Flatpak build should support Dbus and handle both X11 and Wayland.

@dmatavel
Copy link

dmatavel commented Jan 7, 2024

It's happening to me with RetroArch 1.16.0 Flatpak on Ubuntu 22.04.

Screenshot from 2024-01-07 16-01-44

@RobLoach RobLoach reopened this Jan 7, 2024
@dbnicholson
Copy link
Member

I'm pretty sure this is libretro/RetroArch#15856, which isn't in released yet. What happens is that on wayland there are 2 ways to inhibit the screensaver:

  1. The preferred way is the Wayland zwp_idle_inhibit_manager_v1 protocol. The compositor uses the DBus org.freedesktop.ScreenSaver interface to inhibit the screensaver, but this is better since the compositor knows if the app is active.
  2. Since that's an unstable Wayland protocol, not all compositors support it. For example, GNOME's compositor mutter just recently merged support, so it won't be available until GNOME 45. That's likely why Ubuntu 22.04 is affected. As a fallback, RetroArch now uses the DBus method directly whenever it's started. This is worse since retroarch doesn't know if it's active or not so it inhibits all the time, but it's better than nothing. Unfortunately, the Wayland backend doesn't have that fix in 1.16.0.3, which the flatpak is currently using.

You can run retroarch with --verbose (like flatpak run org.libretro.RetroArch --verbose) and (if you have the screensaver inhibiting configured on), you'll see the following message:

[INFO] [DBus]: Suspended screensaver via DBus.

I can prep a PR to backport libretro/RetroArch@e7a10b2 until there's another release.

@dbnicholson
Copy link
Member

BTW, if the compositor doesn't support the Wayland protocol like mutter before GNOME 45, you'll see this in the verbose messages:

[INFO] [Wayland]: Compositor doesn't support zwp_idle_inhibit_manager_v1 protocol

@RobLoach
Copy link
Collaborator

RobLoach commented Jan 14, 2024

Thanks for the investigation. Had pushed a config to disable this until it's fixed, which we can revert once it's up. As for the PR that's not released yet, RetroArch 1.17 is coming out within the next couple weeks, so hopefully the release with the DBUS fix solves this 👍 #274

@dbnicholson
Copy link
Member

Just to add one more comment. xdg-screensaver is in use as the fallback from DBus org.freedesktop.ScreenSaver on X11. It comes from xdg-utils, which is a suite of scripts providing pretty good compatibility across desktop environments. Unfortunately, the suspend action relies on accessing X11 and DBus via perl.

So, while it would be pretty easy to bundle the scripts, it would require also bundling a few perl libraries to actually work correctly. IMO, post-1.17 it would be best to just assume that the environment supports the org.freedesktop.ScreenSaver interface and ignore the xdg-screensaver fallback as unsupported or maybe a wishlist task. Otherwise, I'd probably push to get xdg-utils included in the FDO runtime.

To sum up, the post-1.17 suppress screensaver support would be:

  • Wayland - The compositor supports the zwp_idle_inhibit_manager_v1 protocol or the DE supports the org.freedesktop.ScreenSaver DBus interface.
  • X11 - The DE supports the org.freedesktop.ScreenSaver DBus interface.

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 a pull request may close this issue.

5 participants