Advanced — LeonardoXR SDK

Advanced — LeonardoXR SDK

Advanced — LeonardoXR SDK

Version: 1.0.2 Target Device: Youbiquo Leonardo XR Base SDK: Snapdragon Spaces 1.0.4

This section covers advanced configurations and features available on LeonardoXR, divided into general Snapdragon Spaces platform features and proprietary advanced features of Leonardo XR.


Advanced Features — Snapdragon Spaces

Adding a New Interaction Profile

To use an interaction profile not included in the Snapdragon Spaces plugin:

  1. Go to Project Settings > XR Plug-in Management > OpenXR (Android tab) > Interaction Profiles.
  2. Add the desired profile by clicking the + button.
  3. Configure the corresponding Input Actions in the Input System Asset.

See also Interaction Package Guides for the configuration of recommended profiles on LeonardoXR.


Custom Controller

Describes how to build a custom Android controller archive (.aar) using the Custom Controller Package — the Android Studio project included in the developer package.

Process Overview
  1. Open the Android Studio project included in the Snapdragon Spaces developer package.
  2. Modify the companion Activity as needed (layout, buttons, additional axes).
  3. Build the project to generate a .aar file.
  4. Import the .aar file into the Unity project as a native Android plugin (into the Assets/Plugins/Android folder).
  5. Configure the Android manifest to declare the new Activity.

Note: Adding a custom controller archive may cause Gradle caching errors. If build errors occur, delete the Temp/gradleOut folder and rebuild.


Display Refresh Rate

The XR_EXT_display_refresh_rate extension allows querying and setting the display refresh rate at runtime.

Querying the Current Refresh Rate
using Qualcomm.Snapdragon.Spaces;

BaseRuntimeFeature baseRuntime = OpenXRSettings.Instance
    .GetFeature<BaseRuntimeFeature>();

float currentHz = baseRuntime.GetDisplayRefreshRate();
Debug.Log($"Current refresh rate: {currentHz} Hz");
Getting Supported Refresh Rates
float[] supportedRates = baseRuntime.GetSupportedDisplayRefreshRates();
foreach (float rate in supportedRates)
    Debug.Log($"Supported: {rate} Hz");
Setting the Refresh Rate
baseRuntime.RequestDisplayRefreshRate(90.0f);

Note: The required refresh rate must be one of those returned by GetSupportedDisplayRefreshRates(). Unsupported values are ignored.


Advanced Android Thread Performance

The SpacesThreadUtility component improves thread scheduling priority on Android, resulting in more consistent frame timing.

Setup

Add the SpacesThreadUtility component to a persistent GameObject in the scene (for example, the same GameObject that hosts the AR Session or the XR Origin).

// SpacesThreadUtility requires no configuration:
// simply add it as a component and it will activate automatically.
// It affects the main Unity threads during initialization.
When to Use It

The use of SpacesThreadUtility is recommended in all LeonardoXR applications that exhibit framerate jitter or frame timing variability, particularly in scenes with heavy rendering or multiple active AR subsystems.


Performance Settings

The XR_EXT_performance_settings OpenXR extension exposes CPU and GPU performance-level hints via a new method in BaseRuntimeFeature.

Available Performance Levels

Performance levels range from PowerSavings (maximum power saving) to Boost (maximum performance):

Level Description
PowerSavings Reduces CPU/GPU clocks to the minimum necessary. Useful for simple scenes or static UIs.
SustainedLow Sustained performance at a low level.
SustainedHigh Sustained performance at a high level. Recommended for most AR applications.
Boost Maximum performance for short periods (not sustainable long-term).
Usage
using Qualcomm.Snapdragon.Spaces;
using UnityEngine.XR.OpenXR;

BaseRuntimeFeature baseRuntime = OpenXRSettings.Instance
    .GetFeature<BaseRuntimeFeature>();

// Set CPU and GPU to SustainedHigh
baseRuntime.SetPerformanceLevel(
    PerformanceDomain.Cpu,
    PerformanceLevel.SustainedHigh);

baseRuntime.SetPerformanceLevel(
    PerformanceDomain.Gpu,
    PerformanceLevel.SustainedHigh);

Note: The Boost level consumes significantly more power and may cause thermal throttling if sustained for long periods. Use it only for critical, short-duration operations (e.g., loading a heavy scene).



Advanced Features — LeonardoXR

QNN Inference Plugin — Advanced Guide

⚠️ Documentation under preparation.

This section will cover advanced usage of the QNN (Qualcomm Neural Network) Inference Plugin on Leonardo XR, including:

  • Model preparation and conversion (ONNX → QNN format).
  • Runtime model loading via plugin APIs.
  • NPU inference execution with input/output tensor management.
  • Memory management and throughput optimization.
  • Inference performance debugging and profiling.
  • Use cases: object detection, pose estimation, real-time segmentation.

Detailed documentation will be available in a future release.


Intercept OpenXR Function — Advanced Guide

⚠️ Documentation under preparation.

This section will cover advanced usage of the Intercept OpenXR Function mechanism on Leonardo XR, including:

  • OpenXR interception layer architecture.
  • Registration of custom handlers for specific OpenXR functions.
  • Use cases: rendering pipeline override, injection of custom data into the XR layer, low-level debugging of OpenXR behavior.
  • Security and stability considerations.
  • Interaction with other components of the LeonardoXR SDK.

This feature is intended for developers with direct experience in low-level OpenXR APIs. Detailed documentation will be available in a future release.