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

Enable wayland by default #4106

Open
kobutri opened this issue Mar 4, 2022 · 14 comments · May be fixed by #10792
Open

Enable wayland by default #4106

kobutri opened this issue Mar 4, 2022 · 14 comments · May be fixed by #10792
Labels
C-Usability A simple quality-of-life change that makes Bevy easier to use O-Linux Specific to the Linux desktop operating system

Comments

@kobutri
Copy link

kobutri commented Mar 4, 2022

What problem does this solve or what need does it fill?

Without enabling wayland bevy fails on systems that support wayland instead of falling back to x11, supported by xwayland.
This is because wgpu won't support x11 windows, when wayland is available on the system.

What solution would you like?

simply add "wayland" to the default features list.

What alternative(s) have you considered?

You can of course enable it manually, but many will forget and simply assume that wayland will be supported via xwayland.

@kobutri kobutri added C-Enhancement A new feature S-Needs-Triage This issue needs to be labelled labels Mar 4, 2022
@alice-i-cecile alice-i-cecile added C-Usability A simple quality-of-life change that makes Bevy easier to use O-Linux Specific to the Linux desktop operating system and removed C-Enhancement A new feature S-Needs-Triage This issue needs to be labelled labels Mar 4, 2022
@bjorn3
Copy link
Contributor

bjorn3 commented Mar 4, 2022

It may also be nice to default to X11 (through Xwayland) on GNOME even when wayland is supported as GNOME refuses to properly implement some parts of wayland. For example they don't support server side decorations, so winit has to draw a rather ugly title bar itself instead.

@kobutri
Copy link
Author

kobutri commented Mar 4, 2022

That would be a bad idea, because wgpu's gles backend will always use wayland when possible.
There is some discussion in winit and smithay_client_toolkit about adding libdecor support, for wayland, but for now we have to live with not the prettiest solution.

@bjorn3
Copy link
Contributor

bjorn3 commented Mar 4, 2022

That would be a bad idea, because wgpu's gles backend will always use wayland when possible.

Then that is already a problem when wayland support is entirely disabled in winit. gfx-rs has logic to recreate the egl context when creating a surface for a different wayland window. I feel like this logic could be extended to recreating the egl context when creating a surface for an xcb or xlib window.

@heavyrain266
Copy link

GNOME will never add SSD because they asume that everyone uses GTK and prefered to implement titlebars with additional buttons, menus etc. as CSD thing...

About libdecor, I found out it as kind of library which isn't FFI friendly at all and getting it stabilized in SCTK may take months.

@mockersf
Copy link
Member

mockersf commented Mar 5, 2022

What's the impact of enabling Wayland when running somewhere it's not available? Longer build times? Larger binaries?

@kirusfg
Copy link
Contributor

kirusfg commented Mar 7, 2022

Regarding the topic of SSD in Gtk: I have stumbled upon this issue in a Wayland compositor and there is a PR to fix this issue in Gtk by enabling optional SSD (judging from the description, that is what it does; correct me if I am wrong).

Might be of interest to you @heavyrain266.

@heavyrain266
Copy link

Regarding the topic of SSD in Gtk: I have stumbled upon this issue in a Wayland compositor and there is a PR to fix this issue in Gtk by enabling optional SSD (judging from the description, that is what it does; correct me if I am wrong).

Might be of interest to you @heavyrain266.

That doesn't fix absence of SSD in Mutter itself (GNOME's compositor) but adds option that you can disable GTK CSD in your Compositor to use your own SSD implementation.

@mcobzarenco
Copy link
Contributor

What alternative(s) have you considered?
You can of course enable it manually, but many will forget and simply assume that wayland will be supported via xwayland.

For GNOME in Ubuntu, that would mean having to manually disable it to continue to use x11 (as this comment notes)?

@kobutri
Copy link
Author

kobutri commented Mar 18, 2022

For GNOME in Ubuntu, that would mean having to manually disable it to continue to use x11 (as this comment notes)?

XWayland is currently broken for wgpu with gles as it is will create an Instance that is only compatible with wayland if wayland is available.

@keis
Copy link

keis commented Aug 7, 2022

Was scratching my head for a long while trying to figure out why the program was not exiting after closing the window. Enabling the wayland backend to stop relying to xwayland fixed the issue. Brief testing revealed no other issues.

@orowith2os
Copy link

For example they don't support server side decorations, so winit has to draw a rather ugly title bar itself instead.

There's nothing improper about this. It's perfectly valid in the spec to not support SSDs, and in some cases, expected, even. Plus, now we have libdecor and adwaita-sctk. There's not much need for SSDs, as now we can still get a similar end result.

In the process, this can make the creation of a compositor vastly simpler.

@Friz64
Copy link
Contributor

Friz64 commented Nov 28, 2023

image

I have worked hard on adding window shadows to sctk-adwaita, so the window decorations will, once this work is released and the dependencies are updated, fit right in on the GNOME desktop.

I can't live without wayland these days. The input-lag/latency is much lower and resizing windows is smooth as butter, compared to the stuttery mess that is X11, especially on high refresh rate screens.

@pkupper
Copy link
Contributor

pkupper commented Nov 28, 2023

Another reason for wayland by default would be proper fractional scaling support. On my system (scale factor 1.5) applications running via XWayland applications are blurry due to being upscaled.

@aMyTimed aMyTimed linked a pull request Nov 29, 2023 that will close this issue
@Friz64
Copy link
Contributor

Friz64 commented Nov 30, 2023

What's the impact of enabling Wayland when running somewhere it's not available? Longer build times? Larger binaries?

About a 5% difference in compile time. This is 33.4s -> 35.2s on my beefy Ryzen 9 7900X machine, as shown below. Of course, on slower computers, this will be more noticeable.

$ hyperfine --prepare 'cargo clean' 'cargo build --release --example 3d_scene' 'cargo build --release --example 3d_scene --features wayland'
Benchmark 1: cargo build --release --example 3d_scene
  Time (mean ± σ):     33.408 s ±  0.281 s    [User: 646.068 s, System: 20.888 s]
  Range (min … max):   33.037 s … 33.850 s    10 runs
 
Benchmark 2: cargo build --release --example 3d_scene --features wayland
  Time (mean ± σ):     35.205 s ±  0.157 s    [User: 705.365 s, System: 24.624 s]
  Range (min … max):   34.995 s … 35.429 s    10 runs
 
Summary
  cargo build --release --example 3d_scene ran
    1.05 ± 0.01 times faster than cargo build --release --example 3d_scene --features wayland

The binary size for the 3d_scene example went from 61M to 64M, which is also about a 5% increase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Usability A simple quality-of-life change that makes Bevy easier to use O-Linux Specific to the Linux desktop operating system
Projects
None yet
Development

Successfully merging a pull request may close this issue.