Forum Discussion
Ihor.Ilkevych
5 months agoHonored Guest
native request refresh rate
I want native android app to request refresh rate change like openxr app does using
https://registry.khronos.org/OpenXR/specs/1.0/html/xrspec.html#xrRequestDisplayRefreshRateFB
I tried to do it using ANativeWindow_setFrameRate but it doesn't work. I guess compositor ignores request from 2d apps as they control only small part of the the display.
I'm using as simple test
https://github.com/android/ndk-samples/tree/master/native-activity
After quest 2 is forced to run in 120fps using ADB, ORV metrics tool shows that app easily provides 120 frames.
Profiler shows that frames are on display only 8.35ms.
App is running in passthrough mode.
Just need an api to change refresh rate from android native app
1 Reply
Replies have been turned off for this discussion
- Ihor.IlkevychHonored Guest
https://github.com/meta-quest/Meta-OpenXR-SDK/tree/main/Samples/XrSamples/XrCompositor_NativeActivity
This sample allows to change refresh rate using thumb stick click and I confirmed using profiler and OVR Metrics tool it actually changes it. Like magic.
Next I've changed
https://github.com/meta-quest/Meta-OpenXR-SDK/blob/7b16fc57f50e38e9e004d652eacf48c1124ae1ae/Samples/XrSamples/XrCompositor_NativeActivity/Projects/Android/AndroidManifest.xml#L48
just comment out
<!-- <category android:name="org.khronos.openxr.intent.category.IMMERSIVE_HMD" />-->
in order to make app 2d
Secondly set default refresh rate
https://github.com/meta-quest/Meta-OpenXR-SDK/blob/7b16fc57f50e38e9e004d652eacf48c1124ae1ae/Samples/XrSamples/XrCompositor_NativeActivity/Src/XrCompositor_NativeActivity.c#L3111
toOXR(appState.pfnRequestDisplayRefreshRate(appState.Session, 120.0f));
and it actually changes refresh rate.
Yes it can't render 120 frames unless you don't look at the app window.
Nevertheless quest accepts xr request to change refresh rate even if it is 2d app.
Although it ignores such request from ANativeWindow_setFrameRate
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 25 days ago