Microsoft began testing support for running Linux GUI applications on Windows

Microsoft has announced the start of testing the ability to run Linux applications with a graphical interface in environments based on the WSL2 (Windows Subsystem for Linux) subsystem, designed to run Linux executable files on Windows. Applications are fully integrated with the main Windows desktop, including support for placing shortcuts in the Start menu, playing sound, recording from a microphone, OpenGL hardware acceleration, displaying information about programs in the taskbar, switching between programs with Alt-Tab, copying data between Windows - and Linux-programs through the clipboard.

Microsoft began testing support for running Linux GUI applications on Windows

To organize the output of the Linux application interface to the main Windows desktop, the RAIL-Shell composite manager developed by Microsoft is used, which uses the Wayland protocol and is based on the Weston code base. The output is carried out using the RDP-RAIL (RDP Remote Application Integrated Locally) backend, which differs from the RDP backend previously available in Weston in that the composite manager does not draw the desktop itself, but redirects individual surfaces (wl_surface) via the RDP RAIL channel for display on the main Windows desktop. To run X11 applications, XWayland is used.

Microsoft began testing support for running Linux GUI applications on Windows

Audio output is organized using the PulseAudio server, which also interacts with Windows using the RDP protocol (the rdp-sink plugin is used for audio output, and rdp-source is used for input). Composite Server, XWayland, and PulseAudio are packaged as a universal WSLGd mini-distribution that includes components for abstracting graphics and audio subsystems and is based on the CBL-Mariner Linux distribution also used in the Microsoft cloud infrastructure. WSLGd runs using virtualization mechanisms, and virtio-fs is used for sharing between the Linux guest and the Windows host.

FreeRDP is used as the RDP server running in the WSLGd Linux environment, and mstsc is the RDP client on the Windows side. To determine the available graphical Linux applications and display them in the Windows menu, a WSLDVCPlugin handler has been prepared. With common Linux distributions installed in a WSL2 environment, such as Ubuntu, Debian, and CenOS, the set of components running in WSLGd interacts by providing sockets that handle requests over the Wayland, X11, and PulseAudio protocols. WSLGd-prepared bindings are distributed under the MIT license.

Installing WSLGd requires at least Windows 10 Insider Preview version 21362. Going forward, WSLGd will be available for regular editions of Windows without the need to participate in the Insider Preview program. WSLGd is installed by running a typical wsl --install command, for example, for Ubuntu - "wsl --install -d Ubuntu". For existing WSL2 environments, installing WSLGd is done via the "wsl --update" command (only WSL2 environments that use the Linux kernel, not call translation, are supported). Graphical applications are installed through the regular package manager of the distribution.

WSLGd only provides mechanisms for rendering 2D graphics, and to accelerate 3D graphics based on OpenGL, distributions installed in WSL2 suggest using a virtual GPU (vGPU). vGPU drivers for WSL are provided for AMD, Intel, and NVIDIA chips. Graphics acceleration is provided through the provision of a layer with the implementation of OpenGL over DirectX 12. The layer is designed as the d3d12 driver, which is included in the main composition of Mesa 21.0 and developed jointly with Collabora.

The virtual GPU is implemented in Linux using the /dev/dxg device with services that mimic the WDDM (Windows Display Driver Model) D3DKMT of the Windows kernel. The driver establishes a connection to the physical GPU using the VM bus. Linux applications have the same level of GPU access as native Windows applications, without the use of resource sharing between Windows and Linux. Performance testing on a Surface Book Gen3 device with an Intel GPU showed that in a native Win32 environment, the Geeks3D GpuTest demonstrates 19 FPS, in a Linux environment with a vGPU - 18 FPS, and with software rendering in Mesa - 1 FPS.



Source: opennet.ru

Add a comment