Board index FlightGear Support Installation Linux

Pure Wayland installations possible?

Installing FlightGear, scenery, aircraft etc. on Linux systems like Ubuntu.

Pure Wayland installations possible?

Postby phlash » Tue Oct 04, 2022 11:19 pm

Hi folks,

A little background - I'm currently experimenting with a pure Wayland desktop (using sway with Xwayland disabled) on my Debian stable (11.5/bullseye) system (apparently I'm a masochist!). I have previously enjoyed my Flightgear via the AppImage binaries, however these have no support for Wayland in the pre-packaged/configured Qt backend (they only list 'xcb' drivers), and may not have support in the Openscenegraph libs either.. so my question:

1/ Can Flightgear run on a pure Wayland desktop at all (ie: are there any hard dependencies on X11?)
2/ What would I need to do / what would need to be built from source to make this happen?
3/ Has someone else already done this, if so are there .deb files available (because I'm lazy!)?
4/ Could the AppImage binaries be updated to include Wayland support 'out-of-the-box' (because that would be nice for many other Wayland users)?

too many questions - I know, sorry..

Cheers,
Phil.
phlash
 
Posts: 31
Joined: Thu Aug 04, 2022 8:54 pm
Location: Suffolk, UK
Version: 2020.3.19
OS: Debian 12

Re: Pure Wayland installations possible?

Postby erik » Wed Oct 05, 2022 8:12 am

Looking at the dependency tree FligthGear calls X11 directly at the moment:
Code: Select all
fgfs => /usr/local/bin/fgfs (interpreter => /lib64/ld-linux-x86-64.so.2)
    libX11.so.6 => /lib/x86_64-linux-gnu/libX11.so.6
        libxcb.so.1 => /lib/x86_64-linux-gnu/libxcb.so.1
            libXau.so.6 => /lib/x86_64-linux-gnu/libXau.so.6
            libXdmcp.so.6 => /lib/x86_64-linux-gnu/libXdmcp.so.6
                libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0
                    libmd.so.0 => /lib/x86_64-linux-gnu/libmd.so.0

So it requires extra attention to move X11 functions to Wayland equivalents.

Erik
Current: Parachutist, Paraglider, Pterosaur, Pilatus PC-9M and variants, ERCO Ercoupe, Fokker Dr.1, Fokker 50, Fokker 100
Less active: Cessna T-37, T-38, Santa Claus. Previous: General Dynamics F-16. Worked on: Wright Flyer
erik
 
Posts: 2245
Joined: Thu Nov 01, 2007 2:41 pm

Re: Pure Wayland installations possible?

Postby phlash » Wed Oct 05, 2022 1:15 pm

Thanks Erik, that's useful (and I should have thought of checking the deps on the AppImage binaries too), I would expect direct calls to be easily found in the source as these would have to have alternatives for Win32 and MacOS.. I'll have a rummage!
phlash
 
Posts: 31
Joined: Thu Aug 04, 2022 8:54 pm
Location: Suffolk, UK
Version: 2020.3.19
OS: Debian 12

Re: Pure Wayland installations possible?

Postby erik » Wed Oct 05, 2022 1:22 pm

I'm sure most (if not all) will be found not within SimGear but within Flighgears src/Main directory.

Erik
Current: Parachutist, Paraglider, Pterosaur, Pilatus PC-9M and variants, ERCO Ercoupe, Fokker Dr.1, Fokker 50, Fokker 100
Less active: Cessna T-37, T-38, Santa Claus. Previous: General Dynamics F-16. Worked on: Wright Flyer
erik
 
Posts: 2245
Joined: Thu Nov 01, 2007 2:41 pm

Re: Pure Wayland installations possible?

Postby phlash » Wed Oct 05, 2022 3:51 pm

Looks like I have found the info I need:

1/ Direct X11 calls are from the Nasal scripting clipboard (which has variants for X11,Win32,Cocoa & a no-UI fallback), everything else lives atop Openscenegraph or Qt5
2/ Openscenegraph /may/ support Wayland via it's Qt5 GraphicsContext, assuming it's built with Qt5 support enabled - sadly not true for the AppImage or the standard Debian package, BUT it can be extended /at run-time/ with new contexts :)
- so the build from source would be fgfs (to select appropriate options to avoid X11 clipboard, and ask for Wayland OSG backend), plus an OSG extension to provide a new GraphicsContext.
3/ No chance anyone has tried this - although the OpenMW (Morrowwind game engine) folks have wired up SDL2 to OSG in a similar way.
4/ I suspect a PR would be needed to get anything like this into core Flightgear.

Wish me luck if I try this!
phlash
 
Posts: 31
Joined: Thu Aug 04, 2022 8:54 pm
Location: Suffolk, UK
Version: 2020.3.19
OS: Debian 12

Re: Pure Wayland installations possible?

Postby TheEagle » Wed Oct 05, 2022 6:52 pm

phlash wrote in Wed Oct 05, 2022 3:51 pm:Wish me luck if I try this!

I do ! :) And don't hesitate to ask any code questions here - I'm not a C/C++ geek (although I know the basics), but the others will most certainly be able to help you in most cases ! :)
Cessna 210 (Wiki)
My other aircraft: my wiki profile !
Other: FGTools (GitHub)
World tour: View on SkyVector
Please consider donating $1 / €1 to help me finance a new camera !
User avatar
TheEagle
 
Posts: 3411
Joined: Sat May 01, 2021 3:27 pm
Location: France
Pronouns: You, he
Callsign: F-EAGLE
IRC name: none
Version: Git next
OS: Ubuntu Studio 22.04

Re: Pure Wayland installations possible?

Postby phlash » Tue Oct 11, 2022 7:25 pm

Progress! I have a working (ish) Wayland backend for Openscenegraph, currently missing all input stuff but I can view .osg files with a variant of osgviewer... seeing a cow(.osgt) has never made me so happy :)

Time to yank the fgfs source and get a build working..
phlash
 
Posts: 31
Joined: Thu Aug 04, 2022 8:54 pm
Location: Suffolk, UK
Version: 2020.3.19
OS: Debian 12

Re: Pure Wayland installations possible?

Postby phlash » Wed Oct 12, 2022 12:19 am

Fugly but...

Image
..the loading screen

Image
..the cockpit view, with broken menu position, no input and default time of day, so rather dark here.

This might just work :)
phlash
 
Posts: 31
Joined: Thu Aug 04, 2022 8:54 pm
Location: Suffolk, UK
Version: 2020.3.19
OS: Debian 12

Re: Pure Wayland installations possible?

Postby TheEagle » Wed Oct 12, 2022 1:38 am

Nice ! :) But … do you think running Wayland is really worth all the work ?
Cessna 210 (Wiki)
My other aircraft: my wiki profile !
Other: FGTools (GitHub)
World tour: View on SkyVector
Please consider donating $1 / €1 to help me finance a new camera !
User avatar
TheEagle
 
Posts: 3411
Joined: Sat May 01, 2021 3:27 pm
Location: France
Pronouns: You, he
Callsign: F-EAGLE
IRC name: none
Version: Git next
OS: Ubuntu Studio 22.04

Re: Pure Wayland installations possible?

Postby MariuszXC » Wed Oct 12, 2022 2:05 pm

Well, it seems that folks do not appreciate the beauty and flexibility of design of X protocol/architecture and Wayland is the future, for better or worse.
It will be interesting to see if there is any appreciable performance gain from going native.
@phlash: do you have any comparison benchmarks planned?
INOP
MariuszXC
 
Posts: 1061
Joined: Tue May 18, 2021 5:38 pm
Location: Europe
Callsign: SP-MRM
Version: 2020.4
OS: Ubuntu 16.04

Re: Pure Wayland installations possible?

Postby phlash » Fri Oct 14, 2022 8:42 am

@TheEagle - it seems the popular desktop distros are operating a Wayland-first approach, so ensuring FG 'just runs' on it should be useful? Personally I'm trying out Sway and really like it, so thought it might be interesting to dig in and try to get this working.

@MariusXC - I hadn't thought about benchmarking thus far, just getting it going first.. I wouldn't expect much difference as the underlying GL drivers & hardware etc. are all the same, it's really just the plumbing to get at them that's changing. That said I'll do some crude CPU load measurements while viewing the same replay on my previous Budgie/Xorg desktop and Sway/Wayland.

FWIW I have now mostly sorted out keyboard & mouse input such that the GUI overlay works (I also found another direct X dependency in Plib which calls glXGetCurrentContext - fixed by providing a dummy implementation in PUICamera.cxx!), some fiddling to get resizing/fullscreen working and debugging keyboard modifiers should make it playable.
phlash
 
Posts: 31
Joined: Thu Aug 04, 2022 8:54 pm
Location: Suffolk, UK
Version: 2020.3.19
OS: Debian 12

Re: Pure Wayland installations possible?

Postby phlash » Sun Oct 16, 2022 1:17 pm

I think I've reached alpha with this patch to the 'new version: 2020.3.15' commit under the 'release/2020.3' branch :D

https://www.ashbysoft.com/images/upload/flightgear.patch

Still struggling with keyboard modifiers (Ctrl is not working, Shift is ok(ish)), and occasionally the mouse seems to stop working on menus and rendered objects. I'll try some replay comparisons and look at frame rates and loading...

[edited to add] If anyone wants to build this - CMake options were to skip the Qt launcher (ENABLE_QT=NO), will now enable Wayland (ENABLE_WAYLAND=YES), provided you have the dependencies installed. When starting you MUST enable Wayland as the backend with the environment setting 'OSGWSI=Wayland' (now automatic), and of course choose aircraft, location etc. on the command line.
Last edited by phlash on Thu Oct 20, 2022 11:28 pm, edited 1 time in total.
phlash
 
Posts: 31
Joined: Thu Aug 04, 2022 8:54 pm
Location: Suffolk, UK
Version: 2020.3.19
OS: Debian 12

Re: Pure Wayland installations possible?

Postby erik » Sun Oct 16, 2022 2:40 pm

Nice, I think it would be a great addition once the patch is finished.

Erik
Current: Parachutist, Paraglider, Pterosaur, Pilatus PC-9M and variants, ERCO Ercoupe, Fokker Dr.1, Fokker 50, Fokker 100
Less active: Cessna T-37, T-38, Santa Claus. Previous: General Dynamics F-16. Worked on: Wright Flyer
erik
 
Posts: 2245
Joined: Thu Nov 01, 2007 2:41 pm

Re: Pure Wayland installations possible?

Postby wkitty42 » Sun Oct 16, 2022 6:57 pm

would it be better to work on this with NEXT? then it can maybe be cherry picked back to 2020.3? i guess the cherry pick could go the other way, too, but i've never done that...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9148
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: Pure Wayland installations possible?

Postby erik » Mon Oct 17, 2022 8:07 am

Yes, ideally these types of development should be done against 'next'. But in this case I think the patch would apply rather cleanly.

Erik
Current: Parachutist, Paraglider, Pterosaur, Pilatus PC-9M and variants, ERCO Ercoupe, Fokker Dr.1, Fokker 50, Fokker 100
Less active: Cessna T-37, T-38, Santa Claus. Previous: General Dynamics F-16. Worked on: Wright Flyer
erik
 
Posts: 2245
Joined: Thu Nov 01, 2007 2:41 pm

Next

Return to Linux

Who is online

Users browsing this forum: No registered users and 2 guests

cron