sxrApi.h
- svrApiCore
- QvrServiceClient
svrApiCore
-
qvrClientStatusCallback:
client状态回调(kEventSensorError),在sxrInitialize()的时候通过调用QVRServiceClient_SetClientStatusCallback()方法传入 -
qvrClientThermalNotificationCallback
温度通知回调(kEventThermal),在sxrBeginVr中设置QVRServiceClient_RegisterForNotification() -
svrNotifyFailedQvrService
不支持VRmode的时候,通过调用SxrApi.java层的方法NotifyNoVr弹出dialog通知用户
sxrInitialize()中调用 -
svrGetAndroidOSVersion
c层读取系统属性 -
sxrSetPerformanceLevelsInternal
设置cpu、gpu level
QVRServiceClient_SetOperatingLevel()
QVRServiceClient_SetThreadAttributesByType() -
L_SetThreadPriority
设置线程策略和优先级
QVRServiceClient_SetThreadPriority -
sxrInitialize
主要以填充SvrAppContext成员变量为主线逻辑
looper、 javaVm、 javaEnv、 javaActivityObject
初始化GL扩展相关(Initialize render extensions)
加载SvrApi.java,通过NativeActivity的ClassLoading来加载SvrApi.java类
动态注册JNI
缓存startVsync,stopVsync的methodid
填充sxrDeviceInfo(刷新率,display的宽高,显示orientation,osversion)
创建qvrHelper(QVRServiceClient_Create)
创建svrServiceClient并绑定svrService服务,设置qvrClientStatusCallback
Tracking mode
Load SVR configuration options
VR Casting(调用java层的 presentation show方法)
VsyncCallback or LinePtr
Set other device info
Frustum(left, right)
Foveation Parameters
Tracking Camera
Warp mesh type
打印一些有用log -
sxrShutdown
gAppContext->svrServiceClient
gAppContext->qvrHelper
gAppContext -
svrCreatePresentationContextFromNativeWindow
EGL创建流程 -
sxrDestroyPresentationContextFromNativeWindow
EGL销毁流程 -
sxrPresentationThreadMain
sxr 投屏的主流程入口
开启独立的一个线程来处理投屏
获取tid,设置线程属性,fifo,affinity等
开启循环,等待有提交的投屏帧,如果新帧小于等于处理过的帧,wait等待,拿到新帧后
调用SxrPresentationProcessFrame()去处理新帧 -
SxrPresentationProcessFrame
-
处理投屏帧, FBO
-
glBlitFramebuffer-》glBindFramebuffer-》eglSwapBuffers
-
sxrBeginPresentation
-
开启svr投屏线程,创建线程、设置线程相关属性,开启线程。
-
sxrBeginXr
判断Motion Vector
初始化HeuristicPredict相关属性
getVRmode来确保当前是在stopped状态
设置tracking mode(app resume的时候每次要设置)
创建ModeContext并初始化成员(tid、colorspace、vsync相关、surface,frameparam等)
Start Vsync monitoring(QVRServiceClient_SetDisplayInterruptConfig vsync,lineptr、Choreographer)
通知QvrService开启VRMode:QVRServiceClient_StartVRMode
检查VRmode,检查TrackingMode
获取Ring Buffer Descriptor
获取Param(QVRSERVICE_TRACKER_ANDROID_OFFSET_NS、QVRSERVICE_SERVICE_VERSION、QVRSERVICE_CLIENT_VERSION)
注册过热通知:Enable thermal notifications
设置线程属性:QVRServiceClient_SetThreadAttributesByType
设置cpu/gpu 性能:sxrSetPerformanceLevels
QVRServiceClient_SetDisplayInterruptCapture
开启timewarp:svrBeginTimeWarp
开启投屏:sxrBeginPresentation
开启debugserver:svrStartDebugServer
Controller Manager
Queue提交event:kEventVrModeStarted && kEventThermal -
sxrEndXr
- sxrGetEyePose. 获取眼动追踪姿态 QVRServiceClient_GetEyeTrackingData
QvrServiceClient
- Client APIs to communicate with QVRService. Typical call flow is as follows:
-
- Create QVRServiceClient object
-
- Call GetVRMode() to verify VR mode is supported and in the STOPPED state
-
- Call RegisterForNotification() to get notified of events
-
- Call GetTrackingMode()/SetTrackinMode() to configure tracking
-
- Call SetDisplayInterruptConfig() to handle display interrupts
-
- Call StartVRMode() to start VR mode
-
- Handle display interrupt events
-
- Call GetHeadTrackingData() to read latest tracking data
-
- Call StopVRMode() when to end VR mode
-
- Delete QVRServiceClient object