• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef ANDROID_DVR_POSE_CLIENT_INTERNAL_H_
2 #define ANDROID_DVR_POSE_CLIENT_INTERNAL_H_
3 
4 #include <stdint.h>
5 
6 #include <dvr/pose_client.h>
7 #include <pdx/file_handle.h>
8 #include <private/dvr/sensor_constants.h>
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 // Sensord head pose ring buffer.
15 typedef struct __attribute__((packed, aligned(16))) DvrPoseRingBuffer {
16   // Ring buffer always at the beginning of the structure, as consumers may
17   // not have access to this parent structure definition.
18   DvrPoseAsync ring[kPoseAsyncBufferTotalCount];
19   // Current vsync_count (where sensord is writing poses from).
20   uint32_t vsync_count;
21 } DvrPoseMetadata;
22 
23 // Called by displayd to give vsync count info to the pose service.
24 // |display_timestamp| Display timestamp is in the middle of scanout.
25 // |display_period_ns| Nanos between vsyncs.
26 // |right_eye_photon_offset_ns| Nanos to shift the prediction timestamp for
27 //    the right eye head pose (relative to the left eye prediction).
28 int privateDvrPoseNotifyVsync(DvrPose* client, uint32_t vsync_count,
29                               int64_t display_timestamp,
30                               int64_t display_period_ns,
31                               int64_t right_eye_photon_offset_ns);
32 
33 // Get file descriptor for access to the shared memory pose buffer. This can be
34 // used with GL extensions that support shared memory buffer objects. The caller
35 // takes ownership of the returned fd and must close it or pass on ownership.
36 int privateDvrPoseGetRingBufferFd(DvrPose* client,
37                                   android::pdx::LocalHandle* fd);
38 
39 #ifdef __cplusplus
40 }  // extern "C"
41 #endif
42 
43 #endif  // ANDROID_DVR_POSE_CLIENT_INTERNAL_H_
44