SXR

svrApiCore

  1. qvrClientStatusCallback:
    client状态回调(kEventSensorError),在sxrInitialize()的时候通过调用QVRServiceClient_SetClientStatusCallback()方法传入

  2. qvrClientThermalNotificationCallback
    温度通知回调(kEventThermal),在sxrBeginVr中设置QVRServiceClient_RegisterForNotification()

  3. svrNotifyFailedQvrService
    不支持VRmode的时候,通过调用SxrApi.java层的方法NotifyNoVr弹出dialog通知用户
    sxrInitialize()中调用

  4. svrGetAndroidOSVersion
    c层读取系统属性

  5. sxrSetPerformanceLevelsInternal
    设置cpu、gpu level
    QVRServiceClient_SetOperatingLevel()
    QVRServiceClient_SetThreadAttributesByType()

  6. L_SetThreadPriority
    设置线程策略和优先级
    QVRServiceClient_SetThreadPriority

  7. 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

  8. sxrShutdown
    gAppContext->svrServiceClient
    gAppContext->qvrHelper
    gAppContext

  9. svrCreatePresentationContextFromNativeWindow
    EGL创建流程

  10. sxrDestroyPresentationContextFromNativeWindow
    EGL销毁流程

  11. sxrPresentationThreadMain
    sxr 投屏的主流程入口
    开启独立的一个线程来处理投屏
    获取tid,设置线程属性,fifo,affinity等
    开启循环,等待有提交的投屏帧,如果新帧小于等于处理过的帧,wait等待,拿到新帧后
    调用SxrPresentationProcessFrame()去处理新帧

  12. SxrPresentationProcessFrame

  13. 处理投屏帧, FBO
    
  14. glBlitFramebuffer-》glBindFramebuffer-》eglSwapBuffers
    
  15. sxrBeginPresentation

  16. 开启svr投屏线程,创建线程、设置线程相关属性,开启线程。
    
  17. 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

  18. sxrEndXr

  1. sxrGetEyePose. 获取眼动追踪姿态 QVRServiceClient_GetEyeTrackingData

QvrServiceClient

  • Client APIs to communicate with QVRService. Typical call flow is as follows:
    1. Create QVRServiceClient object
    1. Call GetVRMode() to verify VR mode is supported and in the STOPPED state
    1. Call RegisterForNotification() to get notified of events
    1. Call GetTrackingMode()/SetTrackinMode() to configure tracking
    1. Call SetDisplayInterruptConfig() to handle display interrupts
    1. Call StartVRMode() to start VR mode
  •   - Handle display interrupt events
    
  •   - Call GetHeadTrackingData() to read latest tracking data
    
    1. Call StopVRMode() when to end VR mode
    1. Delete QVRServiceClient object
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值