Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quest 2 VR app malfunctions when I press the oculus button to activate the system menu #406

Closed
mutantbob opened this issue Jun 21, 2023 · 5 comments · Fixed by #325
Closed

Comments

@mutantbob
Copy link

I have duct-taped together a Rust application that uses OpenXR and glutin to draw a rainbow triangle floating in VR space.

When I press the Oculus button to summon the system menu the system menu appears, but the rest of the environment turns black (I guess my rendering code is no longer being called?) I see this in the logs:

2023-06-21 17:40:37.000 8139-10064/rust.glutin_openxr1 I/VrApi: FPS=72/72,Prd=22ms,Tear=0,Early=0,Stale=0,Stale2/5/10/max=0/0/0/0,VSnc=0,Lat=-1,Fov=0D,CPU4/GPU=2/2,1382/490MHz,OC=FF,TA=0/0/0,SP=N/N/N,Mem=1353MHz,Free=2711MB,PLS=0,Temp=32.0C/0.0C,TW=1.16ms,App=0.52ms,GD=0.13ms,CPU&GPU=1.27ms,LCnt=2(DR72,LM2),GPU%=0.16,CPU%=0.24(W0.27),DSF=1.00,CFL=18.87/23.72,LD=0,SF=1.00
2023-06-21 17:40:37.875 8139-8165/rust.glutin_openxr1 I/RustStdoutStderr: thread '<unnamed>' panicked at 'internal error: entered unreachable code: AInputQueue_preDispatchEvent returned non-boolean -1', /home/thoth/.cargo/registry/src/github.com-1ecc6299db9ec823/ndk-0.7.0/src/input_queue.rs:82:18
2023-06-21 17:40:37.875 8139-8165/rust.glutin_openxr1 I/RustStdoutStderr: stack backtrace:
2023-06-21 17:40:37.875 8139-8165/rust.glutin_openxr1 I/RustStdoutStderr:    0:       0x789fb42258 - <unknown>
2023-06-21 17:40:37.875 8139-8165/rust.glutin_openxr1 I/RustStdoutStderr:    1:       0x789fb5cb44 - <unknown>
2023-06-21 17:40:37.875 8139-8165/rust.glutin_openxr1 I/RustStdoutStderr:    2:       0x789fb3f230 - <unknown>
2023-06-21 17:40:37.875 8139-8165/rust.glutin_openxr1 I/RustStdoutStderr:    3:       0x789fb4105c - <unknown>
2023-06-21 17:40:37.875 8139-8165/rust.glutin_openxr1 I/RustStdoutStderr:    4:       0x789fb43500 - <unknown>
2023-06-21 17:40:37.875 8139-8165/rust.glutin_openxr1 I/RustStdoutStderr:    5:       0x789fb4312c - <unknown>
2023-06-21 17:40:37.875 8139-8165/rust.glutin_openxr1 I/RustStdoutStderr:    6:       0x789fb43bbc - <unknown>
2023-06-21 17:40:37.875 8139-8165/rust.glutin_openxr1 I/RustStdoutStderr:    7:       0x789fb4396c - <unknown>
2023-06-21 17:40:37.875 8139-8165/rust.glutin_openxr1 I/RustStdoutStderr:    8:       0x789fb42728 - <unknown>
2023-06-21 17:40:37.875 8139-8165/rust.glutin_openxr1 I/RustStdoutStderr:    9:       0x789fb436b8 - <unknown>
2023-06-21 17:40:37.875 8139-8165/rust.glutin_openxr1 I/RustStdoutStderr:   10:       0x789fa2849c - <unknown>
2023-06-21 17:40:37.875 8139-8165/rust.glutin_openxr1 I/RustStdoutStderr:   11:       0x789fb28d68 - <unknown>
2023-06-21 17:40:37.875 8139-8165/rust.glutin_openxr1 I/RustStdoutStderr:   12:       0x789fa42938 - <unknown>
2023-06-21 17:40:37.876 8139-8165/rust.glutin_openxr1 I/RustStdoutStderr:   13:       0x789fa44ab0 - <unknown>
2023-06-21 17:40:37.876 8139-8165/rust.glutin_openxr1 I/RustStdoutStderr:   14:       0x789fa3a5e0 - <unknown>
2023-06-21 17:40:37.876 8139-8165/rust.glutin_openxr1 I/RustStdoutStderr:   15:       0x789fa3a268 - <unknown>
2023-06-21 17:40:37.876 8139-8165/rust.glutin_openxr1 I/RustStdoutStderr:   16:       0x789fa41c30 - <unknown>
2023-06-21 17:40:37.876 8139-8165/rust.glutin_openxr1 I/RustStdoutStderr:   17:       0x789fa449a8 - <unknown>
2023-06-21 17:40:37.876 8139-8165/rust.glutin_openxr1 I/RustStdoutStderr:   18:       0x789fa3a018 - <unknown>
2023-06-21 17:40:37.876 8139-8165/rust.glutin_openxr1 I/RustStdoutStderr:   19:       0x789fa3c094 - <unknown>
2023-06-21 17:40:37.876 8139-8165/rust.glutin_openxr1 I/RustStdoutStderr:   20:       0x789fa5adec - <unknown>
2023-06-21 17:40:37.876 8139-8165/rust.glutin_openxr1 I/RustStdoutStderr:   21:       0x789fa37fc8 - <unknown>
2023-06-21 17:40:37.876 8139-8165/rust.glutin_openxr1 I/RustStdoutStderr:   22:       0x789fb12c5c - <unknown>
2023-06-21 17:40:37.876 8139-8165/rust.glutin_openxr1 I/RustStdoutStderr:   23:       0x789fb1db74 - <unknown>
2023-06-21 17:40:37.876 8139-8165/rust.glutin_openxr1 I/RustStdoutStderr:   24:       0x789fb1b3f0 - <unknown>
2023-06-21 17:40:37.876 8139-8165/rust.glutin_openxr1 I/RustStdoutStderr:   25:       0x789fb1e2d0 - <unknown>
2023-06-21 17:40:37.876 8139-8165/rust.glutin_openxr1 I/RustStdoutStderr:   26:       0x789fb1f944 - <unknown>
2023-06-21 17:40:37.876 8139-8165/rust.glutin_openxr1 I/RustStdoutStderr:   27:       0x789fb1ff20 - <unknown>
2023-06-21 17:40:37.876 8139-8165/rust.glutin_openxr1 I/RustStdoutStderr:   28:       0x789fb1f890 - <unknown>
2023-06-21 17:40:37.876 8139-8165/rust.glutin_openxr1 I/RustStdoutStderr:   29:       0x789fb1bebc - <unknown>
2023-06-21 17:40:37.876 8139-8165/rust.glutin_openxr1 I/RustStdoutStderr:   30:       0x789fb1af34 - <unknown>
2023-06-21 17:40:37.876 8139-8165/rust.glutin_openxr1 I/RustStdoutStderr:   31:       0x789fb16198 - <unknown>
2023-06-21 17:40:37.876 8139-8165/rust.glutin_openxr1 I/RustStdoutStderr:   32:       0x789fb4565c - <unknown>
2023-06-21 17:40:37.876 8139-8165/rust.glutin_openxr1 I/RustStdoutStderr:   33:       0x79bb73edf0 - <unknown>
2023-06-21 17:40:37.876 8139-8165/rust.glutin_openxr1 I/RustStdoutStderr:   34:       0x79bb6eb030 - <unknown>
2023-06-21 17:40:37.877 8139-8166/rust.glutin_openxr1 I/OpenXR: ------------ xrDestroySession [start] -----------
2023-06-21 17:40:37.877 8139-8166/rust.glutin_openxr1 W/Telemetry: [OpenXR] xrDestroySession: Session is in running state.; 
2023-06-21 17:40:37.877 8139-8166/rust.glutin_openxr1 I/XrRuntimeUtils: XrRuntimeUtils::EndSession
2023-06-21 17:40:37.878 8139-8166/rust.glutin_openxr1 I/TREX: UnregisterInterface: locking mapMutex_
2023-06-21 17:40:37.878 8139-8166/rust.glutin_openxr1 I/TREX: UnregisterInterface: locking mapMutex_ complete
2023-06-21 17:40:37.878 8139-8166/rust.glutin_openxr1 I/TREX: UnregisterInterface: locking mapMutex_
2023-06-21 17:40:37.878 8139-8166/rust.glutin_openxr1 I/TREX: UnregisterInterface: locking mapMutex_ complete
2023-06-21 17:40:37.878 8139-8166/rust.glutin_openxr1 I/TREX: UnregisterInterface: locki
@MarijnS95
Copy link
Member

@mutantbob sorry for the inconvenience. If you had searched the repo for this we've already uncovered that the Quest 2 specifically modified Android's reference implementation: #322

And we fixed that in #325, which will appear in the next breaking release in the coming month or 2.

@mutantbob
Copy link
Author

Is it possible for me to try the patched version in my project? I added

[patch.crates-io]
ndk = {path="../../../vendor/ndk/ndk"}
ndk-sys = {path="../../../vendor/ndk/ndk-sys"}

to my Cargo.toml, but got = note: perhaps two different versions of cratendk_sys are being used? in a compile error, so evidently that wasn't completely effective. cargo tree shows me that the android-activity crate is using ndk-sys v0.4.1+23.1.7779620 while the master branch in this repo is 0.4.0+25.0.8775105 which seems odd (master having a lower version number than a released crate).

@MarijnS95
Copy link
Member

MarijnS95 commented Jun 29, 2023

shows me that the android-activity crate is using ndk-sys v0.4.1+23.1.7779620 while the master branch in this repo is 0.4.0+25.0.8775105 which seems odd (master having a lower version number than a released crate).

Yes, because of a horrible mess with this crate getting republished on the same version by out CI, once with and once without version metadata.

I've ran into the patch situation myself as well and have now pushed fd3dee9 to combat this: this resets master to the latest ndk-sys version published, and it doesn't matter that the NDK version metadata is temporarily going down as it was mismatching the source anyway.

Other refs:
#369 (comment)
#368
#370
rust-lang/cargo#11412

@mutantbob
Copy link
Author

I dusted off the old project to see if I could make use of the fixed ndk crate using a [patch.crates-io].

I was not successful.

If i check out the ndk-0.7.0 tag it does not include the fix so I get the error:

2023-10-08 16:17:30.805 16473-16500/rust.vr_gorgon E/RustPanic: internal error: entered unreachable code: AInputQueue_preDispatchEvent returned non-boolean -1

If I check out 6bc7fce (the last tag before the ndk crate version got incremented to 0.8)

   Compiling android-activity v0.4.3
error[E0412]: cannot find type `size_t` in crate `ndk_sys`
     --> /home/thoth/.cargo/registry/src/index.crates.io-6f17d22bba15001f/android-activity-0.4.3/src/native_activity/glue.rs:683:28
      |
683   |     out_len: *mut ndk_sys::size_t,
      |                            ^^^^^^
      |
     ::: /home/thoth/vendor/ndk/ndk-sys/src/ffi_aarch64.rs:14170:1
      |
14170 | pub type sig_t = __sighandler_t;
      | -------------- similarly named type alias `sig_t` defined here
      |
help: a type alias with a similar name exists
      |
683   |     out_len: *mut ndk_sys::sig_t,
      |                            ~~~~~
help: consider importing this type alias
      |
5     + use libc::size_t;
      |
help: if you import `size_t`, refer to it directly
      |
683   -     out_len: *mut ndk_sys::size_t,
683   +     out_len: *mut size_t,
      |

error[E0412]: cannot find type `size_t` in crate `ndk_sys`
     --> /home/thoth/.cargo/registry/src/index.crates.io-6f17d22bba15001f/android-activity-0.4.3/src/native_activity/glue.rs:691:40
      |
691   |             *out_len = len as ndk_sys::size_t;
      |                                        ^^^^^^
      |
     ::: /home/thoth/vendor/ndk/ndk-sys/src/ffi_aarch64.rs:14170:1
      |
14170 | pub type sig_t = __sighandler_t;
      | -------------- similarly named type alias `sig_t` defined here
      |
help: a type alias with a similar name exists
      |
691   |             *out_len = len as ndk_sys::sig_t;
      |                                        ~~~~~
help: consider importing this type alias
      |
5     + use libc::size_t;
      |
help: if you import `size_t`, refer to it directly
      |
691   -             *out_len = len as ndk_sys::size_t;
691   +             *out_len = len as size_t;
      |

I get the same errors if I use the fd3dee9 .

The compile errors are in the android-activity 0.4.3 crate, so it might be challenging to untangle the dependencies and find a working combination.

@MarijnS95
Copy link
Member

MarijnS95 commented Oct 8, 2023

@mutantbob you might be better off switching to the beta releases on crates.io for both the ndk and android-activity, where the latter also uses a compatible ndk release instead of patching into an incompatible version. This release was made a few weeks ago and surely includes the hacky workaround for the out-of-spec Oculus implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants