It turns out this is not the only issue we suffer form on tegra.
This merge requests fixes our dedicated allocation issue and with it openxr-simple-example renders properly: comp: Only use dedicated allocation when supported/preferred (!867) · Merge requests · Monado / Monado · GitLab
The second issue was that hello_xr -G OpenGL and Stereokit only render black inside the Monado compositor. This too happens only on Tegra, not on desktop nvidia.
hello_xr -G OpenGL chooses the GL_RGBA16F OpenGL format. Which will be backed by the Monado compositor allocating a Vulkan texture with VK_FORMAT_R16G16B16A16_SFLOAT and importing it into OpenGL in a similar manner.
Switching out hello_xr’s selected color format with GL_SRGB8_ALPHA8_EXT fixes its rendering in the Monado compositor.
diff --git a/src/tests/hello_xr/openxr_program.cpp b/src/tests/hello_xr/openxr_program.cpp
index 294dff7..6456ced 100644
--- a/src/tests/hello_xr/openxr_program.cpp
+++ b/src/tests/hello_xr/openxr_program.cpp
@@ -638,7 +638,7 @@ struct OpenXrProgram : IOpenXrProgram {
CHECK_XRCMD(xrEnumerateSwapchainFormats(m_session, (uint32_t)swapchainFormats.size(), &swapchainFormatCount,
swapchainFormats.data()));
CHECK(swapchainFormatCount == swapchainFormats.size());
- m_colorSwapchainFormat = m_graphicsPlugin->SelectColorSwapchainFormat(swapchainFormats);
+ m_colorSwapchainFormat = GL_SRGB8_ALPHA8_EXT; // m_graphicsPlugin->SelectColorSwapchainFormat(swapchainFormats);
// Print swapchain formats and the selected one.
{
Unfortunately hello_xr -G OpenGL only submits its rendered images to the Monado compositor and does not display them on the desktop, so it doesn’t tell us if the rendering in general is broken or if the Monado compositor just fails to display the textures.
This brings me to the reason why I post this here. If I modify my openxr-simple-example, which does blit the left eye texture to a window before submitting it to the monado compositor, to use the GL_RGBA16F format like this
diff --git a/main.c b/main.c
index 8fd440b..6ca650b 100644
--- a/main.c
+++ b/main.c
@@ -751,7 +751,7 @@ main(int argc, char** argv)
// SRGB is usually a better choice than linear
// a more sophisticated approach would iterate supported swapchain formats and choose from them
- int64_t color_format = get_swapchain_format(instance, session, GL_SRGB8_ALPHA8_EXT, true);
+ int64_t color_format = get_swapchain_format(instance, session, GL_RGBA16F, true);
// GL_DEPTH_COMPONENT16 is a good bet
// SteamVR 1.16.4 supports GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT32
the Monado compositor runs into a time out
ERROR [vk_submit_cmd_buffer] vkWaitForFences: VK_TIMEOUT
ERROR [vk_has_error] vk_submit_cmd_buffer failed with VK_TIMEOUT in ../src/xrt/compositor/main/comp_layer_renderer.c:626
and the kernel logs some gpu errors
Aug 09 15:38:01 tegra kernel: nvgpu: 57000000.gpu nvgpu_set_error_notifier_locked:137 [ERR] error notifier set to 8 for ch 499
Aug 09 15:38:01 tegra kernel: nvgpu: 57000000.gpu gk20a_fifo_handle_sched_error:2552 [ERR] fifo sched ctxsw timeout error: engine=0, tsg=10, ms=3100
Full dmesg, relevant errors towards the end tegra_dmesg.txt (502.3 KB)
Unfortunately when I modify my standalone example to render to a shared VK_FORMAT_R16G16B16A16_SFLOAT/GL_RGBA16F texture, I have no issue. Rendering to such a shared texture and blitting it to the window works fine.
So I have no standalone reproduction for this issue at this time, It looks like this only happens when the Monado compositor on the Vulkan side is also using the shared texture.