AsahiLinux / linux

Linux kernel source tree
Other
2.29k stars 90 forks source link

wlroots cannot open render as master #333

Open dkwo opened 1 week ago

dkwo commented 1 week ago

When I start a wlroots-based compositor (river) using seatd, the GPU is not picked up, and rendering happens in CPU, unless I export WLR_RENDER_DRM_DEVICE=/dev/dri/renderD128 before launching the compositor.

With seatd, it seems wlroots fails once, and then since seatd cannot set ACL using uaccess, it goes with cpu rendering, instead of reopening the card as non-master (I think this is what happens with elogind+polkit, where the rendering happens in gpu without the need of exporting anything).

This is on Void Linux, which uses eudev instead of udev. Not sure if this is a bug, or the result of some misconfig on my end, e.g. the kernel or mesa.

Refs: seatd ticket: https://todo.sr.ht/~kennylevinsen/seatd/24 kernel and mesa packages: https://github.com/void-linux/void-packages/pull/39796 asahi-diagnose-20241012-124206.txt

edit: I inititally had CONFIG_DRM_VGEM=y, which led to two render nodes being present. After unsetting it, the issue still presents.

dkwo commented 3 days ago

The output with updated kconfig:

$ ls -l /dev/dri 
total 0
drwxr-xr-x 2 root root       100 Oct 16  2024 by-path
crw-rw---- 1 root video 226,   0 Oct 16  2024 card0
crw-rw---- 1 root video 226,   1 Oct 16  2024 card1
crw-rw-rw- 1 root video 226, 128 Oct 16  2024 renderD128
$ ls -l /dev/dri/by-path 
total 0
lrwxrwxrwx 1 root root  8 Oct 16  2024 platform-206400000.gpu-card -> ../card0
lrwxrwxrwx 1 root root 13 Oct 16  2024 platform-206400000.gpu-render -> ../renderD128
lrwxrwxrwx 1 root root  8 Oct 16  2024 platform-soc:display-subsystem-card -> ../card1

Some relevant packages:

$ xpkg -v | grep libgl
libglvnd-1.7.0_1
$ xpkg -v | grep mesa 
mesa-asahi-20241006_1

wlroots version is 0.18.1

The wlroots compositor (river) debug output (using seatd):

info: river version 0.3.5, initializing server
info: raised file descriptor limit of the river process to 4096
info(wlroots): [libseat] [libseat/libseat.c:73] Seat opened with backend 'seatd'
info(wlroots): [libseat] [libseat/backend/seatd.c:212] Enabling seat
info(wlroots): [backend/session/session.c:108] Successfully loaded libseat session
debug(wlroots): [backend/session/session.c:381] Ignoring '/dev/dri/card0': not a KMS device
info(wlroots): [backend/backend.c:256] Found 1 GPUs
info(wlroots): [backend/drm/backend.c:185] Initializing DRM backend for /dev/dri/card1 (apple)
debug(wlroots): [backend/drm/drm.c:111] Using atomic DRM interface
debug(wlroots): [backend/drm/drm.c:131] ADDFB2 modifiers supported
info(wlroots): [backend/drm/drm.c:310] Found 1 DRM CRTCs
info(wlroots): [backend/drm/drm.c:268] Found 1 DRM planes
info(wlroots): [render/egl.c:205] Supported EGL client extensions: EGL_EXT_device_base EGL_EXT_device_enumeration EGL_EXT_device_query EGL_EXT_platform_base EGL_KHR_client_get_all_proc_addresses EGL_EXT_client_extensions EGL_KHR_debug EGL_EXT_platform_device EGL_EXT_explicit_device EGL_EXT_platform_wayland EGL_KHR_platform_wayland EGL_EXT_platform_x11 EGL_KHR_platform_x11 EGL_EXT_platform_xcb EGL_MESA_platform_gbm EGL_KHR_platform_gbm EGL_MESA_platform_surfaceless
error(wlroots): [EGL] command: eglQueryDeviceStringEXT, error: EGL_BAD_PARAMETER (0x300c), message: "eglQueryDeviceStringEXT"
error(wlroots): [EGL] command: eglQueryDeviceStringEXT, error: EGL_BAD_PARAMETER (0x300c), message: "eglQueryDeviceStringEXT"
debug(wlroots): [render/egl.c:508] DRM device '/dev/dri/card1' has no render node, falling back to primary node
error(wlroots): [render/egl.c:514] Failed to open DRM node '/dev/dri/card1': Permission denied
error(wlroots): [render/egl.c:548] Failed to open DRM render node
error(wlroots): [render/egl.c:571] Failed to initialize EGL context
error(wlroots): [render/gles2/renderer.c:499] Could not initialize EGL
debug(wlroots): [render/wlr_renderer.c:192] Failed to create a GLES2 renderer. Skipping!
info(wlroots): [render/pixman/renderer.c:328] Creating pixman renderer
debug(wlroots): [render/allocator/allocator.c:132] Trying to create drm dumb allocator
debug(wlroots): [render/allocator/drm_dumb.c:228] Created DRM dumb allocator

info(wlroots): [backend/drm/drm.c:1677] Scanning DRM connectors on /dev/dri/card1
info(wlroots): [backend/drm/drm.c:1728] Found connector 'eDP-1'
info(wlroots): [backend/drm/drm.c:1753] 'eDP-1' connected
debug(wlroots): [backend/drm/drm.c:1543] Current CRTC: 34
info(wlroots): [backend/drm/drm.c:1557] Detected modes:
info(wlroots): [backend/drm/drm.c:1587]   2560x1600 @ 60.000 Hz (preferred)
info(wlroots): [backend/drm/drm.c:1607] Physical size: 286x179
error(wlroots): [backend/drm/util.c:65] Failed to parse EDID
debug(wlroots): [backend/drm/drm.c:1319] Reallocating CRTCs
debug(wlroots): [backend/drm/drm.c:1382]   Connector eDP-1 (connected, needs CRTC): CRTC 34 (no change)
info(wlroots): [backend/drm/drm.c:1789] connector eDP-1: Requesting modeset
debug(output_manager): new output eDP-1
debug(wlroots): [types/output/render.c:127] Attaching empty buffer to output for modeset
debug(wlroots): [types/output/swapchain.c:27] Choosing primary buffer format XR24 (0x34325258) for output 'eDP-1'
debug(wlroots): [types/output/swapchain.c:96] Testing swapchain for output 'eDP-1'
debug(wlroots): [render/swapchain.c:106] Allocating new swapchain buffer
debug(wlroots): [render/allocator/drm_dumb.c:105] Allocated 2560x1600 DRM dumb buffer
debug(wlroots): [render/pixman/renderer.c:186] Created pixman buffer 2560x1600
info(wlroots): [backend/drm/drm.c:891] connector eDP-1: Modesetting with 2560x1600 @ 60.000 Hz
debug(wlroots): [types/output/cursor.c:410] Falling back to software cursor on output 'eDP-1'
debug(output_manager): moving views from fallback stacks to new output
info: running init executable '/home/dkwo/.config/river/init'
info: running server
debug(wlroots): [render/swapchain.c:106] Allocating new swapchain buffer
debug(wlroots): [render/allocator/drm_dumb.c:105] Allocated 2560x1600 DRM dumb buffer
debug(wlroots): [render/pixman/renderer.c:186] Created pixman buffer 2560x1600
debug(transaction): commiting transaction
dkwo commented 2 days ago

As suggested by @kennylevinsen this seems to come from drmGetRenderDeviceNameFromFd in wlroots render/egl.c failing, see the line debug(wlroots): [render/egl.c:508] DRM device '/dev/dri/card1' has no render node, falling back to primary node. Incidentally, I see this exact same line with sway+elogind on asahi-fedora on my other machine.

@marcan @asahilina @jannau Do you see anything out of place with my setup? Could you advise where it's best to report this?