vblank: add GLX_SGI_video_sync based scheduler

Present extension based scheduler doesn't work well on NVIDIA drivers.
GLX_SGI_video_sync is less accurate, but is rumoured to work. See
[kwin's usage](https://invent.kde.org/plasma/kwin/-/blob/master/src/
backends/x11/standalone/x11_standalone_sgivideosyncvsyncmonitor.cpp)

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui
2023-12-19 23:21:53 +00:00
parent db6ed75b60
commit db9b808bfb
4 changed files with 283 additions and 9 deletions

View File

@@ -8,6 +8,7 @@
#include <ev.h>
#include <xcb/xproto.h>
#include "config.h"
#include "x.h"
/// An object that schedule vblank events.
@@ -38,8 +39,9 @@ typedef enum vblank_callback_action (*vblank_callback_t)(struct vblank_event *ev
/// is not enough memory.
bool vblank_scheduler_schedule(struct vblank_scheduler *self, vblank_callback_t cb,
void *user_data);
struct vblank_scheduler *vblank_scheduler_new(struct ev_loop *loop, struct x_connection *c,
xcb_window_t target_window);
struct vblank_scheduler *
vblank_scheduler_new(struct ev_loop *loop, struct x_connection *c,
xcb_window_t target_window, enum vblank_scheduler_type type);
void vblank_scheduler_free(struct vblank_scheduler *);
bool vblank_handle_x_events(struct vblank_scheduler *self);