| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#pragma once |
| 5 |
|
| 6 |
#include <stdbool.h> |
| 7 |
#include <stdint.h> |
| 8 |
#include <xcb/present.h> |
| 9 |
#include <xcb/xcb.h> |
| 10 |
|
| 11 |
#include <ev.h> |
| 12 |
#include <xcb/xproto.h> |
| 13 |
|
| 14 |
#include "config.h" |
| 15 |
#include "x.h" |
| 16 |
|
| 17 |
|
| 18 |
struct vblank_scheduler; |
| 19 |
|
| 20 |
struct vblank_event { |
| 21 |
uint64_t msc; |
| 22 |
uint64_t ust; |
| 23 |
}; |
| 24 |
|
| 25 |
enum vblank_callback_action { |
| 26 |
|
| 27 |
VBLANK_CALLBACK_AGAIN, |
| 28 |
|
| 29 |
VBLANK_CALLBACK_DONE, |
| 30 |
}; |
| 31 |
|
| 32 |
typedef enum vblank_callback_action (*vblank_callback_t)(struct vblank_event *event, |
| 33 |
void *user_data); |
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
bool vblank_scheduler_schedule(struct vblank_scheduler *self, vblank_callback_t cb, |
| 44 |
void *user_data); |
| 45 |
struct vblank_scheduler * |
| 46 |
vblank_scheduler_new(struct ev_loop *loop, struct x_connection *c, xcb_window_t target_window, |
| 47 |
enum vblank_scheduler_type type, bool use_realtime_scheduling); |
| 48 |
void vblank_scheduler_free(struct vblank_scheduler *); |
| 49 |
|
| 50 |
bool vblank_handle_x_events(struct vblank_scheduler *self); |