blob: 85f305d36bb54e35bd041e80f9aad00e66805d67 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#ifndef YASL_TIMING_H
#define YASL_TIMING_H
#include <stdbool.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
struct yasl_resize_stats {
uint64_t count;
double avg_us;
double max_us;
long minflt;
};
/* Describes last_present_ns, not merely availability of an extension. */
enum yasl_timing_source {
YASL_TIMING_UNKNOWN = 0,
YASL_TIMING_SUBMISSION, /* CPU submission time; not scanout confirmation */
YASL_TIMING_FRAME_CALLBACK, /* compositor pacing callback, not scanout */
YASL_TIMING_PRESENTATION, /* compositor-confirmed presentation */
};
struct yasl_timing {
double refresh_ns;
uint64_t last_present_ns;
uint64_t next_present_ns;
uint64_t frames_skipped;
enum yasl_timing_source source;
struct yasl_resize_stats resize;
};
#define YASL_REFRESH_DEFAULT_NS 16666666.0
struct yasl_frame_clock {
uint64_t last_present_ns;
uint64_t resize_count;
uint64_t resize_sum_ns;
uint64_t resize_max_ns;
long resize_minflt;
uint64_t frame_time_ns;
double refresh_ns;
enum yasl_timing_source source;
};
uint64_t yasl_clock_extend_ms(uint32_t ms, uint64_t now_ns);
void yasl_clock_presented(struct yasl_frame_clock *c, uint64_t now, bool sample);
void yasl_clock_note_resize(struct yasl_frame_clock *c, uint64_t dt_ns);
void yasl_clock_resize_stats(const struct yasl_frame_clock *c,
struct yasl_resize_stats *out);
double yasl_clock_refresh_ms(const struct yasl_frame_clock *c);
uint64_t yasl_clock_next_present_ns(const struct yasl_frame_clock *c);
uint64_t yasl_clock_frame_timestamp_ns(struct yasl_frame_clock *c, uint64_t now);
#ifdef __cplusplus
}
#endif
#endif /* YASL_TIMING_H */
|