Assertion when creating dmabuf-compatible VkImage on Tigerlake
I recently built Mesa git to reproduce some issues I've had in the new GTK renderer. After doing that, my Vulkan code that renders to a dmabuf asserted with:
gtk4-node-editor: ../src/intel/vulkan/anv_image.c:2320: anv_BindImageMemory2: Assertion `!isl_drm_modifier_has_aux(image->vk.drm_format_mod)' failed.
I bisected this down to commit d57611fe.
The stack trace is probably not very informative, but here you go:
(gdb) where
#0 __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1 0x00007ffff69f68a3 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78
#2 0x00007ffff69a48ee in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3 0x00007ffff698c8ff in __GI_abort () at abort.c:79
#4 0x00007ffff698c81b in __assert_fail_base
(fmt=0x7ffff6b0baf8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x7fffa20d6ef8 "!isl_drm_modifier_has_aux(image->vk.drm_format_mod)", file=file@entry=0x7fffa20d6920 "../src/intel/vulkan/anv_image.c", line=line@entry=2405, function=function@entry=0x7fffa20d8210 <__PRETTY_FUNCTION__.19> "anv_bind_image_memory")
at assert.c:92
#5 0x00007ffff699cc57 in __assert_fail
(assertion=assertion@entry=0x7fffa20d6ef8 "!isl_drm_modifier_has_aux(image->vk.drm_format_mod)", file=file@entry=0x7fffa20d6920 "../src/intel/vulkan/anv_image.c", line=line@entry=2405, function=function@entry=0x7fffa20d8210 <__PRETTY_FUNCTION__.19> "anv_bind_image_memory") at assert.c:101
#6 0x00007fffa0ec0668 in anv_bind_image_memory (bind_info=<optimized out>, device=0x296ed70) at ../src/intel/vulkan/anv_image.c:2405
#7 anv_BindImageMemory2 (_device=0x296ed70, bindInfoCount=<optimized out>, pBindInfos=<optimized out>) at ../src/intel/vulkan/anv_image.c:2437
#8 0x00007fffa1b37af4 in vk_common_BindImageMemory (_device=<optimized out>, image=<optimized out>, memory=<optimized out>, memoryOffset=<optimized out>)
at ../src/vulkan/runtime/vk_device.c:481
#9 0x00007ffff7746d62 in gsk_vulkan_image_new_dmabuf (device=0x2977540 [GskVulkanDevice], format=GDK_MEMORY_R8G8B8A8_PREMULTIPLIED, width=63, height=66)
at ../gsk/gpu/gskvulkanimage.c:749
#10 0x00007ffff774150b in gsk_vulkan_device_create_download_image (device=0x2977540 [GskVulkanDevice], depth=GDK_MEMORY_U8, width=63, height=66)
at ../gsk/gpu/gskvulkandevice.c:411
#11 0x00007ffff77289e8 in gsk_gpu_device_create_download_image (self=0x2977540 [GskVulkanDevice], depth=GDK_MEMORY_U8, width=63, height=66) at ../gsk/gpu/gskgpudevice.c:463
#12 0x00007ffff773b2b0 in gsk_gpu_renderer_render_texture (renderer=0x294cf40 [GskVulkanRenderer], root=0x2b593e0 [GskTransformNode], viewport=0x7fffffffbdb0)
at ../gsk/gpu/gskgpurenderer.c:351
#13 0x00007ffff76a0829 in gsk_renderer_render_texture (renderer=0x294cf40 [GskVulkanRenderer], root=0x2b593e0 [GskTransformNode], viewport=0x7fffffffbdb0)
at ../gsk/gskrenderer.c:428
[40 frames of GTK stack omitted
(gdb) frame 6
#6 0x00007fffa0ec0668 in anv_bind_image_memory (bind_info=<optimized out>, device=0x296ed70) at ../src/intel/vulkan/anv_image.c:2405
2405 assert(!isl_drm_modifier_has_aux(image->vk.drm_format_mod));
(gdb) print image->vk.drm_format_mod
$1 = 72057594037927944
(gdb)
The GTK code creating the VkImage lives in https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gsk/gpu/gskvulkanimage.c#L749 and above.
To reproduce, you need to checkout GTK main, build it and run demos/node-editor/gtk4-node-editor. It will crash at startup. It should work uninstalled if the machine has any GTK version installed.
inxi -GSC -xx
System:
Host: laptop Kernel: 6.6.8-200.fc39.x86_64 arch: x86_64 bits: 64
compiler: gcc v: 2.40-13.fc39 Desktop: GNOME v: 45.2 tk: GTK v: 3.24.39
wm: gnome-shell dm: GDM Distro: Fedora release 39 (Thirty Nine)
CPU:
Info: quad core model: 11th Gen Intel Core i7-1185G7 bits: 64 type: MT MCP
arch: Tiger Lake rev: 1 cache: L1: 320 KiB L2: 5 MiB L3: 12 MiB
Speed (MHz): avg: 668 high: 1148 min/max: 400/4800 cores: 1: 400 2: 400
3: 400 4: 400 5: 1148 6: 763 7: 852 8: 983 bogomips: 47923
Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
Graphics:
Device-1: Intel TigerLake-LP GT2 [Iris Xe Graphics] vendor: Lenovo
driver: i915 v: kernel arch: Gen-12.1 ports: active: eDP-1 empty: DP-1,
DP-2, DP-3, DP-4, HDMI-A-1, HDMI-A-2, HDMI-A-3 bus-ID: 00:02.0
chip-ID: 8086:9a49
Device-2: IMC Networks [] driver: uvcvideo type: USB rev: 2.0
speed: 480 Mb/s lanes: 1 bus-ID: 3-4:3 chip-ID: 13d3:5411
Display: wayland server: X.org v: 1.20.14 with: Xwayland v: 23.2.3
compositor: gnome-shell driver: X: loaded: modesetting unloaded: fbdev,vesa
dri: iris gpu: i915 display-ID: 0
Monitor-1: eDP-1 res: 1920x1200 size: N/A
API: EGL v: 1.5 platforms: device: 0 drv: iris device: 1 drv: swrast
surfaceless: drv: iris wayland: drv: iris x11: drv: iris inactive: gbm
API: OpenGL v: 4.6 compat-v: 4.5 vendor: intel v: N/A glx-v: 1.4
direct-render: yes renderer: Mesa Intel Xe Graphics (TGL GT2)
device-ID: 8086:9a49 display-ID: :0.0
API: Vulkan v: 1.3.268 surfaces: xcb,xlib,wayland device: 0
type: integrated-gpu driver: mesa intel device-ID: 8086:9a49 device: 1
type: cpu driver: mesa llvmpipe device-ID: 10005:0000