mirror of
https://github.com/mpv-player/mpv
synced 2024-11-14 22:48:35 +01:00
8d7960f6ef
So the next commit can make EGL use it. EGL has a quite similar function, that practically works the same. Although it's relatively trivial, it's still tricky, and probably shouldn't end up as duplicated code. There are no functional changes, except initialization, and how failure of the glXGetSyncValues call is handled. Also, some comments mention the EGL extension. Note that there's no intention for this code to handle anything else than the very specific OML sync extension (and its EGL equivalent). This is just too weirdly specific to the weird idiosyncrasies of the extension, and it makes no sense to extend it to handle anything else. (Such as Wayland or DXGI presentation feedback.)
29 lines
862 B
C
29 lines
862 B
C
#pragma once
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
// Must be initialized to {0} by user.
|
|
struct oml_sync {
|
|
bool state_ok;
|
|
int64_t last_ust;
|
|
int64_t last_msc;
|
|
int64_t last_sbc;
|
|
int64_t last_sbc_mp_time;
|
|
int64_t user_sbc;
|
|
int64_t vsync_duration;
|
|
int64_t last_skipped_vsyncs;
|
|
int64_t last_queue_display_time;
|
|
};
|
|
|
|
struct vo_vsync_info;
|
|
|
|
// This must be called on every SwapBuffer call. Pass the ust/msc/sbc values
|
|
// returned by a successful GetSyncValues call. Pass -1 for all these 3 values
|
|
// if GetSyncValues returned failure (but note that you need to set them to -1
|
|
// manually).
|
|
void oml_sync_swap(struct oml_sync *oml, int64_t ust, int64_t msc, int64_t sbc);
|
|
|
|
// Can be called any time; returns state determined by last oml_sync_swap() call.
|
|
void oml_sync_get_info(struct oml_sync *oml, struct vo_vsync_info *info);
|