ami-iit / yarp-device-openxrheadset

BSD 2-Clause "Simplified" License
1 stars 2 forks source link

Add CI #13

Closed S-Dafarra closed 2 years ago

S-Dafarra commented 2 years ago

I am working on this in the branch ci: https://github.com/ami-iit/yarp-device-openxrheadset/tree/ci

The pipeline using conda works fine. I am also trying to have a pipeline in Ubuntu using monado as runtime to run a test. The problem here is that monado requires to run a GUI, and this is problematic in the GH Actions.

When running monado normally, I get the following error:

DEBUG [xrt_gfx_provider_create_system] Doing init 0x55e296f91000
ERROR [xrt_gfx_provider_create_system] Failed to init compositor 0x55e296f91000
DEBUG [render_shaders_close] Shaders destroyed!
ERROR [init_all] Could not create system compositor!

I have tried using xvfb-run to run monado headless, and I have the following output

DEBUG [xrt_gfx_provider_create_system] Doing init 0x558e67d5c000
ERROR [create_instance] vkCreateInstance: VK_ERROR_EXTENSION_NOT_PRESENT
    Failed to create Vulkan instance
ERROR [xrt_gfx_provider_create_system] Failed to init compositor 0x558e67d5c000
ERROR [init_all] Could not create system compositor!

Then, I tried to follow https://github.com/godotengine/godot/pull/47414 and use SwiftShader, but with no result.

Checking the error in the monado source code, I found that it is triggered here: https://gitlab.freedesktop.org/monado/monado/-/blob/add6ed34b65ea664e2bc58feb3e5d15cbfa4f8b7/src/xrt/compositor/util/comp_vulkan.c#L234-258

Hence, I think it is related to a missing extension in the Vulkan implementation.

The monado required extensions are defined in https://gitlab.freedesktop.org/monado/monado/-/blob/add6ed34b65ea664e2bc58feb3e5d15cbfa4f8b7/src/xrt/compositor/main/comp_compositor.c#L564-598

It is possible to check the available Vulkan extensions running vulkaninfo from the vulkan-utils package.

The required extension should be:

VK_KHR_swapchain
VK_KHR_dedicated_allocation
VK_KHR_external_fence
VK_KHR_external_memory
VK_KHR_external_semaphore
VK_KHR_get_memory_requirements2
VK_KHR_external_memory_fd
VK_KHR_external_semaphore_fd
VK_KHR_external_fence_fd
S-Dafarra commented 2 years ago

Running vulkaninfo on CI fails with the error

Cannot create Vulkan instance.
This problem is often caused by a faulty installation of the Vulkan driver or attempting to use a GPU that does not support Vulkan.
/build/vulkan-tools-KEbD_A/vulkan-tools-1.2.131.1+dfsg1/vulkaninfo/vulkaninfo.h:371: failed with ERROR_INCOMPATIBLE_DRIVER
Error: Process completed with exit code 255.

See https://github.com/ami-iit/yarp-device-openxrheadset/runs/6303508564?check_suite_focus=true

S-Dafarra commented 2 years ago

Summoning @traversaro, in case it does ring some bell

traversaro commented 2 years ago

Which version of mesa is used (apt show mesa-common-dev)? Perhaps updating the mesa version via a dedicated ppa (such as https://launchpad.net/~oibaf/+archive/ubuntu/graphics-drivers) could be useful.

It could also be useful to try to make sure that a software-only vulkan driver is used, I guess by setting the LIBGL_ALWAYS_SOFTWARE=true option.

traversaro commented 2 years ago

Indeed, from https://www.phoronix.com/scan.php?page=news_item&px=Lavapipe-Vulkan-1.3-Turned-On it seems that to use a conformant enough lavapipe (i.e. software vulkan) driver you need a recent mesa, for sure not the one provided in Ubuntu 20.04 .

S-Dafarra commented 2 years ago

Which version of mesa is used (apt show mesa-common-dev)?

From the last CI run:

Get:23 http://azure.archive.ubuntu.com/ubuntu focal-updates/main amd64 mesa-common-dev amd64 21.2.6-0ubuntu0.1~20.04.2 [1504 kB]

Mesa 21.2.5 was released in October 2021: https://www.mesa3d.org/news/releases/mesa-21-2-5-is-released/ while 21.3.0 in November, hence the inclusion mentioned in https://www.phoronix.com/scan.php?page=news_item&px=Lavapipe-Vulkan-1.3-Turned-On is definitely not there

S-Dafarra commented 2 years ago

I have used the ppa of https://launchpad.net/~oibaf/+archive/ubuntu/graphics-drivers and the mesa version is 22.2~git2205050600, but still I was not able to launch vulkaninfo. I got the error

Cannot create Vulkan instance.
This problem is often caused by a faulty installation of the Vulkan driver or attempting to use a GPU that does not support Vulkan.
/build/vulkan-tools-KEbD_A/vulkan-tools-1.2.131.1+dfsg1/vulkaninfo/vulkaninfo.h:371: failed with ERROR_INCOMPATIBLE_DRIVER

After reading the description in https://launchpad.net/~oibaf/+archive/ubuntu/graphics-drivers, I also tried

VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/lvp_icd.x86_64.json MESA_LOADER_DRIVER_OVERRIDE=zink vulkaninfo

to use zink + lavapipe OpenGL emulated on a software Vulkan driver, but I got the error

/build/vulkan-tools-KEbD_A/vulkan-tools-1.2.131.1+dfsg1/vulkaninfo/vulkaninfo.h:458: failed with ERROR_INITIALIZATION_FAILED
Error: Process completed with exit code 255.
S-Dafarra commented 2 years ago

I finally managed to check the vulkan extensions in https://github.com/ami-iit/yarp-device-openxrheadset/commit/bde034310b4c9334d6157a88d692da8fe65bd6f1. Basically the mesa-vulkan-drivers package was missing. I also followed https://wiki.archlinux.org/title/Vulkan#Software_Vulkan:_lavapipe to run the vulkaninfo command. The problem then is that the following two extensions are missing:

VK_KHR_external_semaphore_fd
VK_KHR_external_fence_fd
S-Dafarra commented 2 years ago

I have tried opening an issue on the Monado side: https://gitlab.freedesktop.org/monado/monado/-/issues/170

S-Dafarra commented 2 years ago

For the time being, I disable the testing. It will remain in hold until I get some feedback in https://gitlab.freedesktop.org/monado/monado/-/issues/170.

Relevant PR: https://github.com/ami-iit/yarp-device-openxrheadset/pull/15