francescomecca.eu/output/blog/2024/2/28/three-years-later/index.md
Francesco Mecca 6acba75cd5 wine article
2024-02-28 14:38:55 +01:00

11 KiB

Playing videogames with WINE on Gentoo

One of my new year's resolution are related to playing videogames on GNU/Linux rather than resorting to dual booting as I did for the last 15 years. This blogpost aims to be a continuosly updated guide to my journey in having a proper gaming setup on my Gentoo workstation. My main resources are the Gentoo wiki and the Arch Wiki.

These objectives should be clear:

  • I will not use steam: I only buy from GOG or use CDs
  • I want to use one of my controllers for games that need it
  • use as much software from the Gentoo repos as possible. This means avoiding Bottles and Lutris

Hardware

user ~> sudo inxi -AGSC
System:
  Host: ____ Kernel: 6.1.69-gentoo-dist arch: x86_64 bits: 64 Desktop: spectrwm
    Distro: Gentoo Base System release 2.14
CPU:
  Info: 6-core model: AMD Ryzen 5 2600 bits: 64 type: MT MCP cache: L2: 3 MiB
  Speed (MHz): avg: 1858 min/max: 1550/3400 cores: 1: 3400 2: 1550 3: 1550
    4: 1550 5: 1550 6: 1550 7: 1550 8: 1550 9: 3400 10: 1550 11: 1550 12: 1550
Graphics:
  Device-1: AMD Navi 22 [Radeon RX 6700/6700 XT/6750 XT / 6800M/6850M XT]
    driver: amdgpu v: kernel
  Device-2: Logitech C920 HD Pro Webcam driver: usbfs type: USB
  Display: server: X.org v: 1.21.1.11 driver: X: loaded: amdgpu
    unloaded: modesetting,radeon dri: radeonsi gpu: amdgpu
    resolution: 1920x1200~60Hz
  API: EGL v: 1.5 drivers: radeonsi,swrast
    platforms: gbm,x11,surfaceless,device
  API: OpenGL v: 4.6 vendor: amd mesa v: 23.3.5 renderer: AMD Radeon RX
    6750 XT (radeonsi navi22 LLVM 17.0.6 DRM 3.49 6.1.69-gentoo-dist)
  API: Vulkan v: 1.3.275 drivers: N/A surfaces: xcb,xlib
Audio:
  Device-1: AMD Navi 21/23 HDMI/DP Audio driver: snd_hda_intel
  Device-2: AMD Family 17h HD Audio driver: snd_hda_intel
  Device-5: Focusrite-Novation Focusrite Scarlett 2i2 driver: snd-usb-audio
    type: USB
  API: ALSA v: k6.1.69-gentoo-dist status: kernel-api
  Server-1: PulseAudio v: 16.1 status: active (root, process)
USB:
  Device-1: 1-4:2 info: splitkb.com Kyria rev2 type: keyboard,HID rev: 2.0
  Device-2: 1-7:4 info: Microsoft Xbox360 Controller type: <vendor specific>
    rev: 2.0
  Device-3: 3-2:3 info: Focusrite-Novation Focusrite Scarlett 2i2
    type: audio rev: 2.0
  Device-4: 3-4:6 info: ThrustMaster XB1 Classic Controller
    type: <vendor specific> rev: 2.0

Drivers

For the kernel, I am using the gentoo-kernel seed.

For the GPU setup you need:

user ~> lspci -k | grep -A 3 -E "(VGA|3D)"
08:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Navi 22 [Radeon RX 6700/6700 XT/6750 XT / 6800M/6850M XT] (rev c0)
	Subsystem: Tul Corporation / PowerColor Navi 22 [Radeon RX 6700/6700 XT/6750 XT / 6800M/6850M XT]
	Kernel driver in use: amdgpu
	Kernel modules: amdgpu
user ~> glxinfo -B
name of display: :0
display: :0  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: AMD (0x1002)
    Device: AMD Radeon RX 6750 XT (radeonsi, navi22, LLVM 17.0.6, DRM 3.49, 6.1.69-gentoo-dist) (0x73df)
    Version: 23.3.5
    Accelerated: yes
    Video memory: 12288MB
    Unified memory: no
    Preferred profile: core (0x1)
    Max core profile version: 4.6
    Max compat profile version: 4.6
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.2
Memory info (GL_ATI_meminfo):
    VBO free memory - total: 11874 MB, largest block: 11874 MB
    VBO free aux. memory - total: 32064 MB, largest block: 32064 MB
    Texture free memory - total: 11874 MB, largest block: 11874 MB
    Texture free aux. memory - total: 32064 MB, largest block: 32064 MB
    Renderbuffer free memory - total: 11874 MB, largest block: 11874 MB
    Renderbuffer free aux. memory - total: 32064 MB, largest block: 32064 MB
Memory info (GL_NVX_gpu_memory_info):
    Dedicated video memory: 12288 MB
    Total available memory: 44400 MB
    Currently available dedicated video memory: 11874 MB
OpenGL vendor string: AMD
OpenGL renderer string: AMD Radeon RX 6750 XT (radeonsi, navi22, LLVM 17.0.6, DRM 3.49, 6.1.69-gentoo-dist)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 23.3.5
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 4.6 (Compatibility Profile) Mesa 23.3.5
OpenGL shading language version string: 4.60
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile

OpenGL ES profile version string: OpenGL ES 3.2 Mesa 23.3.5
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
user ~> vulkaninfo --summary 
ac_compute_device_uuid's output is based on invalid pci bus info.
==========
VULKANINFO
==========

Vulkan Instance Version: 1.3.275


Instance Extensions: count = 22
-------------------------------
VK_EXT_acquire_drm_display             : extension revision 1
VK_EXT_acquire_xlib_display            : extension revision 1
VK_EXT_debug_report                    : extension revision 10
VK_EXT_debug_utils                     : extension revision 2
VK_EXT_direct_mode_display             : extension revision 1
VK_EXT_display_surface_counter         : extension revision 1
VK_EXT_surface_maintenance1            : extension revision 1
VK_EXT_swapchain_colorspace            : extension revision 4
VK_KHR_device_group_creation           : extension revision 1
VK_KHR_display                         : extension revision 23
VK_KHR_external_fence_capabilities     : extension revision 1
VK_KHR_external_memory_capabilities    : extension revision 1
VK_KHR_external_semaphore_capabilities : extension revision 1
VK_KHR_get_display_properties2         : extension revision 1
VK_KHR_get_physical_device_properties2 : extension revision 2
VK_KHR_get_surface_capabilities2       : extension revision 1
VK_KHR_portability_enumeration         : extension revision 1
VK_KHR_surface                         : extension revision 25
VK_KHR_surface_protected_capabilities  : extension revision 1
VK_KHR_xcb_surface                     : extension revision 6
VK_KHR_xlib_surface                    : extension revision 6
VK_LUNARG_direct_driver_loading        : extension revision 1

Instance Layers: count = 3
--------------------------
VK_LAYER_AMD_switchable_graphics_32 AMD switchable graphics layer 1.3.241  version 1
VK_LAYER_AMD_switchable_graphics_64 AMD switchable graphics layer 1.3.241  version 1
VK_LAYER_MESA_device_select         Linux device selection layer  1.3.211  version 1

Devices:
========
GPU0:
	apiVersion         = 1.3.260
	driverVersion      = 2.0.279
	vendorID           = 0x1002
	deviceID           = 0x73df
	deviceType         = PHYSICAL_DEVICE_TYPE_DISCRETE_GPU
	deviceName         = AMD Radeon RX 6750 XT
	driverID           = DRIVER_ID_AMD_PROPRIETARY
	driverName         = AMD proprietary driver
	driverInfo         = (AMD proprietary shader compiler)
	conformanceVersion = 1.3.3.1
	deviceUUID         = 
	driverUUID         = 414d442d-4c49-4e55-582d-445256000000
GPU1:
	apiVersion         = 1.3.241
	driverVersion      = 2.0.257
	vendorID           = 0x1002
	deviceID           = 0x73df
	deviceType         = PHYSICAL_DEVICE_TYPE_DISCRETE_GPU
	deviceName         = AMD Radeon RX 6750 XT
	driverID           = DRIVER_ID_AMD_OPEN_SOURCE
	driverName         = AMD open-source driver
	driverInfo         = 2023.Q1.3 (LLPC)
	conformanceVersion = 1.3.0.0
	deviceUUID         = 
	driverUUID         = 414d442d-4c49-4e55-582d-445256000000

The most important bits are:

  • Kernel driver in use: amdgpu
  • direct rendering: Yes
  • that vulkaninfo doesn't produce any errors

Wine and other software packages

These are my current useflags:

  • wine: +abi_x86_32 +abi_x86_64 +proton
  • wine-staging: +X +abi_x86_32 +abi_x86_64 -alsa -capi -crossdev-mingw -cups -custom-cflags -dos +fontconfig +gecko -gphoto2 +gstreamer -kerberos -llvm-libunwind +mingw +mono -netapi +nls -opencl +opengl -osmesa -pcap -perl +pulseaudio -samba -scanner +sdl -smartcard +ssl +strip +truetype -udev -udisks +unwind +usb -v4l +vulkan -wayland -wow64 +xcomposite -xinerama
  • wine-proton: +X +abi_x86_32 +abi_x86_64 -alsa -capi -crossdev-mingw -cups -custom-cflags -dos +fontconfig +gecko -gphoto2 +gstreamer -kerberos -llvm-libunwind +mingw +mono -netapi +nls -odbc -opencl +opengl -osmesa -pcap -perl +pulseaudio -samba -scanner +sdl -smartcard +ssl +strip +truetype -udev -udisks +unwind -usb -v4l +vulkan -wayland -wow64 +xcomposite -xinerama
  • wine-vanilla: +abi_x86_32 +abi_x86_64 -alsa -crossdev-mingw -custom-cflags +fontconfig +gecko +gstreamer -llvm-libunwind +mono +nls -osmesa -perl +pulseaudio +sdl +ssl +strip -udev -udisks +unwind +usb -v4l +video_cards_amdgpu +xcomposite -xinerama Notice that I am targeting all WINE packages in order to test slightly different configurations. Use eselect wine to switch between versions.

I have enable the abi_x86_32 use flag for many packages, probably more than needed. This is to ensure that I avoid problems related to my configuration. Enabling the flag globally seems like a waste of cpu and disk.

These are the additional WINE related packages that I installed:

  • app-emulation/winetricks: +gtk +rar
  • app-emulation/vkd3d-proton: +abi_x86_32 +strip

GPU related packages:

  • dev-util/DirectXShaderCompiler: necessary for proper directX support with vulkan
  • media-libs/vulkan-loader: +X +abi_x86_32 +layers
  • dev-util/vulkan-tools: +X
  • media-libs/amdgpu-pro-vulkan: +abi_x86_32 +video_cards_amdgpu
  • media-libs/amdvlk: +abi_x86_32 +raytracing but I am not sure my gpu supports raytracing
  • media-libs/shaderc

Controller related tools:

  • app-misc/evtest: to test the controllers input

I am using spectrwm as my windows manager. It is not the best option and I would suggest to use a more featured DE. This is an example of an innocous error that is caused by spectrwm when using WINE:

ERROR: ld.so: object '/usr/lib64/libswmhack.so.0.0' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.

Consider that WMs need a compositor to avoid some clashes with WINE. I am using x11-misc/picom with drm and opengl support.

user ~> WINEPREFIX=/home/user/.wine setup_vkd3d_proton.sh install --symlink

  • wineboot

  • la demo

  • app-emulation/vkd3d-proton

      elog "	WINEPREFIX=/path/to/prefix setup_dxvk.sh install --symlink"
    

WINEPREFIX=user ~> setup_vkd3d_proton.sh install

  • evtest; wine control joy....; dxdiag?

windows managers?

  • hardware: controller, gpu, cpu, audio

  • snapshot .cache/wine