Toni-SM / semu.xr.openxr

OpenXR compact binding for creating extended reality applications on NVIDIA Omniverse
MIT License
25 stars 6 forks source link

[ERROR] xrCreateSwapchain failed with code: -26 (XR_ERROR_SWAPCHAIN_FORMAT_UNSUPPORTED). #6

Closed PARKBONG closed 1 year ago

PARKBONG commented 1 year ago

Hi, @Toni-SM

I tried to setup your extension on the workstation, but I faced the Swapchain error. If you know about this, can you help me?

here is my system requirement

|---------------------------------------------------------------------------------------------|
| Driver Version: 515.76        | Graphics API: Vulkan
|=============================================================================================|
| GPU | Name                             | Active | LDA | GPU Memory | Vendor-ID | LUID       |
|     |                                  |        |     |            | Device-ID | UUID       |
|---------------------------------------------------------------------------------------------|
| 0   | NVIDIA RTX A6000                 | Yes: 0 |     | 49386   MB | 10de      | 0          |
|     |                                  |        |     |            | 2230      | 69928a9d.. |
|---------------------------------------------------------------------------------------------|
| 1   | NVIDIA RTX A6000                 | Yes: 1 |     | 49386   MB | 10de      | 0          |
|     |                                  |        |     |            | 2230      | 69928a9d.. |
|=============================================================================================|
| OS: Linux Bong, Version: 5.14.0-1052-oem
| XServer Vendor: The X.Org Foundation, XServer Version: 12013000 (1.20.13.0)
| Processor: AMD Ryzen Threadripper PRO 5975WX 32-Cores      | Cores: Unknown | Logical: 64
|---------------------------------------------------------------------------------------------|
| Total Memory (MB): 128642 | Free Memory: 115831
| Total Page/Swap (MB): 2047 | Free Page/Swap: 2047
|---------------------------------------------------------------------------------------------|
2022-10-17 18:48:30 [1,357ms] [Warning] [carb.cudainterop.plugin] On Linux only, CUDA and the display driver does not support IOMMU-enabled bare-metal PCIe peer to peer memory copy. However, CUDA and the display driver does support IOMMU via VM pass through. As a consequence, users on Linux, when running on a native bare metal system, should disable the IOMMU. The IOMMU should be enabled and the VFIO driver be used as a PCIe pass through for virtual machines.

and here is CLI Log

[INFO] OpenXR initialized using pybind11 interface
OpenXR API layers (0)
OpenXR extensions (19)
  |-- XR_KHR_vulkan_enable
  |-- XR_KHR_vulkan_enable2
  |-- XR_KHR_opengl_enable
  |   (requested)
  |-- XR_KHR_binding_modification
  |-- XR_KHR_composition_layer_depth
  |-- XR_KHR_visibility_mask
  |-- XR_EXT_dpad_binding
  |-- XR_EXT_frame_composition_report
  |-- XR_EXT_hand_tracking
  |-- XR_EXT_hand_joints_motion_range
  |-- XR_EXT_hp_mixed_reality_controller
  |-- XR_EXT_palm_pose
  |-- XR_FB_display_refresh_rate
  |-- XR_HTC_vive_cosmos_controller_interaction
  |-- XR_HTC_vive_focus3_controller_interaction
  |-- XR_MND_headless
  |-- XR_VALVE_analog_threshold
  |-- XR_HTCX_vive_tracker_interaction
  |-- XR_EXT_debug_utils
Runtime
  |-- name: SteamVR/OpenXR
  |-- version: 0.1.0
System
  |-- system id: 1152945251481026919
  |-- system name: SteamVR/OpenXR : lighthouse
  |-- vendor id: 10462
  |-- max layers: 16
  |-- max swapchain height: 1416
  |-- max swapchain width: 1272
  |-- orientation tracking: 1
  |-- position tracking: 1
View configurations (1)
  |-- type 2 (https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrViewConfigurationType)
  |   (requested)
View configuration properties
  |-- configuration type: 2 (https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrViewConfigurationType)
  |-- fov mutable (bool): 1
View configuration views (2)
  |-- view 0
  |     |-- recommended resolution: 1272 x 1416
  |     |-- max resolution: 8192 x 8192
  |     |-- recommended swapchain samples: 1
  |     |-- max swapchain samples: 1
  |-- view 1
  |     |-- recommended resolution: 1272 x 1416
  |     |-- max resolution: 8192 x 8192
  |     |-- recommended swapchain samples: 1
  |     |-- max swapchain samples: 1
Environment blend modes (1)
  |-- mode: 1 (https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrEnvironmentBlendMode)
  |   (requested)
OpenGL requirements
  |-- min API version: 4.3.0
  |-- max API version: 4.6.0
Graphics binding: OpenGL
  |-- xDisplay: 0x20a31b80
  |-- visualid: 0
  |-- glxFBConfig: 0
  |-- glxDrawable: 113246219
  |-- glxContext: 0x20ab06b8
Reference spaces (3)
  |-- type: 1 (https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrReferenceSpaceType)
  |     |-- reference space bounds
  |     |     |-- width: 0
  |     |     |-- height: 0
  |-- type: 2 (https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrReferenceSpaceType)
  |     |-- reference space bounds
  |     |     |-- width: 0
  |     |     |-- height: 0
  |-- type: 3 (https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrReferenceSpaceType)
  |     |-- reference space bounds
  |     |     |-- width: 1
  |     |     |-- height: 1
Suggested interaction bindings by profiles
  |-- /interaction_profiles/khr/simple_controller (0)
  |-- /interaction_profiles/google/daydream_controller (0)
  |-- /interaction_profiles/htc/vive_controller (0)
  |-- /interaction_profiles/htc/vive_pro (0)
  |-- /interaction_profiles/microsoft/motion_controller (0)
  |-- /interaction_profiles/microsoft/xbox_controller (0)
  |-- /interaction_profiles/oculus/go_controller (0)
  |-- /interaction_profiles/oculus/touch_controller (0)
  |-- /interaction_profiles/valve/index_controller (0)
Swapchain formats (5)
  |-- format: 35905
  |-- format: 35907
  |-- format: 33189
  |-- format: 33190
  |-- format: 33191
Created swapchain (2)
[ERROR] xrCreateSwapchain failed with code: -26 (XR_ERROR_SWAPCHAIN_FORMAT_UNSUPPORTED). xrCreateSwapchain

Error message occurs at the this line

Official Document : XR_ERROR_SWAPCHAIN_FORMAT_UNSUPPORTED

I have also tried xrlib_c, but the result was the same (as setting self._use_ctypes = True).

Thank you for reading this!

Toni-SM commented 1 year ago

Hi @PARKBONG

Could you please try with this compiled files (unfortunately I don' have the VR equipment with me this week)

xrlib binaries.zip

Unpack them in the semu.xr.openxr/bin folder. Those binaries apply the following change (select the first available swapchain) in case current swapchains are not in the default list:

if((selectedSwapchainFormats == -1) && swapchainFormats.size())
    selectedSwapchainFormats = swapchainFormats[0];
PARKBONG commented 1 year ago

I guess I found the reason.

The problem was xrlib_p on your code, compile_pybind11.bash

#!/bin/bash

# delete old files
. clean_compiled_files.bash
rm ../bin/xrlib_p*

# compile code
python3 pybind11_ext.py build_ext --inplace

# copy compiled file
cp xrlib_p* ../bin/xrlib_p.so

I changed the interpreter

#!/bin/bash

# delete old files
. clean_compiled_files.bash
rm ../bin/xrlib_p*

# compile code
~/.local/share/ov/pkg/code-2022.2.0/kit/python/bin/python3 pybind11_ext.py build_ext --inplace pybind11_ext.py build_ext --inplace

# copy compiled file
cp xrlib_p* ../bin/xrlib_p.so

I compiled it and copy & paste xrlib_p.so from ~/semu.xr.openxr/src/semu.xr.openxr/bin to ~/Documents/Kit/shared/exts/semu.xr.openxr/bin

I checked no error occurs anymore, I will connect HMD device and check if it works soon.

PARKBONG commented 1 year ago

It works,

I don't know details, but I think maybe there was a python library version Issue..

https://user-images.githubusercontent.com/39259734/196726027-0611eace-3f7b-476f-978d-ef70ff1f7ce1.mp4

I always appreciate your help, @Toni-SM