• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef ANDROID_DVR_VSYNC_H_
2 #define ANDROID_DVR_VSYNC_H_
3 
4 #include <stdint.h>
5 #include <sys/cdefs.h>
6 
7 __BEGIN_DECLS
8 
9 typedef struct DvrVSyncClient DvrVSyncClient;
10 
11 // Represents a vsync sample. The size of this struct is 32 bytes.
12 typedef struct __attribute__((packed, aligned(16))) DvrVsync {
13   // The timestamp for the last vsync in nanoseconds.
14   uint64_t vsync_timestamp_ns;
15 
16   // The index of the last vsync.
17   uint32_t vsync_count;
18 
19   // Scan out for the left eye = vsync_timestamp_ns + vsync_left_eye_offset_ns.
20   int32_t vsync_left_eye_offset_ns;
21 
22   // Scan out for the right eye = vsync_timestamp_ns + vsync_right_eye_offset_ns
23   int32_t vsync_right_eye_offset_ns;
24 
25   // The period of a vsync in nanoseconds.
26   uint32_t vsync_period_ns;
27 
28   // Padding to 32 bytes so the size is a multiple of 16.
29   uint8_t padding[8];
30 } DvrVsync;
31 
32 // Creates a new client to the system vsync service.
33 int dvrVSyncClientCreate(DvrVSyncClient** client_out);
34 
35 // Destroys the vsync client.
36 void dvrVSyncClientDestroy(DvrVSyncClient* client);
37 
38 // Get the estimated timestamp of the next GPU lens warp preemption event in/
39 // ns. Also returns the corresponding vsync count that the next lens warp
40 // operation will target.
41 int dvrVSyncClientGetSchedInfo(DvrVSyncClient* client, int64_t* vsync_period_ns,
42                                int64_t* next_timestamp_ns,
43                                uint32_t* next_vsync_count);
44 
45 __END_DECLS
46 
47 #endif  // ANDROID_DVR_VSYNC_H_
48