eglCreateImageKHR, error: EGL_BAD_ALLOC (0x3003), message: "createImageFromDmaBufs failed" on AMD multi-gpu with explicit format modifiers
System information
System:
Host: arch-asus-gergely Kernel: 6.1.12-arch1-1 arch: x86_64 bits: 64
compiler: gcc v: 12.2.1 Desktop: sway v: 1.8.1 dm: GDM Distro: Arch Linux
CPU:
Info: 8-core model: AMD Ryzen 7 6800HS with Radeon Graphics bits: 64
type: MT MCP arch: Zen 3+ rev: 1 cache: L1: 512 KiB L2: 4 MiB L3: 16 MiB
Speed (MHz): avg: 825 high: 3169 min/max: 400/4785 boost: enabled cores:
1: 400 2: 400 3: 3168 4: 400 5: 400 6: 400 7: 3169 8: 400 9: 400 10: 400
11: 400 12: 400 13: 1671 14: 400 15: 400 16: 400 bogomips: 102240
Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
Graphics:
Device-1: AMD Navi 23 [Radeon RX 6650 XT] vendor: ASUSTeK driver: amdgpu
v: kernel arch: RDNA-2 pcie: speed: 16 GT/s lanes: 16 ports:
active: HDMI-A-1 empty: DP-1,eDP-1 bus-ID: 03:00.0 chip-ID: 1002:73ef
Device-2: AMD Rembrandt [Radeon 680M] vendor: ASUSTeK driver: amdgpu
v: kernel arch: RDNA-2 pcie: speed: 16 GT/s lanes: 16 ports: active: none
off: eDP-2 empty: DP-2, DP-3, DP-4, DP-5, DP-6, DP-7, DP-8, DP-9
bus-ID: 07:00.0 chip-ID: 1002:1681 temp: 53.0 C
Device-3: IMC Networks USB2.0 HD UVC WebCam type: USB driver: uvcvideo
bus-ID: 3-3:4 chip-ID: 13d3:56eb
Display: wayland server: X.org v: 1.21.1.7 with: Xwayland v: 22.1.8
compositor: sway v: 1.8.1 driver: X: loaded: amdgpu unloaded: modesetting
alternate: fbdev,vesa dri: radeonsi gpu: amdgpu d-rect: 5360x1440
display-ID: 1
Monitor-1: HDMI-A-1 pos: right model: AOC U34G2G1 res: 3440x1440 dpi: 110
diag: 864mm (34")
Monitor-2: eDP-2 pos: primary,left model: BOE Display 0x0a3a
res: 1920x1200 dpi: 161 diag: 356mm (14")
API: OpenGL v: 4.6 Mesa 22.3.4 renderer: AMD Radeon Graphics (rembrandt
LLVM 15.0.7 DRM 3.49 6.1.12-arch1-1) direct-render: Yes
Describe the issue
The device is a laptop with a vega (gfx9) integrated and an rdna2 (RX6700s) discrete AMD GPU. The HDMI output is wired to the discrete GPU.
Using a wlroots based compositor a monitor connected to the HDMI port can't be enabled, it remains blank. The compositor logs point to eglCreateImageKHR
failing.
Relevant lines from sway log (full log is attached):
00:00:01.065 [DEBUG] [sway/config/output.c:395] Turning on output HDMI-A-1
00:00:01.065 [DEBUG] [sway/config/output.c:403] Set HDMI-A-1 mode to 3440x1440 (100.000000 Hz)
00:00:01.065 [DEBUG] [sway/config/output.c:282] Assigning configured mode to HDMI-A-1
00:00:01.065 [DEBUG] [sway/config/output.c:441] Auto-detected output transform: 0
00:00:01.065 [DEBUG] [sway/config/output.c:356] Output DPI: 109.220000x110.836364
00:00:01.065 [DEBUG] [sway/config/output.c:455] Auto-detected output scale: 1.000000
00:00:01.065 [DEBUG] [sway/config/output.c:506] Committing output HDMI-A-1
00:00:01.065 [DEBUG] [wlr] [types/output/render.c:229] Attaching empty buffer to output for modeset
00:00:01.065 [DEBUG] [wlr] [types/output/render.c:75] Choosing primary buffer format XR24 (0x34325258) for output 'HDMI-A-1'
00:00:01.065 [DEBUG] [wlr] [render/swapchain.c:105] Allocating new swapchain buffer
00:00:01.065 [DEBUG] [wlr] [render/allocator/gbm.c:143] Allocated 3440x1440 GBM buffer with format XR24 (0x34325258), modifier GFX9,GFX9_64K_S (0x0200000000000901)
00:00:01.065 [DEBUG] [wlr] [render/gles2/renderer.c:148] Created GL FBO for buffer 3440x1440
00:00:01.072 [ERROR] [wlr] [EGL] command: eglCreateImageKHR, error: EGL_BAD_ALLOC (0x3003), message: "createImageFromDmaBufs failed"
00:00:01.072 [ERROR] [wlr] [render/egl.c:767] eglCreateImageKHR failed
00:00:01.072 [ERROR] [wlr] [render/gles2/texture.c:291] Failed to create EGL image from DMA-BUF
00:00:01.072 [ERROR] [wlr] [backend/drm/renderer.c:95] Failed to import source buffer into multi-GPU renderer
00:00:01.072 [ERROR] [sway/config/output.c:511] Failed to commit output HDMI-A-1
Regression
Over at wlroots wlroots/wlroots@e59f4d4f is the commit that introduced explicit format modifiers and broke external monitors.
Log files as attachment
Any extra information would be greatly appreciated
- Disabling the modifiers in wlroots via
WLR_EGL_NO_MODIFIERS=1
works around this issue. - Additionally see the original wlroots issue: wlroots/wlroots#3451 (closed)
- Just a wild guess, but the modifiers
GFX9
andGFX9_64K_S
look suspicious as they both have GFX9 in their name presumably from the integrated GPUs graphics family, however the dedicated GPU is from a later family (GFX10). - This can be reproduced with this minimal sway configuration (
sway -c path-to-config
):
output eDP-2 disable
output HDMI-A-1 mode 3440x1440@100Hz