Open tim-rex opened 7 months ago
The only reference I can find for eglGetPlatformDisplay to return EGL_BAD_ATTRIBUTE
is noted in the EGL_EXT_explicit_device
extension notes
If EGL_EXT_platform_device is supported, passing EGL_DEVICE_EXT as an attribute to eglGetPlatformDisplay(EGL_PLATFORM_DEVICE_EXT) generates EGL_BAD_ATTRIBUTE.
The only reference I can find for eglGetPlatformDisplay to return
EGL_BAD_ATTRIBUTE
is noted in theEGL_EXT_explicit_device
extension notes
EGL_BAD_ATTRIBUTE
is a generic error for any case where the implementation doesn't recognize an attribute enum. From the EGL spec, section 3.1:
EGL_BAD_ATTRIBUTE
An unrecognized attribute or attribute value was passed in an attribute list. Any command taking an attribute parameter or attribute list may generate this error.
Unfortunately, that doesn't tell us what's calling eglGetPlatformDisplay or what the offending attribute is...
I can pull on that thread..
Here's the call stack when eglGetPlatformDisplay gets called
#0 eglGetPlatformDisplay (platform=12760, native_display=0x6564090, attrib_list=0x7fff89b93200) at /usr/src/debug/libglvnd-1.7.0-1.fc39.x86_64/src/EGL/libegl.c:409
#1 0x00007fff22e01fe0 in ProducerInit () from /lib64/libnvidia-vulkan-producer.so
#2 0x00007fff32a19872 in ?? () from /lib64/libnvidia-glcore.so.535.129.03
#3 0x00007fff32a43bbf in ?? () from /lib64/libnvidia-glcore.so.535.129.03
#4 0x00007fff32a67bdd in ?? () from /lib64/libnvidia-glcore.so.535.129.03
#5 0x00007fff88453b20 in ?? () from /lib64/libGLX_nvidia.so.0
#6 0x00007fff885d0fb7 in terminator_CreateSwapchainKHR (device=0x7fff85c5e430, pCreateInfo=0x7fff85c3f050, pAllocator=0x0, pSwapchain=0xa34520 <vulkan+6352>) at /vulkan-sdk/1.3.268.0/source/Vulkan-Loader/loader/wsi.c:499
#7 0x00007fff24f92b9d in DispatchCreateSwapchainKHR (device=device@entry=0x7fff85c5e430, pCreateInfo=pCreateInfo@entry=0x7fff89b93880, pAllocator=pAllocator@entry=0x0, pSwapchain=pSwapchain@entry=0xa34520 <vulkan+6352>)
at /vulkan-sdk/1.3.268.0/source/Vulkan-ValidationLayers/layers/vulkan/generated/vk_safe_struct.h:4590
#8 0x00007fff24e79ab3 in vulkan_layer_chassis::CreateSwapchainKHR (device=0x7fff85c5e430, pCreateInfo=0x7fff89b93880, pAllocator=0x0, pSwapchain=0xa34520 <vulkan+6352>)
at /vulkan-sdk/1.3.268.0/source/Vulkan-ValidationLayers/layers/vulkan/generated/chassis.cpp:5714
#9 0x00000000005a7bac in VulkanWrapper::createSwapChain (this=0xa32c50 <vulkan>, swapchainSupport=..., surfaceFormat=..., surfaceFormat2=..., preferredPresentMode=VK_PRESENT_MODE_MAILBOX_KHR) at ./common/vulkan_helper.cpp:1644
#10 0x00000000005940c4 in VulkanWrapper::createSwapChain (this=0xa32c50 <vulkan>, swapchainSupport=..., surfaceFormat=..., surfaceFormat2=...) at ./common/vulkan_helper.cpp:1471
#11 0x000000000056e454 in VulkanWrapper::initVulkan (this=0xa32c50 <vulkan>, hWnd=0x6569e70) at ./common/vulkan_helper.cpp:5612
#12 0x00000000004f7838 in processRenderEvents () at ./core/render.cpp:155
#13 0x000000000050312b in update_loop () at ./core/main.cpp:917
#14 0x0000000000503ab5 in main_loop (argc=0, argv=0x0) at ./core/main.cpp:1106
#15 0x000000000040f22d in main_loop_bootstrap () at ./platform/Linux/linux_main.cpp:803
#16 0x00007ffff77e4897 in start_thread (arg=<optimized out>) at pthread_create.c:444
#17 0x00007ffff786b6bc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
The attrib_list at the call site is
(gdb) p/x *attrib_list@3
$43 = {0x3352, 0x1, 0x3038}
That would seem to map to:
EGL_TRACK_REFERENCES_KHR, EGL_TRUE, EGL_NONE
EGL_KHR_display_references indicates
An EGL_BAD_ATTRIBUTE error is generated if the requested value for EGL_TRACK_REFERENCES_KHR is not supported.
Stepping through from there, EGL_BAD_ATTRIBUTE is generated from the following frame
gdb) p/x *attrib_list@3
$2 = {0x3352, 0x1, 0x3038}
(gdb) frame
#0 _eglGetWaylandDisplay (native_display=0x6564090, attrib_list=0x7fff89b93200) at ../src/egl/main/egldisplay.c:535
535 _eglError(EGL_BAD_ATTRIBUTE, "eglGetPlatformDisplay");
with the trace
(gdb) bt
#0 _eglGetWaylandDisplay (native_display=0x6564090, attrib_list=0x7fff89b93200) at ../src/egl/main/egldisplay.c:535
#1 0x00007ffff7bf4fd5 in GetPlatformDisplayCommon (platform=12760, native_display=0x6564090, attrib_list=0x7fff89b93200, funcName=0x7ffff7bfb2da "eglGetPlatformDisplay")
at /usr/src/debug/libglvnd-1.7.0-1.fc39.x86_64/src/EGL/libegl.c:324
#2 0x00007fff22e01fe0 in ProducerInit () from /lib64/libnvidia-vulkan-producer.so
#3 0x00007fff32a19872 in ?? () from /lib64/libnvidia-glcore.so.535.129.03
#4 0x00007fff32a43bbf in ?? () from /lib64/libnvidia-glcore.so.535.129.03
#5 0x00007fff32a67bdd in ?? () from /lib64/libnvidia-glcore.so.535.129.03
#6 0x00007fff88453b20 in ?? () from /lib64/libGLX_nvidia.so.0
#7 0x00007fff885d0fb7 in terminator_CreateSwapchainKHR (device=0x7fff85c5f000, pCreateInfo=0x7fff85c3fc50, pAllocator=0x0, pSwapchain=0xa34520 <vulkan+6352>) at /vulkan-sdk/1.3.268.0/source/Vulkan-Loader/loader/wsi.c:499
#8 0x00007fff24f92b9d in DispatchCreateSwapchainKHR (device=device@entry=0x7fff85c5f000, pCreateInfo=pCreateInfo@entry=0x7fff89b93880, pAllocator=pAllocator@entry=0x0, pSwapchain=pSwapchain@entry=0xa34520 <vulkan+6352>)
at /vulkan-sdk/1.3.268.0/source/Vulkan-ValidationLayers/layers/vulkan/generated/vk_safe_struct.h:4590
#9 0x00007fff24e79ab3 in vulkan_layer_chassis::CreateSwapchainKHR (device=0x7fff85c5f000, pCreateInfo=0x7fff89b93880, pAllocator=0x0, pSwapchain=0xa34520 <vulkan+6352>)
at /vulkan-sdk/1.3.268.0/source/Vulkan-ValidationLayers/layers/vulkan/generated/chassis.cpp:5714
#10 0x00000000005a7bac in VulkanWrapper::createSwapChain (this=0xa32c50 <vulkan>, swapchainSupport=..., surfaceFormat=..., surfaceFormat2=..., preferredPresentMode=VK_PRESENT_MODE_MAILBOX_KHR) at ./common/vulkan_helper.cpp:1644
#11 0x00000000005940c4 in VulkanWrapper::createSwapChain (this=0xa32c50 <vulkan>, swapchainSupport=..., surfaceFormat=..., surfaceFormat2=...) at ./common/vulkan_helper.cpp:1471
#12 0x000000000056e454 in VulkanWrapper::initVulkan (this=0xa32c50 <vulkan>, hWnd=0x6569e70) at ./common/vulkan_helper.cpp:5612
#13 0x00000000004f7838 in processRenderEvents () at ./core/render.cpp:155
#14 0x000000000050312b in update_loop () at ./core/main.cpp:917
#15 0x0000000000503ab5 in main_loop (argc=0, argv=0x0) at ./core/main.cpp:1106
#16 0x000000000040f22d in main_loop_bootstrap () at ./platform/Linux/linux_main.cpp:803
#17 0x00007ffff77e4897 in start_thread (arg=<optimized out>) at pthread_create.c:444
#18 0x00007ffff786b6bc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
Our Vulkan Wayland WSI has been pretty much entirely re-written for the 545 release, so it might be worth checking if updating fixes the issue.
I'm unable to validate on my Fedora 39 setup at this time, but i've tried to repro on a freshly installed arch linux setup on the same machine using the latest 545.29.06 drivers and running into different (earlier) issues.
Raised #96
I'll update here when I can confirm with newer drivers on F39
I'm unable to validate this further at this time, currently blocked on #96
In a similar vein to #94, I am also seeing
vkCreateSwapchainKHR
fail withVK_ERROR_INITIALIZATION_FAILED
I notice also that having
EGL_LOG_LEVEL=debug
will cause the following to be logged when this failure occurs, which may provide a clue.FWIW, I'm not explicitly calling eglGetPlatformDisplay or any other egl functionality in this application.
However unlike issue #94 this is not remediated by setting _nvidiadrm modeset=1 (which is already enabled) per this comment
vkCreateSwapchainKHR
is being called with the following createInfo structImportantly..
I'm running a dual GPU system with nvidia + amdgpu under Gnome Wayland. This only seems to occur when Gnome is using amdgpu as the primary interface. Swapchain creation seems fine when nvidia is the primary interface, or when it is the only interface in use.
Fedora Linux 39 (Workstation Edition) Linux 6.5.11-300.fc39.x86_64 GNOME Version 45.1 nVidia Driver version 535.129.03
Output of eglinfo attached eglinfo.txt
Some interesting observations.. probably unrelated When this occurs WAYLAND_DEBUG emits the following:
In particular, that reference to
/dev/dri/renderD128
is confusing, as that is my AMD device.. despite that I am using an nVidia logical device in my Vulkan initialisation.And for the sake of experimentation.. Setting the following does allow me to proceed further..
DRI_PRIME=pci-0000_01_00_0" __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAMEnvidia
Swapchain creation succeeds, but ultimately fails on
vkQueuePresentKHR
with