Xpra-org / xpra

Persistent remote applications for X11; screen sharing for X11, MacOS and MSWindows.
https://xpra.org/
GNU General Public License v2.0
1.91k stars 164 forks source link

late subsystem initialization #4315

Open totaam opened 1 month ago

totaam commented 1 month ago

There's only so much we can do when trying to start the client faster (#2347). Some things take time if you want to do them properly, ie: codecs testing and validation, especially gstreamer. Others require disk I/O, ie: loading menu icons, etc These delays are more noticeable now that the pyqt6 client connects instantly (albeit without any features!): #4314

It should be possible to delay some of these things and update the server once we have the results (ie: list of codecs). Other things we can just start later (ie: audio) Some things can run in parallel with connecting to the server and are only really needed later (ie: opengl probing is only needed when we show a window, and not all windows)

totaam commented 1 month ago

Log sample showing where most of the time is being spent:

2024-08-03 16:59:02,077 debug enabled for ['xpra.codecs.loader', 'codec', 'loader']
2024-08-03 16:59:02,384 window icon overlay: /usr/share/xpra/icons/xpra.png
splash: handle_stdin_line('0:Xpra Client v6.2.0\n')
2024-08-03 16:59:02,537 overlay_image=<PIL.PngImagePlugin.PngImageFile image mode=RGBA size=48x48 at 0x7FD2E4D673E0>
2024-08-03 16:59:02,544 query_audio() command=['/usr/bin/python3.12', '/usr/bin/xpra', '--windows=no', '_audio_query'], env={'XPRA_OPE
2024-08-03 16:59:02,662 debug enabled for ['xpra.codecs.loader', 'codec', 'loader']
2024-08-03 16:59:02,783 query_audio() process returned 0 
2024-08-03 16:59:02,815 init: <class 'xpra.client.mixins.encodings.Encodings'>
2024-08-03 16:59:02,891 codec module csc_cython.converter is installed
2024-08-03 16:59:02,961 decoder: gstreamer (5, 0), <function init_module at 0x7fd2dc1bf1a0>, <function cleanup_module at 0x7fd2dc1bf240>
2024-08-03 16:59:03,201 VideoHelper.init() done
2024-08-03 16:59:03,219 query_xkbmap() query_struct={'rules': 'evdev', 'model': 'pc105+inet', 'layout': 'gb,gb', 'variant': '', 'layouts': '[]', 'variants': '[]'}
2024-08-03 16:59:03,294 update() modifier_map={'shift': 1, 'lock': 2, 'control': 4, 'mod1': 8, 'mod2': 16, 'mod3': 32, 'mod4': 64, 'mod5': 128, 'scroll': 0, 'num': 0, 'meta': 0, 'super': 0, 'hyper': 0, 'alt': 0}, old hash=None, new hash=gb,gb/2f14a8292473a0aa3d41afbdba2b5218af3e31a95d3d77fefebcfd4d8bdf26e0
2024-08-03 16:59:03,294 init_opengl(force:native)
2024-08-03 16:59:03,579 OpenGL: enabled=True, texture-size-limit=16384, max-window-size=(32767, 32767)
2024-08-03 16:59:03,647 video_decodings=('h264', 'vp8', 'vp9', 'av1')
2024-08-03 16:59:03,650 send_hello() packet
2024-08-03 16:59:03,862 processing hello from server: typedict({'digest': ('xor', 'hmac+sha512', 'hmac ..  'encoding': 'auto', 'auto_refresh_delay': 156})
2024-08-03 16:59:04,104 setup_window() position=(0, 0), set_initial_position=True, OR=False, decorated=True