Microsoft begins testing support for running Linux GUI applications on Windows



Microsoft has started testing the launch of Linux GUI applications on Windows. This is implemented on the basis of the WSL2 (Windows Subsystem for Linux) subsystem, which the company has been developing for many months. It is noted that applications are fully integrated with the Windows desktop, including placing shortcuts in the Start menu, playing sound, recording from a microphone, hardware acceleration OpenGL. The display of information about software in the taskbar is also implemented, you can switch between programs by Alt + Tab, data between Linux and Windows applications can be copied using the clipboard.



The Linux application interface is displayed on the main Windows desktop using the RAIL-Shell composite manager. It uses the Wayland protocol and is based on the Weston codebase. The output is implemented through the RDP-RAIL (RDP Remote Application Integrated Locally) backend, which does not render the desktop, but instead redirects individual surfaces over the RDP RAIL channel to be displayed on the main Windows desktop. X11 applications run using XWayland.



Other details



The company uses an interesting way to output sound - using the PulseAudio server. The server interacts with the operating system via the RDP protocol (the rdp-sink plugin is used for sound output, and rdp-source for input). This server and XWayland are housed in a generic mini-distribution WSLGd. It includes components for abstraction of both graphic and sound subsystems.



All this is based on the CBL-Mariner Linux distribution, which Microsoft also uses - in its cloud infrastructure. The mini-distribution is launched using virtualization mechanisms. At the same time, shared access between the Linux guest environment and the Windows host is implemented using virtio-fs.



The developers chose FreeRDP as the RDP server that runs in the WSLGd Linux environment. For the same task, Widnows OS uses mstsc. The WSLDVCPlugin handler is used to identify the available graphical Linux applications and display them in the Windows menu. It allows you to interact with Linux distributions in a WLS2 environment by providing sockets that handle Wayland, X11 and PulseAudio requests. The bindings prepared for WSLGd are licensed under the MIT license.



How do I get access to new features?



To do this, you need to install Windows 10 Insider Preview at least version 21362. The developers promise that in the near future, regular editions of Windows will be enough to install WSLGd, and the user does not need to participate in the Insider Preview program.





Installs WSLGd using the "wsl --install" command, for example, for Ubuntu - "wsl --install -d Ubuntu". In the case of existing WSL2 environments, WSLGd is installed via the "wsl --update" command (only WSL2 environments that use the Linux kernel are supported, not call translation). Graphical applications are installed through the regular package manager of the distribution kit.



WSLGd only supports 2D graphics. If you need 3D graphics based on OpenGL, a different mechanism is used - the virtual GPU (vGPU). Drivers for it are provided in three versions - for AMD , Intel and NVIDIA chips ... Working with graphics is performed by providing a layer with the implementation of OpenGL on top of DirectX 12. The layer is designed in the form of the d3d12 driver, which was included in the main part of Mesa 21.0, and is being developed jointly with Collabora.



On Linux, the virtual GPU is implemented on the / dev / dxg device with services that mimic the Windows Display Driver Model (WDDM) D3DKMT of the Windows kernel. In this system, the driver establishes a connection to the physical video chip via the VM bus. Linux applications have the same level of GPU access as native Windows applications, there is no resource sharing between Windows and Linux.



During performance testing of a Surface Book Gen3-based system with an Intel GPU, it turned out that the Geeks3D GpuTest benchmark shows 19 FPS in Windows, 18 FPS in Linux. In Mesa, with software rendering - only 1 FPS.



A bit of background



WSL2 became available to Windows users on August 20, 2020 - that's when Microsoft released the cumulative update KB4566116.





After installing it, users of Windows 10, version 1903 and version 1909 began testing WSL2, and the reviews were mostly positive. Until August 20, only WSL of the first version was available, and only in Windows 10 version 2004.





As for the first version of WSL, work on it began several years ago. The official announcement about the subsystem was made at the Microsoft Build 2016 conference. The announcement was short - then they talked about the capabilities of WSL within a couple of minutes. But he caused such a stir and an influx of traffic to the page with the announcement that the organizers of the conference even suspected that someone had organized a DDoS attack.



Since then, WSL has evolved a lot, and the subsystem continues to evolve now.






All Articles